mirror of
https://github.com/FairRootGroup/FairMQ.git
synced 2025-10-13 08:41:16 +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
ad894c79cf
|
@ -72,6 +72,9 @@ Control::Control(const string& name, Plugin::Version version, const string& main
|
||||||
if (control == "static") {
|
if (control == "static") {
|
||||||
LOG(debug) << "Running builtin controller: static";
|
LOG(debug) << "Running builtin controller: static";
|
||||||
fControllerThread = thread(&Control::StaticMode, this);
|
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") {
|
} else if (control == "dynamic" || control == "external" || control == "interactive") {
|
||||||
LOG(debug) << "Running builtin controller: interactive";
|
LOG(debug) << "Running builtin controller: interactive";
|
||||||
fControllerThread = thread(&Control::InteractiveMode, this);
|
fControllerThread = thread(&Control::InteractiveMode, this);
|
||||||
|
@ -380,6 +383,28 @@ try {
|
||||||
ReleaseDeviceControl();
|
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
|
auto Control::SignalHandler() -> void
|
||||||
{
|
{
|
||||||
while (gSignalCount == 0 && !fPluginShutdownRequested) {
|
while (gSignalCount == 0 && !fPluginShutdownRequested) {
|
||||||
|
|
|
@ -43,6 +43,7 @@ class Control : public Plugin
|
||||||
static auto PrintStateMachine() -> void;
|
static auto PrintStateMachine() -> void;
|
||||||
auto PrintNumberOfConnectedPeers() -> void;
|
auto PrintNumberOfConnectedPeers() -> void;
|
||||||
auto StaticMode() -> void;
|
auto StaticMode() -> void;
|
||||||
|
auto GUIMode() -> void;
|
||||||
auto SignalHandler() -> void;
|
auto SignalHandler() -> void;
|
||||||
auto RunShutdownSequence() -> void;
|
auto RunShutdownSequence() -> void;
|
||||||
auto RunStartupSequence() -> void;
|
auto RunStartupSequence() -> void;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user