示例#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());
        }
    }
}
示例#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());
    }
}
示例#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());
    }
}
示例#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());
    }
}
示例#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
     }
}
示例#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
     }
}
示例#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
     }
}
示例#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
     }
}
示例#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
     }
}
示例#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);
}
示例#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();
     }
}
示例#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();
     }
}
示例#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());
    }
}
示例#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();
     }
}
示例#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();
     }
}
示例#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();
     }
}
示例#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();
     }
}
示例#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();
     }
}
示例#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();
     }
}
示例#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);
}
示例#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());
    }
}
示例#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();
     }
}
示例#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();
     }
}
示例#24
0
/*!
  \reimp
*/
void QTimer::timerEvent(QTimerEvent *e)
{
    if (e->timerId() == id) {
        if (single)
            stop();
        emit timeout(QPrivateSignal());
    }
}
示例#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();
     }
}
示例#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());
}
示例#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());
        }
    }
}
示例#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());
        }
    }
}
示例#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());
}
示例#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());
        }
    }
}