FACT++  1.0
int StateMachineFeedback::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 1144 of file feedback.cc.

References Feedback::State::kCalibrating, FSC::State::kConnected, Feedback::State::kConnected, Feedback::State::kConnecting, BIAS::State::kConnecting, Feedback::State::kDimNetworkNA, Feedback::State::kDisconnected, BIAS::State::kVoltageOff, BIAS::State::kVoltageOn, Feedback::State::kWaitingForData, DimState::online(), Dim::SendCommandNB(), and DimState::state().

1145  {
1146  if (!fDim.online())
1148 
1149  const bool bias = fDimBias.state() >= BIAS::State::kConnecting;
1150  const bool fsc = fDimFSC.state() >= FSC::State::kConnected;
1151 
1152  // All subsystems are not connected
1153  if (!bias && !fsc)
1155 
1156  // Not all subsystems are yet connected
1157  if (!bias || !fsc)
1159 
1162 
1164  return GetCurrentState();
1166  return GetCurrentState();
1167 
1168  // kCalibrated, kWaitingForData, kInProgress
1169 
1171  {
1172  static Time past;
1173  if (fCurrentRequestInterval>0 && Time()-past>boost::posix_time::milliseconds(fCurrentRequestInterval))
1174  {
1175  Dim::SendCommandNB("BIAS_CONTROL/REQUEST_STATUS");
1176  past = Time();
1177  }
1178  }
1179 
1180  return GetCurrentState();
1181  }
DimDescribedState fDimBias
Definition: feedback.cc:38
DimDescribedState fDimFSC
Definition: feedback.cc:37
DimVersion fDim
Definition: feedback.cc:35
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
const int32_t & state() const
Definition: DimState.h:80
uint16_t fCurrentRequestInterval
Definition: feedback.cc:79
void SendCommandNB(const std::string &command)
Definition: Dim.h:30
bool online() const
Definition: DimState.h:82

+ Here is the call graph for this function: