FACT++  1.0
template<class T , class S >
int StateMachineLidControl< T, S >::Execute ( )
inlineprivatevirtual

Implements StateMachineAsio< T >.

Definition at line 543 of file lidctrl.cc.

References Error(), Time::GetNextSunRise(), Lid::State::kClosed, Lid::State::kConnected, Lid::State::kDisconnected, Lid::State::kLocked, and Lid::State::kMoving.

544  {
545  const int rc = fLid.GetState();
546  const int state = T::GetCurrentState();
547 
548  if (state==Lid::State::kMoving &&
550  fLastCommand+boost::posix_time::seconds(fTimeToMove+fLid.GetInterval()) > Time())
551  {
552  return Lid::State::kMoving;
553  }
554 
555  const Time now;
556  if (now>fSunRise)
557  {
559  {
560  T::Error("Lidctrl not in 'Closed' at end of nautical twilight!");
561  Close();
562  }
563 
564  fSunRise = now.GetNextSunRise(-6);
565 
566  ostringstream msg;
567  msg << "During next sun-rise nautical twilight will end at " << fSunRise;
568  T::Info(msg);
569 
570  return Lid::State::kLocked;
571  }
572 
573  return rc==Lid::State::kConnected ? state : rc;
574  }
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
Time GetNextSunRise(double horizon) const
Definition: Time.cc:346
Error()
Definition: HeadersFTM.h:197

+ Here is the call graph for this function: