Tries to send a dim command according to the arguments. The command given is evaluated according to the available format string.
- Parameters
-
lout | the ostream to which errors and debug output is redirected |
server | The name of the server to which the command should be send, e.g. DRIVE |
str | Command and data, eg "TRACK 12.5 13.8" |
- Returns
- If parsing the string was successfull and the command exists in the network true is returned, false otherwise.
Definition at line 732 of file ServiceList.cc.
References GetFormat(), Converter::GetVector(), HasService(), kBlue, kGreen, kRed, and DimClient::sendCommand().
Referenced by DumpServiceList(), and SendDimCommand().
735 size_t p0 =
str.find_first_of(
' ');
736 if (p0==string::npos)
740 const string name =
str.substr(0, p0);
743 const string cmd = server +
'/' + name;
747 lout <<
kRed <<
"Unkown command '" << cmd <<
"'" << endl;
759 lout <<
kRed <<
"Couldn't properly parse the format... ignored." << endl;
765 lout <<
kBlue << cmd;
766 const vector<char> v = conv.GetVector(
str.substr(p0));
771 lout <<
kGreen <<
"Command " << cmd <<
" emitted successfully to DimClient." << endl;
773 lout <<
kRed <<
"ERROR - Sending command " << cmd <<
" failed." << endl;
775 catch (
const std::runtime_error &e)
777 lout << endl <<
kRed << e.what() << endl;
static int sendCommand(const char *name, int data)
bool HasService(const std::string &server, const std::string &service) const
std::string GetFormat(const std::string &server, const std::string &name) const
A compiler for the DIM data format string.