FACT++  1.0
int StateMachineSmartFACT::HandleMcpConfiguration ( const EventImp d)
inlineprivate

Definition at line 914 of file smartfact.cc.

References EventImp::Get(), EventImp::GetQoS(), MCP::State::kIdle, DimState::kOffline, MCP::State::kTakingData, Time::none, EventImp::Ptr(), and DimControl::scriptdepth.

Referenced by StateMachineSmartFACT().

915  {
916  if (!CheckDataSize(d, "Mcp:Configuration", 16, true))
917  {
923  return GetCurrentState();
924  }
925 
926  // If a run ends...
928  {
929  // ...and no script is running just play a simple 'tick'
930  // ...and a script is running just play a simple 'tick'
931  if (/*fDimControl.state()<-2 &&*/ fDimControl.scriptdepth==0)
932  SetAudio("dong");
933  else
934  SetAudio("losticks");
935 
937 
938  ostringstream out;
939  out << "<#darkred>" << d.Ptr<char>(16);
940  if (!fDriveControlSourceName.empty())
941  out << " [" << fDriveControlSourceName << ']';
942  out << " (N=" << fFadControlNumEvents << ')';
943  out << "</#>";
944 
945  AddMcpConfigurationHist(d, out.str());
946  }
947 
949  {
951  SetAudio("losticks");
952 
953  ostringstream out;
954  out << "<#darkgreen>" << fMcpConfigurationName;
955  if (!fDriveControlSourceName.empty())
956  out << " [" << fDriveControlSourceName << ']';
957  if (fFadControlStartRun>0)
958  out << " (Run " << fFadControlStartRun << ')';
959  out << "</#>";
960 
961  AddMcpConfigurationHist(d, out.str());
962  }
963 
965  fMcpConfigurationMaxTime = d.Get<uint64_t>();
966  fMcpConfigurationMaxEvents = d.Get<uint64_t>(8);
967  fMcpConfigurationName = d.Ptr<char>(16);
968 
969  return GetCurrentState();
970  }
int GetCurrentState() const
return the current state of the machine
bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false)
Definition: smartfact.cc:669
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
int scriptdepth
Definition: DimState.h:301
bool fLastRunFinishedWithZeroEvents
Definition: smartfact.cc:537
string fDriveControlSourceName
Definition: smartfact.cc:564
void AddMcpConfigurationHist(const EventImp &d, const string &msg)
Definition: smartfact.cc:878
virtual int GetQoS() const
Definition: EventImp.h:58
string fMcpConfigurationName
Definition: smartfact.cc:534
int64_t fMcpConfigurationMaxEvents
Definition: smartfact.cc:533
void SetAudio(const string &name)
Definition: smartfact.cc:615
int64_t fFadControlStartRun
Definition: smartfact.cc:570
int64_t fMcpConfigurationMaxTime
Definition: smartfact.cc:532
int64_t fFadControlNumEvents
Definition: smartfact.cc:569
T Get(size_t offset=0) const
Definition: EventImp.h:66
DimControl fDimControl
Definition: smartfact.cc:624
Do not initialize the time.
Definition: Time.h:51
const T * Ptr(size_t offset=0) const
Definition: EventImp.h:74
int32_t fMcpConfigurationState
Definition: smartfact.cc:531

+ Here is the call graph for this function:

+ Here is the caller graph for this function: