FACT++  1.0
int SkypeClient::Execute ( )
inlineprivatevirtual

Is called continously to execute actions in the current state.

This is what the state machine is doing in a certain state continously. In an idle state this might just be doing nothing.

In the tracking state of the drive system this might be sending new command values to the drive based on its current position.

The current state of the state machine can be accessed by GetCurrentState()

Returns
Usually it should just return the current state. However, sometimes execution might lead to a new state, e.g. when a hardware error is detected. In this case a new state can be returned to put the state machine into a different state. Note, that the function is responsible of doing all actions connected with the state change itself. If not overwritten it returns the current status.

Reimplemented from StateMachineImp.

Definition at line 597 of file skypeclient.cc.

References FALSE.

598  {
599  fNewState = -1;
600 
601  static GMainContext *context = g_main_loop_get_context(fLoop);
602  g_main_context_iteration(context, FALSE);
603 
604  if (fNewState>0)
605  return fNewState;
606 
607  const Time now;
608 
610  {
611  if (now-fLastPing>boost::posix_time::seconds(15))
612  {
613  if (SendDBusMessage("PING", false)!="PONG")
614  return kStateDisconnected;
615 
616  fLastPing = now;
617  }
618 
619  return GetCurrentState();
620  }
621 
622  if (now-fLastConnect>boost::posix_time::minutes(1))
623  return HandleConnect();
624 
625  return GetCurrentState();
626  }
int GetCurrentState() const
return the current state of the machine
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
string SendDBusMessage(const string &cmd, bool display=true)
Definition: skypeclient.cc:197
#define FALSE
Definition: dim.h:136
int HandleConnect()
Definition: skypeclient.cc:552
GMainLoop * fLoop
Definition: skypeclient.cc:27
Time fLastConnect
Definition: skypeclient.cc:24