Changeset 16106
- Timestamp:
- 05/24/13 13:56:21 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r15247 r16106 153 153 } 154 154 155 EventBuilderWrapper::This->debugStream(fSlot*7, fBuffer.data(), bytes_received);156 157 155 if (type==kReadHeader) 158 156 { … … 183 181 UpdateEventHeader(); 184 182 185 EventBuilderWrapper::This->debugHead(f Slot*7, fEventHeader);183 EventBuilderWrapper::This->debugHead(fEventHeader); 186 184 187 185 fBuffer.resize(fEventHeader.fPackageLength-sizeof(FAD::EventHeader)/2); … … 911 909 } 912 910 913 int SetDebugEb(const EventImp &evt)914 {915 if (!CheckEventSize(evt.GetSize(), "SetDebugEb", 1))916 return T::kSM_FatalError;917 918 SetDebugLog(evt.GetBool());919 920 return T::GetCurrentState();921 }922 923 911 const BoardList::iterator GetSlot(uint16_t slot) 924 912 { … … 1022 1010 for (int i=slot[0]; i<=slot[1]; i++) 1023 1011 SetIgnore(i, block); 1024 1025 return T::GetCurrentState();1026 }1027 1028 int SetDumpStream(const EventImp &evt)1029 {1030 if (!CheckEventSize(evt.GetSize(), "SetDumpStream", 1))1031 return T::kSM_FatalError;1032 1033 SetDebugStream(evt.Get<uint8_t>());1034 1035 return T::GetCurrentState();1036 }1037 1038 int SetDumpRecv(const EventImp &evt)1039 {1040 if (!CheckEventSize(evt.GetSize(), "SetDumpRecv", 1))1041 return T::kSM_FatalError;1042 1043 SetDebugRead(evt.Get<uint8_t>());1044 1012 1045 1013 return T::GetCurrentState(); … … 1099 1067 } 1100 1068 1069 fConfigTimer = Time(Time::none); 1070 1101 1071 // Now the old run is stopped already. So all other servers can start a new run 1102 1072 // (Note that we might need another step which only checks if the continous trigger … … 1107 1077 // T::Info(" ==> TODO: Insert/update run configuration in database!"); 1108 1078 1109 fConfigTimer = Time();1110 1111 1079 return FAD::State::kConfiguring1; 1112 1080 } … … 1190 1158 switch (fStatus2[idx]) 1191 1159 { 1192 case 0: str << "1 -7:notconnected)"; break;1193 case 8: str << "1 -7:connected)"; break;1194 default: str << "1 -7:connecting [" << (int)(fStatus2[idx]-1) << "])";break;1160 case 0: str << "1:disconnected)"; break; 1161 case 8: str << "1:connected)"; break; 1162 default: str << "1:connecting)"; break; 1195 1163 } 1196 1164 … … 1201 1169 str << " [data_ignored]"; 1202 1170 1203 if (f StatusC[idx])1171 if (fad->IsConnected() && fStatus2[idx]==8 && fad->IsConfigured()) 1204 1172 str << " [configured]"; 1205 1173 … … 1394 1362 vector<uint8_t> fStatus1; 1395 1363 vector<uint8_t> fStatus2; 1396 vector<uint8_t> fStatusC;1397 1364 bool fStatusT; 1398 1365 … … 1458 1425 // ----- Event builder ----- 1459 1426 1427 stat2[idx] = 0; // disconnected 1460 1428 if (!runs) 1461 1429 continue; 1462 1430 1463 stat2[idx] = GetNumConnected(idx); 1464 1465 if (runs && IsConnecting(idx)) 1431 if (IsConnecting(idx)) 1466 1432 { 1467 1433 nconnecting2++; 1468 stat2[idx] ++;1434 stat2[idx] = 1; // connecting 1469 1435 } 1470 1436 1471 1437 if (IsConnected(idx)) 1472 1438 { 1473 stat2[idx]++;1474 1439 nconnected2++; 1440 stat2[idx] = 8; // connected 1475 1441 } 1476 1442 } … … 1533 1499 // and really sees the software trigger 1534 1500 // FIXME: Do we need this to be configurable? 1535 if (Time()-fConfigTimer<boost::posix_time::milliseconds(3000)) 1501 //if (Time()-fConfigTimer<boost::posix_time::milliseconds(3000)) 1502 1503 // Wait until the configuration commands to all boards 1504 // have been sent and achknowledged 1505 for (BoardList::iterator it=fBoards.begin(); it!=fBoards.end(); it++) 1506 if (!it->second->IsTxQueueEmpty()) 1507 return FAD::State::kConfiguring1; 1508 1509 if (!fConfigTimer) 1510 fConfigTimer = Time(); 1511 1512 // Wait a short moment to ensure that all board have processed 1513 // the received data 1514 if (Time()-fConfigTimer<boost::posix_time::milliseconds(250)) 1536 1515 return FAD::State::kConfiguring1; 1537 1516 … … 1584 1563 // (means the the event builder has received its 1585 1564 // first event) 1586 if ( !IsRunStarted() && nconfigured==nconnected1)1565 if (IsRunWaiting() && nconfigured==nconnected1) 1587 1566 return FAD::State::kConfigured; 1588 1567 1589 if ( IsRunStarted())1590 T::Message("Run successfully started... (gotNewRun called)");1568 if (!IsRunWaiting()) 1569 T::Message("Run successfully started... first data received."); 1591 1570 if (nconfigured!=nconnected1) 1592 1571 T::Message("Configuration of some boards changed."); 1593 1572 } 1594 1573 1595 return GetNumFilesOpen()>0 && IsRunFileOpen() ? FAD::State::kWritingData : FAD::State::kConnected; 1574 // FIXME: Rename WritingData to TakingData 1575 return IsRunInProgress() ? FAD::State::kWritingData : FAD::State::kConnected; 1596 1576 } 1597 1577 … … 1649 1629 StateMachineFAD(ostream &out=cout) : 1650 1630 T(out, "FAD_CONTROL"), EventBuilderWrapper(*static_cast<MessageImp*>(this)), ba::io_service::work(static_cast<ba::io_service&>(*this)), 1651 fStatus1(40), fStatus2(40), fStatus C(40), fStatusT(false),1631 fStatus1(40), fStatus2(40), fStatusT(false), 1652 1632 fDimStartRun("FAD_CONTROL/START_RUN", "X:1;X:1", 1653 1633 "Run numbers" … … 1821 1801 "|debug[bool]:disable or enable debug output for transmitted data (yes/no)"); 1822 1802 1823 T::AddEvent("SET_DEBUG_EVENT_BUILDER_OUT", "B:1")1824 (bind(&StateMachineFAD::SetDebugEb, this, placeholders::_1))1825 ("Enable or disable the debug output from the event builder"1826 "|enable[bool]:Enable/Disable (yes/no)");1827 1828 1803 T::AddEvent("PRINT_EVENT", "S:1") 1829 1804 (bind(&StateMachineFAD::PrintEvent, this, placeholders::_1)) 1830 1805 ("Print (last) event" 1831 1806 "|board[short]:slot from which the event should be printed (-1 for all)"); 1832 1833 T::AddEvent("DUMP_STREAM", "B:1")1834 (bind(&StateMachineFAD::SetDumpStream, this, placeholders::_1))1835 ("For debugging purpose: the binary data stream read from the sockets 0-7 can be dumped to files."1836 "|switch[bool]:Enable (yes) or disable (no)");1837 1838 T::AddEvent("DUMP_RECV", "B:1")1839 (bind(&StateMachineFAD::SetDumpRecv, this, placeholders::_1))1840 ("For debugging purpose: the times when data has been receives are dumped to a file."1841 "|switch[bool]:Enable (yes) or disable (no)");1842 1807 1843 1808 T::AddEvent("BLOCK_TRANSMISSION", "S:1;B:1")
Note:
See TracChangeset
for help on using the changeset viewer.