Changeset 13918
- Timestamp:
- 05/26/12 14:57:36 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/ratescan.cc
r13893 r13918 16 16 17 17 #include "HeadersFTM.h" 18 #include "HeadersRateScan.h" 18 19 19 20 namespace ba = boost::asio; … … 32 33 { 33 34 private: 34 enum states_t35 {36 kStateDimNetworkNA = 1,37 kStateDisconnected,38 kStateConnecting,39 kStateConnected,40 kStateConfiguring,41 kStateInProgress,42 };43 44 35 DimVersion fDim; 45 36 DimState fDimFTM; … … 104 95 return GetCurrentState(); 105 96 106 if (GetCurrentState()!= kStateInProgress)97 if (GetCurrentState()!=RateScan::State::kInProgress) 107 98 return GetCurrentState(); 108 99 … … 193 184 { 194 185 Message("Rate scan stopped due to timeout."); 195 return kStateConnected;186 return RateScan::State::kConnected; 196 187 } 197 188 … … 199 190 { 200 191 Message("Rate scan finished."); 201 return kStateConnected;192 return RateScan::State::kConnected; 202 193 } 203 194 … … 252 243 Message("Configuration for ratescan started."); 253 244 254 return kStateConfiguring;245 return RateScan::State::kConfiguring; 255 246 } 256 247 257 248 int HandleFtmStateChange(/*const EventImp &evt*/) 258 249 { 259 if (GetCurrentState()!= kStateConfiguring)260 return GetCurrentState(); 261 262 if (fDimFTM.state()!=FTM:: kConfigured)250 if (GetCurrentState()!=RateScan::State::kConfiguring) 251 return GetCurrentState(); 252 253 if (fDimFTM.state()!=FTM::State::kConfigured) 263 254 return GetCurrentState(); 264 255 … … 292 283 Message(msg); 293 284 294 return kStateInProgress;285 return RateScan::State::kInProgress; 295 286 } 296 287 297 288 int StopRateScan() 298 289 { 299 if (GetCurrentState()!= kStateConfiguring && GetCurrentState()!=kStateInProgress)290 if (GetCurrentState()!=RateScan::State::kConfiguring && GetCurrentState()!=RateScan::State::kInProgress) 300 291 return GetCurrentState(); 301 292 302 293 Message("Rate scan manually stopped."); 303 294 304 return kStateConnected;295 return RateScan::State::kConnected; 305 296 } 306 297 … … 375 366 { 376 367 if (!fDim.online()) 377 return kStateDimNetworkNA;368 return RateScan::State::kDimNetworkNA; 378 369 379 370 // All subsystems are not connected 380 if (fDimFTM.state()<FTM:: kConnected)381 return kStateDisconnected;371 if (fDimFTM.state()<FTM::State::kConnected) 372 return RateScan::State::kDisconnected; 382 373 383 374 return GetCurrentState(); … … 417 408 418 409 // State names 419 AddStateName( kStateDimNetworkNA, "DimNetworkNotAvailable",410 AddStateName(RateScan::State::kDimNetworkNA, "DimNetworkNotAvailable", 420 411 "The Dim DNS is not reachable."); 421 412 422 AddStateName( kStateDisconnected, "Disconnected",413 AddStateName(RateScan::State::kDisconnected, "Disconnected", 423 414 "The Dim DNS is reachable, but the required subsystems are not available."); 424 415 425 AddStateName( kStateConnected, "Connected",416 AddStateName(RateScan::State::kConnected, "Connected", 426 417 "All needed subsystems are connected to their hardware, no action is performed."); 427 418 428 AddStateName( kStateInProgress, "InProgress",419 AddStateName(RateScan::State::kInProgress, "InProgress", 429 420 "Rate scan in progress."); 430 421 431 AddEvent("START_THRESHOLD_SCAN", "I:3", kStateConnected)422 AddEvent("START_THRESHOLD_SCAN", "I:3", RateScan::State::kConnected) 432 423 (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_THRESHOLD")) 433 424 ("Start rate scan for the threshold in the defined range" … … 436 427 "|step[int]:Single step in DAC counts"); 437 428 438 AddEvent("START_N_OUT_OF_4_SCAN", "I:3", kStateConnected)429 AddEvent("START_N_OUT_OF_4_SCAN", "I:3", RateScan::State::kConnected) 439 430 (bind(&StateMachineRateScan::StartRateScan, this, placeholders::_1, "SET_N_OUT_OF_4")) 440 431 ("Start rate scan for N-out-of-4 in the defined range" … … 443 434 "|step[int]:Single step in DAC counts"); 444 435 445 AddEvent("CHANGE_STEP_SIZE", "I:1", kStateInProgress)436 AddEvent("CHANGE_STEP_SIZE", "I:1", RateScan::State::kInProgress) 446 437 (bind(&StateMachineRateScan::ChangeStepSize, this, placeholders::_1)) 447 438 ("Change the step size during a ratescan in progress" 448 439 "|step[int]:Single step in DAC counts"); 449 440 450 AddEvent("CHANGE_MAXIMUM", "I:1", kStateInProgress)441 AddEvent("CHANGE_MAXIMUM", "I:1", RateScan::State::kInProgress) 451 442 (bind(&StateMachineRateScan::ChangeMaximum, this, placeholders::_1)) 452 443 ("Change the maximum limit during a ratescan in progress" 453 444 "|max[int]:Limiting value in DAC counts"); 454 445 455 AddEvent("STOP", kStateConfiguring, kStateInProgress)446 AddEvent("STOP", RateScan::State::kConfiguring, RateScan::State::kInProgress) 456 447 (bind(&StateMachineRateScan::StopRateScan, this)) 457 448 ("Stop a ratescan in progress"); 458 449 459 AddEvent("SET_REFERENCE_CAMERA", kStateDimNetworkNA, kStateDisconnected, kStateConnected)450 AddEvent("SET_REFERENCE_CAMERA", RateScan::State::kDimNetworkNA, RateScan::State::kDisconnected, RateScan::State::kConnected) 460 451 (bind(&StateMachineRateScan::SetReferenceCamera, this)) 461 452 ("Use the camera trigger rate as reference for the reolution"); 462 AddEvent("SET_REFERENCE_BOARD", "I:1", kStateDimNetworkNA, kStateDisconnected, kStateConnected)453 AddEvent("SET_REFERENCE_BOARD", "I:1", RateScan::State::kDimNetworkNA, RateScan::State::kDisconnected, RateScan::State::kConnected) 463 454 (bind(&StateMachineRateScan::SetReferenceBoard, this, placeholders::_1)) 464 455 ("Use the given board trigger-rate as reference for the reolution" 465 456 "|board[idx]:Index of the board (4*crate+board)"); 466 AddEvent("SET_REFERENCE_PATCH", "I:1", kStateDimNetworkNA, kStateDisconnected, kStateConnected)457 AddEvent("SET_REFERENCE_PATCH", "I:1", RateScan::State::kDimNetworkNA, RateScan::State::kDisconnected, RateScan::State::kConnected) 467 458 (bind(&StateMachineRateScan::SetReferenceBoard, this, placeholders::_1)) 468 459 ("Use the given patch trigger-rate as reference for the reolution" 469 "|patch[idx]:Index of the patch (360*crate+36*board+patch)" 460 "|patch[idx]:Index of the patch (360*crate+36*board+patch)"); 470 461 471 462 AddEvent("PRINT")
Note:
See TracChangeset
for help on using the changeset viewer.