Changeset 13570
- Timestamp:
- 05/05/12 23:58:53 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/mcp.cc
r13554 r13570 72 72 DimStampedInfo fLog; 73 73 DimStampedInfo fRC; 74 75 DimDescribedService fService; 74 76 75 77 pair<Time, int> GetNewState(DimStampedInfo &info) const … … 272 274 Message(str); 273 275 276 Update(kStateConfiguring1); 277 274 278 return kStateConfiguring1; 275 279 } 276 280 277 void ConfigureFAD()278 { 279 struct Value280 {281 uint64_t time;282 uint64_t nevts;283 char type[]; 284 };285 281 struct Value 282 { 283 uint64_t time; 284 uint64_t nevts; 285 char type[]; 286 }; 287 288 Value *GetBuffer() 289 { 286 290 const size_t len = sizeof(Value)+fRunType.length()+1; 287 291 … … 295 299 strcpy(val->type, fRunType.c_str()); 296 300 301 return val; 302 } 303 304 void Update(int newstate) 305 { 306 Value *buf = GetBuffer(); 307 fService.setQuality(newstate); 308 fService.setData(buf, sizeof(Value)+fRunType.length()+1); 309 fService.Update(); 310 delete buf; 311 } 312 313 void ConfigureFAD() 314 { 315 Value *buf = GetBuffer(); 316 297 317 Message("Configuring FAD"); 298 Dim::SendCommand("FAD_CONTROL/CONFIGURE", buf, len);318 Dim::SendCommand("FAD_CONTROL/CONFIGURE", buf, sizeof(Value)+fRunType.length()+1); 299 319 300 320 delete buf; … … 326 346 Message("Configuring Trigger (FTM)"); 327 347 Dim::SendCommand("FTM_CONTROL/CONFIGURE", fRunType); 348 Update(kStateConfiguring2); 328 349 return kStateConfiguring2; 329 350 } … … 345 366 346 367 ConfigureFAD(); 368 Update(kStateConfiguring3); 347 369 return kStateConfiguring3; 348 370 } … … 357 379 Message("Starting Trigger (FTM)"); 358 380 Dim::SendCommand("FTM_CONTROL/START_TRIGGER"); 381 Update(kStateConfigured); 359 382 return kStateConfigured; 360 383 } … … 364 387 if (fStatusFTM.second != FTM::kTriggerOn) 365 388 return GetCurrentState(); 389 390 Update(kStateIdle); 366 391 367 392 // Now we are taking data... we could now wait for … … 403 428 fFAD("FAD_CONTROL/STATE", (void*)NULL, 0, this), 404 429 fLog("DATA_LOGGER/STATE", (void*)NULL, 0, this), 405 fRC("RATE_CONTROL/STATE", (void*)NULL, 0, this) 430 fRC("RATE_CONTROL/STATE", (void*)NULL, 0, this), 431 fService("CONFIGURATION", "X:1;X:1;C", "") 406 432 { 407 433 // ba::io_service::work is a kind of keep_alive for the loop.
Note:
See TracChangeset
for help on using the changeset viewer.