mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +00:00
DDSCommandUI: add support for more commands
This commit is contained in:
parent
0f4595b8c1
commit
5607d47664
|
@ -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}
|
||||||
|
|
|
@ -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,13 +287,19 @@ 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;
|
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;
|
||||||
default:
|
default:
|
||||||
cout << "Unexpected/unknown command received: " << cmd->GetType() << endl;
|
cout << "Unexpected/unknown command received: " << cmd->GetType() << endl;
|
||||||
cout << "Origin: " << senderId << endl;
|
cout << "Origin: " << senderId << 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 {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user