void ConfigBase::configChannelStateChanged(common::RpcClient::State state) { if (state == common::RpcClient::State::Trying) { if (m_state == State::Listing) { emit fsmListingConfigTrying(QPrivateSignal()); } else if (m_state == State::Up) { emit fsmUpConfigTrying(QPrivateSignal()); } else if (m_state == State::Loading) { emit fsmLoadingConfigTrying(QPrivateSignal()); } } else if (state == common::RpcClient::State::Up) { if (m_state == State::Trying) { emit fsmTryingConfigUp(QPrivateSignal()); } } }
/** stop trigger function */ void StatusSubscribe::stop() { if (m_state == State::Trying) { emit fsmTryingStop(QPrivateSignal()); } else if (m_state == State::Up) { emit fsmUpStop(QPrivateSignal()); } }
/** stop trigger function */ void CommandBase::stop() { if (m_state == State::Trying) { emit fsmTryingDisconnect(QPrivateSignal()); } else if (m_state == State::Up) { emit fsmUpDisconnect(QPrivateSignal()); } }
/** stop trigger function */ void LauncherBase::stop() { if (m_state == State::Trying) { emit fsmTryingDisconnect(QPrivateSignal()); } else if (m_state == State::Syncing) { emit fsmSyncingDisconnect(QPrivateSignal()); } else if (m_state == State::Synced) { emit fsmSyncedDisconnect(QPrivateSignal()); } }
void ConfigBase::fsmLoadingApplicationLoadedEvent() { if (m_state == State::Loading) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event APPLICATION LOADED"); #endif // handle state change emit fsmLoadingExited(QPrivateSignal()); fsmUp(); emit fsmUpEntered(QPrivateSignal()); // execute actions } }
void PreviewSubscribe::fsmTryingConnectedEvent() { if (m_state == State::Trying) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event CONNECTED"); #endif // handle state change emit fsmTryingExited(QPrivateSignal()); fsmUp(); emit fsmUpEntered(QPrivateSignal()); // execute actions } }
void CommandBase::fsmUpCommandTryingEvent() { if (m_state == State::Up) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event COMMAND TRYING"); #endif // handle state change emit fsmUpExited(QPrivateSignal()); fsmTrying(); emit fsmTryingEntered(QPrivateSignal()); // execute actions } }
void LauncherBase::fsmSyncedLauncherTryingEvent() { if (m_state == State::Synced) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event LAUNCHER TRYING"); #endif // handle state change emit fsmSyncedExited(QPrivateSignal()); fsmSyncing(); emit fsmSyncingEntered(QPrivateSignal()); // execute actions } }
void ConfigBase::fsmLoadingConfigTryingEvent() { if (m_state == State::Loading) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event CONFIG TRYING"); #endif // handle state change emit fsmLoadingExited(QPrivateSignal()); fsmTrying(); emit fsmTryingEntered(QPrivateSignal()); // execute actions } }
/** Processes all message received on socket */ void StatusSubscribe::processSocketMessage(const QList<QByteArray> &messageList) { Container &rx = m_socketRx; if (messageList.length() < 2) // in case we received insufficient data { return; } // we only handle the first two messges const auto &topic = messageList.first(); rx.ParseFromArray(messageList.last().data(), messageList.last().size()); #ifdef QT_DEBUG std::string s; gpb::TextFormat::PrintToString(rx, &s); DEBUG_TAG(3, m_debugName, "received message" << QString::fromStdString(s)); #endif // react to any incoming message if (m_state == State::Up) { emit fsmUpAnyMsgReceived(QPrivateSignal()); } // react to ping message if (rx.type() == MT_PING) { return; // ping is uninteresting } // react to emcstat full update message else if (rx.type() == MT_EMCSTAT_FULL_UPDATE) { if (rx.has_pparams()) { ProtocolParameters pparams = rx.pparams(); m_heartbeatInterval = pparams.keepalive_timer(); } if (m_state == State::Trying) { emit fsmTryingFullUpdateReceived(QPrivateSignal()); } } emit socketMessageReceived(topic, rx); }
void StatusSubscribe::fsmDownStartEvent() { if (m_state == State::Down) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event START"); #endif // handle state change emit fsmDownExited(QPrivateSignal()); fsmTrying(); emit fsmTryingEntered(QPrivateSignal()); // execute actions startSocket(); } }
void PreviewSubscribe::fsmUpDisconnectEvent() { if (m_state == State::Up) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event DISCONNECT"); #endif // handle state change emit fsmUpExited(QPrivateSignal()); fsmDown(); emit fsmDownEntered(QPrivateSignal()); // execute actions stopSocket(); } }
/** stop trigger function */ void ConfigBase::stop() { if (m_state == State::Trying) { emit fsmTryingDisconnect(QPrivateSignal()); } else if (m_state == State::Listing) { emit fsmListingDisconnect(QPrivateSignal()); } else if (m_state == State::Up) { emit fsmUpDisconnect(QPrivateSignal()); } else if (m_state == State::Loading) { emit fsmLoadingDisconnect(QPrivateSignal()); } }
void LauncherBase::fsmTryingLaunchercmdUpEvent() { if (m_state == State::Trying) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event LAUNCHERCMD UP"); #endif // handle state change emit fsmTryingExited(QPrivateSignal()); fsmSyncing(); emit fsmSyncingEntered(QPrivateSignal()); // execute actions startLauncherChannel(); } }
void ConfigBase::fsmTryingConfigUpEvent() { if (m_state == State::Trying) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event CONFIG UP"); #endif // handle state change emit fsmTryingExited(QPrivateSignal()); fsmListing(); emit fsmListingEntered(QPrivateSignal()); // execute actions sendListApplications(); } }
void ConfigBase::fsmLoadingDisconnectEvent() { if (m_state == State::Loading) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event DISCONNECT"); #endif // handle state change emit fsmLoadingExited(QPrivateSignal()); fsmDown(); emit fsmDownEntered(QPrivateSignal()); // execute actions stopConfigChannel(); } }
void LogServiceBase::fsmDownConnectEvent() { if (m_state == State::Down) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event CONNECT"); #endif // handle state change emit fsmDownExited(QPrivateSignal()); fsmUp(); emit fsmUpEntered(QPrivateSignal()); // execute actions startLogChannel(); } }
void LauncherBase::fsmSyncedDisconnectEvent() { if (m_state == State::Synced) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event DISCONNECT"); #endif // handle state change emit fsmSyncedExited(QPrivateSignal()); fsmDown(); emit fsmDownEntered(QPrivateSignal()); // execute actions stopLaunchercmdChannel(); stopLauncherChannel(); } }
void CommandBase::fsmUpDisconnectEvent() { if (m_state == State::Up) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event DISCONNECT"); #endif // handle state change emit fsmUpExited(QPrivateSignal()); fsmDown(); emit fsmDownEntered(QPrivateSignal()); // execute actions stopCommandChannel(); clearConnected(); } }
/** Processes all message received on socket */ void PreviewSubscribe::processSocketMessage(const QList<QByteArray> &messageList) { Container &rx = m_socketRx; if (messageList.length() < 2) // in case we received insufficient data { return; } // we only handle the first two messges const auto &topic = messageList.first(); rx.ParseFromArray(messageList.last().data(), messageList.last().size()); #ifdef QT_DEBUG std::string s; gpb::TextFormat::PrintToString(rx, &s); DEBUG_TAG(3, m_debugName, "received message" << QString::fromStdString(s)); #endif // react to any incoming message if (m_state == State::Up) { emit fsmUpMessageReceived(QPrivateSignal()); } emit socketMessageReceived(topic, rx); }
void StatusSubscribe::heartbeatTimerTick() { m_heartbeatLiveness -= 1; if (m_heartbeatLiveness == 0) { if (m_state == State::Up) { emit fsmUpHeartbeatTimeout(QPrivateSignal()); } return; } if (m_state == State::Up) { emit fsmUpHeartbeatTick(QPrivateSignal()); } }
void StatusSubscribe::fsmUpStopEvent() { if (m_state == State::Up) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event STOP"); #endif // handle state change emit fsmUpExited(QPrivateSignal()); fsmDown(); emit fsmDownEntered(QPrivateSignal()); // execute actions stopHeartbeatTimer(); stopSocket(); } }
void StatusSubscribe::fsmTryingFullUpdateReceivedEvent() { if (m_state == State::Trying) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event FULL UPDATE RECEIVED"); #endif // handle state change emit fsmTryingExited(QPrivateSignal()); fsmUp(); emit fsmUpEntered(QPrivateSignal()); // execute actions resetHeartbeatLiveness(); startHeartbeatTimer(); } }
/*! \reimp */ void QTimer::timerEvent(QTimerEvent *e) { if (e->timerId() == id) { if (single) stop(); emit timeout(QPrivateSignal()); } }
void StatusSubscribe::fsmUpHeartbeatTimeoutEvent() { if (m_state == State::Up) { #ifdef QT_DEBUG DEBUG_TAG(1, m_debugName, "Event HEARTBEAT TIMEOUT"); #endif // handle state change emit fsmUpExited(QPrivateSignal()); fsmTrying(); emit fsmTryingEntered(QPrivateSignal()); // execute actions stopHeartbeatTimer(); stopSocket(); startSocket(); } }
/*! Sets the \a sender object associated with this signal transition. */ void QSignalTransition::setSenderObject(const QObject *sender) { Q_D(QSignalTransition); if (sender == d->sender) return; d->unregister(); d->sender = sender; d->maybeRegister(); emit senderObjectChanged(QPrivateSignal()); }
void LauncherBase::launcherChannelStateChanged(application::LauncherSubscribe::State state) { if (state == application::LauncherSubscribe::State::Trying) { if (m_state == State::Synced) { emit fsmSyncedLauncherTrying(QPrivateSignal()); } } else if (state == application::LauncherSubscribe::State::Up) { if (m_state == State::Syncing) { emit fsmSyncingLauncherUp(QPrivateSignal()); } } }
void CommandBase::commandChannelStateChanged(common::RpcClient::State state) { if (state == common::RpcClient::State::Trying) { if (m_state == State::Up) { emit fsmUpCommandTrying(QPrivateSignal()); } } else if (state == common::RpcClient::State::Up) { if (m_state == State::Trying) { emit fsmTryingCommandUp(QPrivateSignal()); } } }
/*! Sets the \a signal associated with this signal transition. */ void QSignalTransition::setSignal(const QByteArray &signal) { Q_D(QSignalTransition); if (signal == d->signal) return; d->unregister(); d->signal = signal; d->maybeRegister(); emit signalChanged(QPrivateSignal()); }
void ConfigBase::sendConfigMessage(ContainerType type, Container &tx) { m_configChannel->sendSocketMessage(type, tx); if (type == MT_RETRIEVE_APPLICATION) { if (m_state == State::Up) { emit fsmUpLoadApplication(QPrivateSignal()); } } }