Changeset 13905 for trunk/FACT++
- Timestamp:
- 05/26/12 11:27:42 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/smartfact.cc
r13894 r13905 328 328 329 329 deque<string> fControlMessageHist; 330 int32_t fControlScriptDepth; 330 331 331 332 uint32_t fMcpConfigurationState; // For consistency … … 377 378 deque<float> fRateScanDataHist[41]; 378 379 379 boolfHasError;380 int fHasError; 380 381 381 382 // ------------- Initialize variables before the Dim stuff ------------ … … 520 521 int HandleDimControlMessage(const EventImp &d) 521 522 { 523 cout << "Received1: " << d.GetQoS() << endl; 524 522 525 if (d.GetQoS()==90) 523 526 HandleControlMessageImp(d); … … 528 531 void HandleControlStateChange(const EventImp &d) 529 532 { 530 if (d.GetQoS()==-2) 533 DimControl ctrl; 534 ctrl.Handler(d); 535 536 if (d.GetQoS()==-2 && ctrl.scriptdepth==0) 531 537 fControlMessageHist.clear(); 532 538 533 if (d.GetQoS()<0) 534 { 535 DimControl ctrl; 536 ctrl.Handler(d); 539 cout << "Received2: " << d.GetString() << endl; 540 cout << "Received2: " << d.GetQoS() << endl; 541 542 if (d.GetQoS()>=0) 543 return; 537 544 538 545 #if BOOST_VERSION < 104600 539 546 const string file = boost::filesystem::path(ctrl.file).filename(); 540 547 #else 541 548 const string file = boost::filesystem::path(ctrl.file).filename().string(); 542 549 #endif 543 550 544 const string msg = ctrl.shortmsg+"<br>"+file; 545 HandleControlMessageImp(Event(d, msg.data(), msg.length()+1)); 546 } 551 HandleControlMessageImp(Event(d, ctrl.shortmsg.data(), ctrl.shortmsg.length()+1)); 552 HandleControlMessageImp(Event(d, file.data(), file.length()+1)); 547 553 } 548 554 … … 551 557 if (!CheckDataSize(d, "Mcp:Configuration", 16, true)) 552 558 { 553 fMcpConfigurationState = - 4;559 fMcpConfigurationState = -256; 554 560 fMcpConfigurationMaxTime = 0; 555 561 fMcpConfigurationMaxEvents = 0; … … 1497 1503 //poll_one(); 1498 1504 1499 if (!fDimDNS.online())1500 return kStateDimNetworkNA;1501 1502 1505 Time now; 1503 1506 if (now-fLastUpdate<boost::posix_time::seconds(1)) … … 1510 1513 ostringstream msg; 1511 1514 1515 if (fHasError==2) 1516 msg << "SmartFACT backend initializing." << endl; 1517 if (!fDimDNS.online()) 1518 msg << "DIM network not available.<br/>"; 1512 1519 if (fDimDriveControl.state()>0xff) 1513 1520 msg << "Drive in ERROR state<br/>"; … … 1569 1576 1570 1577 fHasError = haserror; 1578 1579 if (!fDimDNS.online()) 1580 return kStateDimNetworkNA; 1571 1581 1572 1582 // ============================================================== … … 1845 1855 StateMachineSmartFACT(ostream &out=cout) : StateMachineDim(out, "SMART_FACT"), 1846 1856 fPath("www/smartfact/data"), 1857 fControlScriptDepth(0), 1847 1858 fMcpConfigurationMaxTime(0), 1848 1859 fMcpConfigurationMaxEvents(0), … … 1855 1866 fRateScanDataId(0), 1856 1867 fRateScanBoard(0), 1857 fHasError( false),1868 fHasError(2), 1858 1869 // --- 1859 1870 fDimMcp ("MCP"), … … 1887 1898 fDimChatServer.Subscribe(*this); 1888 1899 1900 fDimControl.SetCallback(bind(&StateMachineSmartFACT::HandleControlStateChange, this, placeholders::_1)); 1901 fDimControl.AddCallback("dotest.dim", bind(&StateMachineSmartFACT::HandleDoTest, this, placeholders::_1)); 1902 1889 1903 Subscribe("DIM_CONTROL/MESSAGE") 1890 1904 (bind(&StateMachineSmartFACT::HandleDimControlMessage, this, placeholders::_1)); … … 1962 1976 1963 1977 fPath = conf.Get<string>("path"); 1964 1965 fDimControl.SetCallback(bind(&StateMachineSmartFACT::HandleControlStateChange, this, placeholders::_1));1966 fDimControl.AddCallback("dotest.dim", bind(&StateMachineSmartFACT::HandleDoTest, this, placeholders::_1));1967 1978 1968 1979 return -1;
Note:
See TracChangeset
for help on using the changeset viewer.