DDSCommandUI: add support for more commands

This commit is contained in:
Alexey Rybalchenko 2019-11-21 10:56:14 +01:00
parent 0f4595b8c1
commit 5607d47664
2 changed files with 16 additions and 8 deletions

View File

@ -62,6 +62,7 @@ fairmq-dds-command-ui -c x -w "DEVICE READY" -n ${requiredNofAgents}
fairmq-dds-command-ui -c j -w "READY" -n ${requiredNofAgents} fairmq-dds-command-ui -c j -w "READY" -n ${requiredNofAgents}
fairmq-dds-command-ui -c r fairmq-dds-command-ui -c r
sampler_and_sink="main/(Sampler|Sink)" sampler_and_sink="main/(Sampler|Sink)"
# processors="main/ProcessorGroup/Processor"
fairmq-dds-command-ui -p $sampler_and_sink -w "RUNNING->READY" -n 2 fairmq-dds-command-ui -p $sampler_and_sink -w "RUNNING->READY" -n 2
echo "...$sampler_and_sink are READY, sending shutdown..." echo "...$sampler_and_sink are READY, sending shutdown..."
fairmq-dds-command-ui -c s -w "RUNNING->READY" -n ${requiredNofAgents} fairmq-dds-command-ui -c s -w "RUNNING->READY" -n ${requiredNofAgents}

View File

@ -74,7 +74,8 @@ void printControlsHelp()
cout << "To quit press Ctrl+C" << endl; cout << "To quit press Ctrl+C" << endl;
} }
void sendCommand(const string& commandIn, const string& topologyPath, CCustomCmd& ddsCustomCmd) { void sendCommand(const string& commandIn, const string& topologyPath, CCustomCmd& ddsCustomCmd)
{
char c; char c;
string command(commandIn); string command(commandIn);
TerminalConfig tconfig; TerminalConfig tconfig;
@ -159,8 +160,6 @@ struct WaitMode
void Run(const chrono::milliseconds& timeout, const string& topologyPath, CCustomCmd& ddsCustomCmd, unsigned int numDevices, const string& command = "") void Run(const chrono::milliseconds& timeout, const string& topologyPath, CCustomCmd& ddsCustomCmd, unsigned int numDevices, const string& command = "")
{ {
StateSubscription stateSubscription(topologyPath, ddsCustomCmd);
if (command != "") { if (command != "") {
sendCommand(command, topologyPath, ddsCustomCmd); sendCommand(command, topologyPath, ddsCustomCmd);
} }
@ -288,12 +287,18 @@ int main(int argc, char* argv[])
} }
break; break;
case Type::transition_status: { case Type::transition_status: {
// if (static_cast<TransitionStatus&>(*cmd).GetResult() == Result::Ok) { if (static_cast<TransitionStatus&>(*cmd).GetResult() == Result::Ok) {
// cout << "Device " << static_cast<TransitionStatus&>(*cmd).GetDeviceId() << " started to transition with " << static_cast<TransitionStatus&>(*cmd).GetTransition() << endl; cout << "Device " << static_cast<TransitionStatus&>(*cmd).GetDeviceId() << " started to transition with " << static_cast<TransitionStatus&>(*cmd).GetTransition() << endl;
// } else { } else {
// cout << "Device " << static_cast<TransitionStatus&>(*cmd).GetDeviceId() << " cannot transition with " << static_cast<TransitionStatus&>(*cmd).GetTransition() << endl; cout << "Device " << static_cast<TransitionStatus&>(*cmd).GetDeviceId() << " cannot transition with " << static_cast<TransitionStatus&>(*cmd).GetTransition() << endl;
// }
} }
}
break;
case Type::current_state:
cout << "Device " << static_cast<CurrentState&>(*cmd).GetDeviceId() << " is in " << static_cast<CurrentState&>(*cmd).GetCurrentState() << " state" << endl;
break;
case Type::config:
cout << "Received config for device " << static_cast<Config&>(*cmd).GetDeviceId() << ":\n" << static_cast<Config&>(*cmd).GetConfig() << endl;
break; break;
default: default:
cout << "Unexpected/unknown command received: " << cmd->GetType() << endl; cout << "Unexpected/unknown command received: " << cmd->GetType() << endl;
@ -305,6 +310,8 @@ int main(int argc, char* argv[])
service.start(sessionID); service.start(sessionID);
StateSubscription stateSubscription(topologyPath, ddsCustomCmd);
if (targetState == "") { if (targetState == "") {
sendCommand(command, topologyPath, ddsCustomCmd); sendCommand(command, topologyPath, ddsCustomCmd);
} else { } else {