void Client::enterErrorState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Error State";
+#endif
disconnect();
}
void Client::enterDisconnectedState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Disconnected State";
+#endif
if (socket->state() == QAbstractSocket::BoundState)
socket->disconnectFromHost();
}
void Client::enterConnectingState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Connecting State";
+#endif
if (!m_hostAddress.isNull())
{
void Client::enterConnectedState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Connected State";
+#endif
emit connected();
}
void Client::enterAuthenticatingState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Authenticating State";
+#endif
if (authenticatingStarted)
return;
void Client::doAuthenticate(bool success)
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "doAuthenticate init";
+#endif
authenticatingStarted = false;
if (success)
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "success!";
+#endif
m_sessionId = authReply->sessionId().toUtf8();
emit authenticated();
return;
void Client::enterSendState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Send State";
+#endif
// Do not send commands if wait time didn't end
// Happens if sendState is entered from recv* states.
void Client::enterWaitState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Wait State";
+#endif
// Do not restart timer if it is active
if (!commandTimer->isActive())
void Client::enterIdleState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Idle State";
qDebug() << m_idlePolicy;
+#endif
// If not loogged in, nothing has to be done in idle state.
if (m_sessionId.isEmpty())
void Client::exitIdleState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Exiting Idle State";
+#endif
idleTimer->stop();
}
void Client::enterIdleTiemoutState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering IdleTiemout State";
+#endif
switch (m_idlePolicy)
{
case DoNothingIdlePolicy:
void Client::enterRecieveState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering Recieve State";
+#endif
while (socket->hasPendingDatagrams())
{
char data[UDP_DATAGRAM_MAXIMUM_SIZE];
void Client::enterRecieveFailState()
{
+#ifdef ANIDBUDPCLIENT_CLIENT_STATE_MACHINE_DEBUG
qDebug() << "Entering RecieveFail State";
+#endif
}
// -------------------------------------------------------------------------------------