void WhereRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_VERSION_KEY_, WHERE_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Return the remembered IP address and port\n" "Input: nothing\n" "Output: the remembered IP address and port")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // WhereRequestHandler::fillInDescription
void StartSumRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_VERSION_KEY_, STARTSUM_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Start the running sum\n" "Input: nothing\n" "Output: nothing")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // StartSumRequestHandler::fillInDescription
void MetricsRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_LIST_START_ MpM_REQREP_DICT_START_ MpM_REQREP_DICT_END_ MpM_REQREP_1_OR_MORE_ MpM_REQREP_LIST_END_); info.put(MpM_REQREP_DICT_VERSION_KEY_, METRICS_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Return the measurements for the channels of the " "service\n" "Input: nothing\n" "Output: a list of dictionaries containing " "measurements for the service channels")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // MetricsRequestHandler::fillInDescription
void Prop::scan_xml(const std::string& txt, yarp::os::Property& data) { data.clear(); string line; for (int i=0; i<(int)txt.size(); i++) { char ch = txt[i]; if (ch=='\"') { line += " "; continue; } if (ch!='\r'&&ch!='\n') { line += ch; continue; } Bottle b(line.c_str()); string var = "dud"; for (int j=1; j<b.size(); j++) { if (b.get(j-1).asString()=="id=") { var = b.get(j).asString(); continue; } if (b.get(j-1).asString()=="import=") { data.put(var.c_str(),b.get(j)); } } } }
void Prop::scan_hx(const std::string& txt, yarp::os::Property& data) { data.clear(); string line; for (int i=0; i<(int)txt.size(); i++) { char ch = txt[i]; if (ch=='\r'||ch=='\n') { line = ""; continue; } if (ch=='[') { line += '('; continue; } if (ch==']') { line += ')'; continue; } if (ch==',') { line += ' '; continue; } if (ch!=';') { line += ch; continue; } Bottle b(line.c_str()); string var = "dud"; for (int j=1; j<b.size(); j++) { if (b.get(j-1).asString()=="var") { var = b.get(j).asString(); continue; } if (b.get(j-1).asString()=="=") { Value v = b.get(j); ConstString s = v.asString(); if (s=="true") { data.put(var.c_str(),1); } else if (s=="false") { data.put(var.c_str(),0); } else { data.put(var.c_str(),v); } } } } }
void MatchRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_INPUT_KEY_, MpM_REQREP_INT_ MpM_REQREP_STRING_); info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_LIST_START_ MpM_REQREP_STRING_ MpM_REQREP_0_OR_MORE_ MpM_REQREP_LIST_END_); info.put(MpM_REQREP_DICT_VERSION_KEY_, MATCH_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Find a matching service\n" "Input: an integer (1=return names, 0=return " "ports) and an expression describing the service " "to be found\n" "Output: OK and a list of matching service " "names/ports or FAILED, with a description of " "the problem encountered")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); asList->addString("find"); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // MatchRequestHandler::fillInDescription
void Test16EchoRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_INPUT_KEY_, MpM_REQREP_ANYTHING_ MpM_REQREP_0_OR_MORE_); info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_ANYTHING_ MpM_REQREP_0_OR_MORE_); info.put(MpM_REQREP_DICT_VERSION_KEY_, ECHO_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, "Echo back any input"); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); asList->addString("blorg"); asList->addString("blirg"); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // Test16EchoRequestHandler::fillInDescription
void PingRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_INPUT_KEY_, MpM_REQREP_STRING_); info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_STRING_); info.put(MpM_REQREP_DICT_VERSION_KEY_, PING_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Update the last-pinged time for a service or " "re-register it\n" "Input: the channel used by the service\n" "Output: OK or FAILED, with a description of the " "problem encountered")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // PingRequestHandler::fillInDescription
void RandomRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_INPUT_KEY_, MpM_REQREP_INT_ MpM_REQREP_0_OR_1_); info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_DOUBLE_ MpM_REQREP_1_OR_MORE_); info.put(MpM_REQREP_DICT_VERSION_KEY_, RANDOM_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Generate one or more random numbers\n" "Input: the number of random values to generate\n" "Output one or more random numbers per request")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // RandomRequestHandler::fillInDescription
void RGBLEDRequestHandler::fillInDescription(const YarpString & request, yarp::os::Property & info) { ODL_OBJENTER(); //#### ODL_S1s("request = ", request); //#### ODL_P1("info = ", &info); //#### try { info.put(MpM_REQREP_DICT_REQUEST_KEY_, request); info.put(MpM_REQREP_DICT_INPUT_KEY_, MpM_REQREP_ANYTHING_ MpM_REQREP_0_OR_MORE_); info.put(MpM_REQREP_DICT_OUTPUT_KEY_, MpM_REQREP_ANYTHING_ MpM_REQREP_0_OR_MORE_); info.put(MpM_REQREP_DICT_VERSION_KEY_, RGBLED_REQUEST_VERSION_NUMBER_); info.put(MpM_REQREP_DICT_DETAILS_KEY_, T_("Echo back any input\n" "Input: R G B (floats between 0.0 and 1.0) for " "colour values" "Output: 1 if ok")); yarp::os::Value keywords; yarp::os::Bottle * asList = keywords.asList(); asList->addString(request); info.put(MpM_REQREP_DICT_KEYWORDS_KEY_, keywords); } catch (...) { ODL_LOG("Exception caught"); //#### throw; } ODL_OBJEXIT(); //#### } // RGBLEDRequestHandler::fillInDescription