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 36 of file timecheck.cc.
References Error(), Tools::Trim(), and DimDescribedService::Update().
44 const string cmd =
"ntpdate -q "+
fServer;
46 Info(
"Calling '"+cmd+
"'");
49 FILE *pipe = popen(cmd.c_str(),
"r");
52 const string err = strerror(errno);
53 Error(
"Could not create pipe '"+cmd+
"': "+err);
62 const int rc = fgetc(pipe);
63 if (rc==EOF || rc==
'\n')
76 line +=
static_cast<unsigned char>(rc);
82 Error(
"First returned line contains other than four arguments (separated by commas)");
86 if (args[2].substr(0, 7)!=
"offset ")
88 Error(
"Argument 3 '"+args[2]+
"' is not what it ought to be.");
94 const float offset = stof(args[2].substr(7));
97 const string msg =
"NTP: "+
fServer+
" returned: "+args[2]+
" ms";
108 catch (
const exception &e)
110 Error(
"Converting offset '"+args[2]+
"' to float failed: "+e.what());
Adds some functionality to boost::posix_time::ptime for our needs.
DimDescribedService fService
int Error(const std::string &str)
int Warn(const std::string &str)
int Info(const std::string &str)
int Message(const std::string &str)