Esempio n. 1
0
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());
        }
    }
}
Esempio n. 2
0
/** stop trigger function */
void StatusSubscribe::stop()
{
    if (m_state == State::Trying) {
        emit fsmTryingStop(QPrivateSignal());
    }
    else if (m_state == State::Up) {
        emit fsmUpStop(QPrivateSignal());
    }
}
Esempio n. 3
0
/** stop trigger function */
void CommandBase::stop()
{
    if (m_state == State::Trying) {
        emit fsmTryingDisconnect(QPrivateSignal());
    }
    else if (m_state == State::Up) {
        emit fsmUpDisconnect(QPrivateSignal());
    }
}
Esempio n. 4
0
/** 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());
    }
}
Esempio n. 5
0
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
     }
}
Esempio n. 6
0
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
     }
}
Esempio n. 7
0
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
     }
}
Esempio n. 8
0
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
     }
}
Esempio n. 9
0
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
     }
}
Esempio n. 10
0
/** 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);
}
Esempio n. 11
0
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();
     }
}
Esempio n. 12
0
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();
     }
}
Esempio n. 13
0
/** 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());
    }
}
Esempio n. 14
0
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();
     }
}
Esempio n. 15
0
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();
     }
}
Esempio n. 16
0
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();
     }
}
Esempio n. 17
0
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();
     }
}
Esempio n. 18
0
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();
     }
}
Esempio n. 19
0
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();
     }
}
Esempio n. 20
0
/** 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);
}
Esempio n. 21
0
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());
    }
}
Esempio n. 22
0
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();
     }
}
Esempio n. 23
0
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();
     }
}
Esempio n. 24
0
/*!
  \reimp
*/
void QTimer::timerEvent(QTimerEvent *e)
{
    if (e->timerId() == id) {
        if (single)
            stop();
        emit timeout(QPrivateSignal());
    }
}
Esempio n. 25
0
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();
     }
}
Esempio n. 26
0
/*!
  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());
}
Esempio n. 27
0
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());
        }
    }
}
Esempio n. 28
0
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());
        }
    }
}
Esempio n. 29
0
/*!
  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());
}
Esempio n. 30
0
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());
        }
    }
}