Changeset 13844 for trunk/FACT++
- Timestamp:
- 05/23/12 19:32:56 (13 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/feedback.cc
r13838 r13844 65 65 PixelMap fMap; 66 66 67 DimServiceInfoListImp fNetwork;68 69 67 DimVersion fDim; 70 Dim StatefDimFAD;71 Dim StatefDimFSC;72 Dim StatefDimBias;68 DimDescribedState fDimFAD; 69 DimDescribedState fDimFSC; 70 DimDescribedState fDimBias; 73 71 74 72 DimDescribedService fDimReference; … … 769 767 } 770 768 771 const State GetState(const DimState &s) const772 {773 return fNetwork.GetState(s.name(), s.state());774 }775 776 void PrintState(const DimState &state) const777 {778 const State rc = GetState(state);779 780 Out() << state.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";781 Out() << kBold << state.name() << ": ";782 if (rc.index==-3)783 {784 Out() << kReset << "Offline" << endl;785 return;786 }787 if (rc.index==-2)788 Out() << state.state();789 else790 Out() << rc.name << "[" << rc.index << "]";791 Out() << kReset << " - " << kBlue << rc.comment << endl;792 }793 794 769 int Print() const 795 770 { 796 Out() << fDim.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 797 Out() << kBold << "DIM_DNS: " << fDim.version() << endl; 798 799 PrintState(fDimFAD); 800 PrintState(fDimFSC); 801 PrintState(fDimBias); 802 803 return GetCurrentState(); 804 } 805 /* 806 void PrintState(const pair<Time,int> &state, const char *server) 807 { 808 const State rc = fNetwork.GetState(server, state.second); 809 810 Out() << state.first.GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 811 Out() << kBold << server << ": "; 812 Out() << rc.name << "[" << rc.index << "]"; 813 Out() << kReset << " - " << kBlue << rc.comment << endl; 814 } 815 816 int Print() 817 { 818 Out() << fStatusDim.first.GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 819 Out() << kBold << "DIM_DNS: "; 820 if (fStatusDim.second==0) 821 Out() << "Offline" << endl; 822 else 823 Out() << "V" << fStatusDim.second/100 << 'r' << fStatusDim.second%100 << endl; 824 825 PrintState(fStatusFAD, "FAD_CONTROL"); 826 PrintState(fStatusFSC, "FSC_CONTROL"); 827 PrintState(fStatusBias, "BIAS_CONTROL"); 828 829 return GetCurrentState(); 830 } 831 */ 771 Out() << fDim << endl; 772 Out() << fDimFAD << endl; 773 Out() << fDimFSC << endl; 774 Out() << fDimBias << endl; 775 776 return GetCurrentState(); 777 } 778 832 779 int PrintCalibration() 833 780 { -
trunk/FACT++/src/mcp.cc
r13838 r13844 50 50 }; 51 51 52 DimServiceInfoListImp fNetwork;53 54 52 DimVersion fDim; 55 Dim StatefDimFTM;56 Dim StatefDimFAD;57 Dim StatefDimLog;58 Dim StatefDimRC;53 DimDescribedState fDimFTM; 54 DimDescribedState fDimFAD; 55 DimDescribedState fDimLog; 56 DimDescribedState fDimRC; 59 57 60 58 DimDescribedService fService; 61 59 62 const State GetState(const DimState &s) const63 {64 return fNetwork.GetState(s.name(), s.state());65 }66 67 void PrintState(const DimState &state) const68 {69 const State rc = GetState(state);70 71 Out() << state.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";72 Out() << kBold << state.name() << ": ";73 if (rc.index==-3)74 {75 Out() << kReset << "Offline" << endl;76 return;77 }78 if (rc.index==-2)79 Out() << state.state();80 else81 Out() << rc.name << "[" << rc.index << "]";82 Out() << kReset << " - " << kBlue << rc.comment << endl;83 }84 85 60 int Print() const 86 61 { 87 Out() << fDim.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 88 Out() << kBold << "DIM_DNS: " << fDim.version() << endl; 89 90 PrintState(fDim); 91 PrintState(fDimFTM); 92 PrintState(fDimFAD); 93 PrintState(fDimLog); 94 PrintState(fDimRC); 62 Out() << fDim << endl; 63 Out() << fDimFTM << endl; 64 Out() << fDimFAD << endl; 65 Out() << fDimLog << endl; 66 Out() << fDimRC << endl; 95 67 96 68 return GetCurrentState(); -
trunk/FACT++/src/ratecontrol.cc
r13838 r13844 51 51 vector<bool> fBlock; 52 52 53 DimServiceInfoListImp fNetwork;54 55 53 DimVersion fDim; 56 Dim StatefDimFTM;57 Dim StatefDimRS;54 DimDescribedState fDimFTM; 55 DimDescribedState fDimRS; 58 56 59 57 float fTargetRate; … … 431 429 return GetCurrentState(); 432 430 } 433 /*434 void PrintState(const pair<Time,int> &state, const char *server)435 {436 const State rc = fNetwork.GetState(server, state.second);437 438 Out() << state.first.GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";439 Out() << kBold << server << ": ";440 Out() << rc.name << "[" << rc.index << "]";441 Out() << kReset << " - " << kBlue << rc.comment << endl;442 }443 444 int Print()445 {446 Out() << fStatusDim.first.GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";447 Out() << kBold << "DIM_DNS: ";448 if (fStatusDim.second==0)449 Out() << "Offline" << endl;450 else451 Out() << "V" << fStatusDim.second/100 << 'r' << fStatusDim.second%100 << endl;452 453 PrintState(fStatusRS, "RATE_SCAN");454 PrintState(fStatusFTM, "FTM_CONTROL");455 456 return GetCurrentState();457 }458 */459 460 const State GetState(const DimState &s) const461 {462 return fNetwork.GetState(s.name(), s.state());463 }464 465 void PrintState(const DimState &state) const466 {467 const State rc = GetState(state);468 469 Out() << state.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";470 Out() << kBold << state.name() << ": ";471 if (rc.index==-3)472 {473 Out() << kReset << "Offline" << endl;474 return;475 }476 if (rc.index==-2)477 Out() << state.state();478 else479 Out() << rc.name << "[" << rc.index << "]";480 Out() << kReset << " - " << kBlue << rc.comment << endl;481 }482 431 483 432 int Print() const 484 433 { 485 Out() << fDim.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 486 Out() << kBold << "DIM_DNS: " << fDim.version() << endl; 487 488 PrintState(fDimFTM); 489 PrintState(fDimRS); 434 Out() << fDim << endl; 435 Out() << fDimFTM << endl; 436 Out() << fDimRS << endl; 490 437 491 438 return GetCurrentState(); -
trunk/FACT++/src/ratescan.cc
r13838 r13844 42 42 }; 43 43 44 DimServiceInfoListImp fNetwork;45 46 44 DimVersion fDim; 47 45 DimState fDimFTM; … … 224 222 } 225 223 226 const State GetState(const DimState &s) const227 {228 return fNetwork.GetState(s.name(), s.state());229 }230 231 void PrintState(const DimState &state) const232 {233 const State rc = GetState(state);234 235 Out() << state.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";236 Out() << kBold << state.name() << ": ";237 if (rc.index==-3)238 {239 Out() << kReset << "Offline" << endl;240 return;241 }242 if (rc.index==-2)243 Out() << state.state();244 else245 Out() << rc.name << "[" << rc.index << "]";246 Out() << kReset << " - " << kBlue << rc.comment << endl;247 }248 249 224 int Print() const 250 225 { 251 Out() << fDim.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 252 Out() << kBold << "DIM_DNS: " << fDim.version() << endl; 253 254 PrintState(fDimFTM); 226 Out() << fDim << endl; 227 Out() << fDimFTM << endl; 255 228 256 229 return GetCurrentState(); -
trunk/FACT++/src/smartfact.cc
r13838 r13844 326 326 deque<string> fControlMessageHist; 327 327 328 uint32_t fMcpConfigurationState; 328 uint32_t fMcpConfigurationState; // For consistency 329 329 int64_t fMcpConfigurationMaxTime; 330 330 int64_t fMcpConfigurationMaxEvents; … … 372 372 // ------------- Initialize variables before the Dim stuff ------------ 373 373 374 DimServiceInfoListImp fNetwork;375 376 374 DimVersion fDimDNS; 377 375 DimControl fDimControl; 378 Dim StatefDimMcp;379 Dim StatefDimDataLogger;380 Dim StatefDimDriveControl;381 Dim StatefDimMagicWeather;382 Dim StatefDimFeedback;383 Dim StatefDimBiasControl;384 Dim StatefDimFtmControl;385 Dim StatefDimFadControl;386 Dim StatefDimFscControl;387 Dim StatefDimRateControl;388 Dim StatefDimRateScan;389 Dim StatefDimChatServer;376 DimDescribedState fDimMcp; 377 DimDescribedState fDimDataLogger; 378 DimDescribedState fDimDriveControl; 379 DimDescribedState fDimMagicWeather; 380 DimDescribedState fDimFeedback; 381 DimDescribedState fDimBiasControl; 382 DimDescribedState fDimFtmControl; 383 DimDescribedState fDimFadControl; 384 DimDescribedState fDimFscControl; 385 DimDescribedState fDimRateControl; 386 DimDescribedState fDimRateScan; 387 DimDescribedState fDimChatServer; 390 388 391 389 // ------------------------------------------------------------------- 392 /*393 bool HandleService(DimInfo *curr, const DimInfo &service, void (StateMachineSmartFACT::*handle)(const DimData &))394 {395 if (curr!=&service)396 return false;397 398 (this->*handle)(DimData(curr));399 return true;400 }401 */402 390 403 391 bool CheckDataSize(const EventImp &d, const char *name, size_t size, bool min=false) … … 415 403 } 416 404 417 418 405 // ------------------------------------------------------------------- 419 406 … … 528 515 { 529 516 if (!CheckDataSize(d, "Mcp:Configuration", 16, true)) 517 { 518 fMcpConfigurationState = -4; 519 fMcpConfigurationMaxTime = 0; 520 fMcpConfigurationMaxEvents = 0; 521 fMcpConfigurationName = ""; 522 fMcpConfigurationRunStart = Time(Time::none); 530 523 return GetCurrentState(); 524 } 531 525 532 526 fMcpConfigurationState = d.GetQoS(); … … 1322 1316 } 1323 1317 1324 const State GetState(const DimState &s) const1325 {1326 return fNetwork.GetState(s.name(), s.state());1327 }1328 1329 void PrintState(const DimState &state) const1330 {1331 const State rc = GetState(state);1332 1333 Out() << state.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - ";1334 Out() << kBold << state.name() << ": ";1335 if (rc.index==-3)1336 {1337 Out() << kReset << "Offline" << endl;1338 return;1339 }1340 if (rc.index==-2)1341 Out() << state.state();1342 else1343 Out() << rc.name << "[" << rc.index << "]";1344 Out() << kReset << " - " << kBlue << rc.comment << endl;1345 }1346 1347 1318 int Print() const 1348 1319 { 1349 Out() << fDimDNS.time().GetAsStr("%H:%M:%S.%f").substr(0, 12) << " - "; 1350 Out() << kBold << "DIM_DNS: " << fDimDNS.version() << endl; 1351 1352 PrintState(fDimMcp); 1353 PrintState(fDimControl); 1354 PrintState(fDimDataLogger); 1355 PrintState(fDimDriveControl); 1356 PrintState(fDimFadControl); 1357 PrintState(fDimFtmControl); 1358 PrintState(fDimBiasControl); 1359 PrintState(fDimFeedback); 1360 PrintState(fDimRateControl); 1361 PrintState(fDimFscControl); 1362 PrintState(fDimMagicWeather); 1363 PrintState(fDimRateScan); 1364 PrintState(fDimChatServer); 1320 Out() << fDimDNS << endl; 1321 Out() << fDimMcp << endl; 1322 Out() << fDimControl << endl; 1323 Out() << fDimDataLogger << endl; 1324 Out() << fDimDriveControl << endl; 1325 Out() << fDimFadControl << endl; 1326 Out() << fDimFtmControl << endl; 1327 Out() << fDimBiasControl << endl; 1328 Out() << fDimFeedback << endl; 1329 Out() << fDimRateControl << endl; 1330 Out() << fDimFscControl << endl; 1331 Out() << fDimMagicWeather << endl; 1332 Out() << fDimRateScan << endl; 1333 Out() << fDimChatServer << endl; 1365 1334 1366 1335 return GetCurrentState(); … … 1379 1348 } 1380 1349 1381 const State rc = GetState(state);1350 const State rc = state.description(); 1382 1351 1383 1352 // Sate not found in list, server online (-3: offline; -2: not found) … … 1409 1378 //poll_one(); 1410 1379 1411 if ( fDimDNS.state()==0)1380 if (!fDimDNS.online()) 1412 1381 return kStateDimNetworkNA; 1413 1382 … … 1423 1392 1424 1393 // -------------- System status -------------- 1425 if (f DimMcp.state()>=5) // Idle1394 if (fMcpConfigurationState>=5) // Idle 1426 1395 { 1427 1396 string col = kHtmlBlue; 1428 /*1429 1397 if (fMcpConfigurationState!= 5 && // Idle 1430 1398 fMcpConfigurationState!=11 && // Trigger On 1431 fMcpConfigurationState!=12) // Taking Data*/ 1432 if (fDimMcp.state()!= 5 && // Idle 1433 fDimMcp.state()!=11 && // Trigger On 1434 fDimMcp.state()!=12) // Taking Data 1399 fMcpConfigurationState!=12) // Taking Data 1435 1400 col = kHtmlYellow; 1436 1401 else … … 1442 1407 if (fDimRateControl.state()!=5 && fDimRateScan.state()!=5) 1443 1408 { 1444 switch (f DimMcp.state()/*fMcpConfigurationState*/)1409 switch (fMcpConfigurationState) 1445 1410 { 1446 1411 // kStateIdle … … 1465 1430 out << "Rate scan in progress"; 1466 1431 1467 if (f DimMcp.state()>10 && fDimRateControl.state()!=5)1432 if (fMcpConfigurationState>10 && fDimRateControl.state()!=5) 1468 1433 { 1469 1434 if (fMcpConfigurationMaxEvents>0 || fMcpConfigurationMaxTime>0 || fMcpConfigurationState==12) … … 1514 1479 { 1515 1480 const double dev = fDriveControlTrackingDevHist.size()>0 ? fDriveControlTrackingDevHist.back() : 0; 1516 const State rc = GetState(fDimDriveControl);1481 const State rc = fDimDriveControl.description(); 1517 1482 string col = kHtmlGreen; 1518 1483 if (rc.index==6) // Moving … … 1617 1582 // MCP in ReadyForDatataking/Configuring/Configured/TriggerOn/TakingData 1618 1583 // and Bias not in "data-taking state' => Red 1619 if (f DimMcp.state()>5 &&1584 if (fMcpConfigurationState>5 && 1620 1585 fDimBiasControl.state()!=BIAS::kVoltageOn && 1621 1586 fDimBiasControl.state()!=BIAS::kVoltageOff) … … 1663 1628 out << now.JavaDate() << '\t' << fDimControl.online() << '\n'; 1664 1629 1665 if ( fDimDNS.state()==0)1630 if (!fDimDNS.online()) 1666 1631 out << kHtmlWhite << "\tOffline\n\n\n\n\n\n\n\n\n\n\n\n"; 1667 1632 else … … 1695 1660 fMcpConfigurationMaxTime(0), 1696 1661 fMcpConfigurationMaxEvents(0), 1662 fBiasControlVoltageMed(0), 1663 fBiasControlCurrentMax(0), 1697 1664 fFscControlHumidityAvg(0), 1698 1665 fRateScanDataId(0), … … 1712 1679 fDimChatServer ("CHAT_SERVER") 1713 1680 { 1681 fDimDNS.Subscribe(*this); 1682 fDimControl.Subscribe(*this); 1714 1683 fDimMcp.Subscribe(*this); 1715 1684 fDimDataLogger.Subscribe(*this); … … 1786 1755 AddEvent("PRINT") 1787 1756 (bind(&StateMachineSmartFACT::Print, this)) 1788 (" ");1757 ("Print a list of the states of all connected servers."); 1789 1758 1790 1759 }
Note:
See TracChangeset
for help on using the changeset viewer.