FACT++  1.0
int StateMachineRateScan::StartRateScan ( const EventImp evt,
const string &  command 
)
inlineprivate

Definition at line 233 of file ratescan.cc.

References Error(), fType, EventImp::Get(), RateScan::State::kConfiguring, EventImp::Ptr(), and Dim::SendCommandNB().

Referenced by StateMachineRateScan().

234  {
235  //FIXME: check at least that size>12
236  //if (!CheckEventSize(evt, 12))
237  // return kSM_FatalError;
238 
239  const string fType = evt.Ptr<char>(12);
240 
241  auto it = fTypes.find(fType);
242  if (it==fTypes.end())
243  {
244  Info("StartRateScan - Type '"+fType+"' not found... trying 'default'.");
245 
246  it = fTypes.find("default");
247  if (it==fTypes.end())
248  {
249  Error("StartRateScan - Type 'default' not found.");
250  return GetCurrentState();
251  }
252  }
253 
254  fCounterMax = it->second.fCounterMax;
255  fResolution = it->second.fResolution;
256 
257  fCommand = "FTM_CONTROL/"+command;
258 
259  const int32_t step = evt.Get<int32_t>(8);
260 
261  fThresholdMin = evt.Get<uint32_t>();
262  fThresholdMax = evt.Get<uint32_t>(4);
263  fThresholdStep = abs(step);
264 
265  fThresholdStepDyn = step<0 ? -step : 0;
266 
267  UpdateProc();
268 
269  //Dim::SendCommand("FAD_CONTROL/SET_FILE_FORMAT", uint16_t(0));
270  Dim::SendCommandNB("FTM_CONTROL/CONFIGURE", string("ratescan"));
271 
272  Message("Configuration for ratescan started.");
273 
275  }
int GetCurrentState() const
return the current state of the machine
map< string, config > fTypes
Definition: ratescan.cc:38
uint16_t fType
Type of the data to be received after the header.
Definition: HeadersFTM.h:187
int Error(const std::string &str)
Definition: MessageImp.h:49
void SendCommandNB(const std::string &command)
Definition: Dim.h:30
int Info(const std::string &str)
Definition: MessageImp.h:47
int Message(const std::string &str)
Definition: MessageImp.h:46
T Get(size_t offset=0) const
Definition: EventImp.h:66
const T * Ptr(size_t offset=0) const
Definition: EventImp.h:74

+ Here is the call graph for this function:

+ Here is the caller graph for this function: