47using namespace std::placeholders;
111 if (!args.
GetArg(
"parent", parent))
return kERR;
115 "RlinkConnect", parent);
116 if (pprox ==
nullptr)
117 return args.
Quit(
string(
"-E: object '") + parent +
118 "' not found or not type RlinkConnect");
133 static RtclNameSet optset(
"-start|-stop|-resume|-test");
135 if (args.
NextOpt(opt, optset)) {
136 if (opt ==
"-start") {
138 if (
Obj().IsActive())
return args.
Quit(
"-E: server already running");
140 }
else if (opt ==
"-stop") {
143 }
else if (opt ==
"-resume") {
144 if (
Obj().IsActive())
return args.
Quit(
"-E: server already running");
147 }
else if (opt ==
"-test") {
166 static RtclNameSet optset(
"-add|-remove|-info|-test|-list");
168 Tcl_Interp* interp = args.
Interp();
172 if (args.
NextOpt(opt, optset)) {
176 if (!args.
GetArg(
"mask", mask,0xff,1))
return kERR;
177 if (!args.
GetArg(
"script", script))
return kERR;
182 up->Add(&
Obj(), interp);
183 }
catch (exception& e) {
184 return args.
Quit(
string(
"-E: handler rejected: ")+e.what());
189 }
else if (opt ==
"-remove") {
196 if ((*it)->Mask() == mask) {
202 return args.
Quit(
string(
"-E: no handler defined for '") +
205 }
else if (opt ==
"-info") {
209 RtclOPtr pres(Tcl_NewListObj(0,
nullptr));
211 if (po->Mask() & mask) {
212 RtclOPtr pele(Tcl_NewListObj(0,
nullptr));
213 Tcl_ListObjAppendElement(
nullptr, pele,
214 Tcl_NewIntObj(po->Mask()) );
215 Tcl_ListObjAppendElement(
nullptr, pele, po->Script() );
216 Tcl_ListObjAppendElement(
nullptr, pres, pele);
222 }
else if (opt ==
"-test") {
228 if (po->Mask() & mask) {
230 int rc = Tcl_EvalObjEx(interp, po->Script(), TCL_EVAL_GLOBAL);
231 if (rc !=
kOK)
return rc;
234 if (nhdl)
return kOK;
235 return args.
Quit(
string(
"-E: no handler defined for '") +
238 }
else if (opt ==
"-list") {
240 vector<uint16_t> vres;
242 vres.push_back(po->Mask());
294 Obj().
Dump(sos, 0,
"", detail);
305 lock_guard<RlinkConnect> lock(
Obj().Connect());
315 lock_guard<RlinkConnect> lock(
Obj().Connect());
326 sos <<
"no default output defined yet...\n";
void SetStatusMask(uint8_t statmsk)
FIXME_docs.
uint8_t StatusValue() const
FIXME_docs.
bool StatusIsChecked() const
FIXME_docs.
uint8_t StatusMask() const
FIXME_docs.
void SetStatusValue(uint8_t stat)
FIXME_docs.
uint32_t TraceLevel() const
FIXME_docs.
void SetConnect(const std::shared_ptr< RlinkConnect > &spconn)
FIXME_docs.
void Print(std::ostream &os) const
FIXME_docs.
void SetTraceLevel(uint32_t level)
FIXME_docs.
void Dump(std::ostream &os, int ind=0, const char *text=0, int detail=0) const
FIXME_docs.
RlinkContext & Context()
FIXME_docs.
bool NextOpt(std::string &val)
FIXME_docs.
const char * PeekArgString(int rind) const
FIXME_docs.
void AppendResultLines(const std::string &str)
FIXME_docs.
bool GetArg(const char *name, Tcl_Obj *&pval)
FIXME_docs.
bool OptValid() const
FIXME_docs.
int Quit(const std::string &str)
FIXME_docs.
void SetResult(const std::string &str)
FIXME_docs.
Tcl_Interp * Interp() const
FIXME_docs.
bool AllDone()
FIXME_docs.
void AddMeth(const std::string &name, methfo_t &&methfo)
FIXME_docs.
bool GetArgsDump(RtclArgs &args, int &detail)
FIXME_docs.
RtclProxyBase * FindProxy(const std::string &type, const std::string &name)
FIXME_docs.
static RtclContext & Find(Tcl_Interp *interp)
FIXME_docs.
int M_get(RtclArgs &args)
FIXME_docs.
void Add(const std::string &name, get_uptr_t &&upget)
FIXME_docs.
Implemenation (inline) of RtclOPtr.
Implemenation (all inline) of class RtclProxyOwned.
const std::shared_ptr< RlinkServer > & ObjSPtr()
FIXME_docs.
RlinkServer & Obj()
FIXME_docs.
int M_server(RtclArgs &args)
FIXME_docs.
int M_default(RtclArgs &args)
FIXME_docs.
std::unique_ptr< RtclAttnShuttle > ahdl_uptr_t
std::shared_ptr< RlinkConnect > fspConn
int M_dump(RtclArgs &args)
FIXME_docs.
int M_set(RtclArgs &args)
FIXME_docs.
int M_get(RtclArgs &args)
FIXME_docs.
~RtclRlinkServer()
Destructor.
alist_t fAttnHdl
list of attn handlers
int M_print(RtclArgs &args)
FIXME_docs.
RtclRlinkServer(Tcl_Interp *interp, const char *name)
Default constructor.
int M_attn(RtclArgs &args)
FIXME_docs.
int M_stats(RtclArgs &args)
FIXME_docs.
virtual int ClassCmdConfig(RtclArgs &args)
FIXME_docs.
void Add(const std::string &name, set_uptr_t &&upset)
FIXME_docs.
int M_set(RtclArgs &args)
FIXME_docs.
static bool Exec(RtclArgs &args, const Context &cntx, Rstats &stats)
FIXME_docs.
static bool GetArgs(RtclArgs &args, Context &cntx)
FIXME_docs.
Tcl_Obj * NewListIntObj(const uint8_t *data, size_t size)
Declaration of class ReventLoop.