mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 00:31:14 +00:00
GUI Controller
provide a controller which can be used to control state transitions from an external GUI.
This commit is contained in:
parent
5f33401d41
commit
3d2ad3fd3e
|
@ -72,6 +72,9 @@ Control::Control(const string& name, Plugin::Version version, const string& main
|
|||
if (control == "static") {
|
||||
LOG(debug) << "Running builtin controller: static";
|
||||
fControllerThread = thread(&Control::StaticMode, this);
|
||||
} else if (control == "gui") {
|
||||
LOG(debug) << "Running builtin controller: gui";
|
||||
fControllerThread = thread(&Control::GUIMode, this);
|
||||
} else if (control == "dynamic" || control == "external" || control == "interactive") {
|
||||
LOG(debug) << "Running builtin controller: interactive";
|
||||
fControllerThread = thread(&Control::InteractiveMode, this);
|
||||
|
@ -380,6 +383,28 @@ try {
|
|||
ReleaseDeviceControl();
|
||||
}
|
||||
|
||||
auto Control::GUIMode() -> void
|
||||
try {
|
||||
RunStartupSequence();
|
||||
|
||||
{
|
||||
// Wait for next state, which is DeviceState::Ready,
|
||||
// or for device shutdown request (Ctrl-C)
|
||||
pair<bool, fair::mq::State> result;
|
||||
do {
|
||||
result = fStateQueue.WaitForNext(chrono::milliseconds(50));
|
||||
} while (!fDeviceShutdownRequested);
|
||||
}
|
||||
|
||||
RunShutdownSequence();
|
||||
} catch (PluginServices::DeviceControlError& e) {
|
||||
// If we are here, it means another plugin has taken control. That's fine, just print the
|
||||
// exception message and do nothing else.
|
||||
LOG(debug) << e.what();
|
||||
} catch (DeviceErrorState&) {
|
||||
ReleaseDeviceControl();
|
||||
}
|
||||
|
||||
auto Control::SignalHandler() -> void
|
||||
{
|
||||
while (gSignalCount == 0 && !fPluginShutdownRequested) {
|
||||
|
|
|
@ -43,6 +43,7 @@ class Control : public Plugin
|
|||
static auto PrintStateMachine() -> void;
|
||||
auto PrintNumberOfConnectedPeers() -> void;
|
||||
auto StaticMode() -> void;
|
||||
auto GUIMode() -> void;
|
||||
auto SignalHandler() -> void;
|
||||
auto RunShutdownSequence() -> void;
|
||||
auto RunStartupSequence() -> void;
|
||||
|
|
Loading…
Reference in New Issue
Block a user