Changeset 10937
- Timestamp:
- 06/08/11 20:15:59 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r10920 r10937 349 349 350 350 DimStampedInfo fDimFadFiles; 351 DimStampedInfo fDimFadRuns; 352 DimStampedInfo fDimFadEvents; 353 DimStampedInfo fDimFadCurrentEvent; 354 DimStampedInfo fDimFadConnections; 351 355 352 356 map<string, DimInfo*> fServices; … … 688 692 689 693 template<typename T> 690 T get() const { return *reinterpret_cast<const T*>(data.data()); } 694 T get(uint32_t offset=0) const { return *reinterpret_cast<const T*>(data.data()+offset); } 695 696 template<typename T> 697 const T *ptr(uint32_t offset=0) const { return reinterpret_cast<const T*>(data.data()+offset); } 698 699 template<typename T> 700 const T &ref(uint32_t offset=0) const { return *reinterpret_cast<const T*>(data.data()+offset); } 691 701 692 702 vector<char> vec(int b) const { return vector<char>(data.begin()+b, data.end()); } … … 701 711 } 702 712 int size() const { return data.size(); } 703 const void *ptr() const { return data.data(); }704 713 }; 705 714 … … 735 744 return; 736 745 737 const uint64_t *vals = reinterpret_cast<const uint64_t*>(d.ptr());746 const uint64_t *vals = d.ptr<uint64_t>(); 738 747 739 748 const size_t written = vals[0]; … … 851 860 return; 852 861 853 const uint32_t *vals = reinterpret_cast<const uint32_t*>(d.ptr());862 const uint32_t *vals = d.ptr<uint32_t>(); 854 863 855 864 fLoggerSubscriptions->setValue(vals[0]); … … 873 882 } 874 883 875 /* 876 void handleFadPassport(const DimData &d) 884 void handleFadRuns(const DimData &d) 877 885 { 878 886 if (d.size()==0) 879 887 return; 880 888 881 if (d.size()!=sizeof(FAD::DimPassport)) 882 { 883 cout << "Size mismatch: " << d.size() << " " << sizeof(FAD::DimPassport) << endl; 884 return; 885 } 886 887 const FAD::DimPassport &sdata = *reinterpret_cast<const FAD::DimPassport*>(d.ptr()); 888 889 stringstream str1; 890 str1 << hex << "0x" << setfill('0') << setw(16) << sdata.fDNA; 891 892 fFadVersion->setValue(sdata.fVersion); 893 fFadBoardId->setValue(sdata.fBoardId); 894 fFadDNA->setText(str1.str().c_str()); 895 } 896 897 void handleFadTemperatures(const DimData &d) 889 if (d.size()!=4) 890 { 891 cout << "Size mismatch: " << d.size() << " " << 8 << endl; 892 return; 893 } 894 895 fEvtsRunMax->setValue(d.get<uint32_t>()); 896 } 897 898 void handleFadEvents(const DimData &d) 898 899 { 899 900 if (d.size()==0) 900 901 return; 901 902 902 if (d.size()!=sizeof(FAD::DimTemperatures)) 903 { 904 cout << "Size mismatch: " << d.size() << " " << sizeof(FAD::DimTemperatures) << endl; 905 return; 906 } 907 908 const FAD::DimTemperatures &sdata = *reinterpret_cast<const FAD::DimTemperatures*>(d.ptr()); 909 910 fFadTemp0->setValue(sdata.fTempDrs[0]); 911 fFadTemp1->setValue(sdata.fTempDrs[1]); 912 fFadTemp2->setValue(sdata.fTempDrs[2]); 913 fFadTemp3->setValue(sdata.fTempDrs[3]); 914 } 915 916 void handleFadSetup(const DimData &d) 903 if (d.size()!=8) 904 { 905 cout << "Size mismatch: " << d.size() << " " << 8 << endl; 906 return; 907 } 908 909 const uint32_t *ptr = d.ptr<uint32_t>(); 910 911 fEvtsSuccessCurRun->setValue(ptr[0]); 912 fEvtsSuccessTotal->setValue(ptr[1]); 913 } 914 915 void handleFadCurrentEvent(const DimData &d) 917 916 { 918 917 if (d.size()==0) 919 918 return; 920 919 921 if (d.size()!=sizeof(FAD::DimSetup)) 922 { 923 cout << "Size mismatch: " << d.size() << " " << sizeof(FAD::DimSetup) << endl; 924 return; 925 } 926 927 928 } 929 */ 920 if (d.size()!=4) 921 { 922 cout << "Size mismatch: " << d.size() << " " << 4 << endl; 923 return; 924 } 925 926 fEvtsTriggerId->setValue(d.get<uint32_t>()); 927 } 928 929 void handleFadConnections(const DimData &d) 930 { 931 if (d.size()==0) 932 return; 933 934 if (d.size()!=40) 935 { 936 cout << "Size mismatch: " << d.size() << " " << 40 << endl; 937 return; 938 } 939 940 const uint8_t *ptr = d.ptr<uint8_t>(); 941 942 for (int i=0; i<40; i++) 943 { 944 switch (ptr[i]) 945 { 946 case 0: SetLedColor(fFadLED[i], kLedGray, d.time); break; 947 case 9: SetLedColor(fFadLED[i], kLedGreen, d.time); break; 948 default: SetLedColor(fFadLED[i], kLedOrange, d.time); 949 } 950 } 951 } 952 930 953 // ===================== FTM ============================================ 931 954 … … 943 966 } 944 967 945 const FTM::DimTriggerCounter &sdata = *reinterpret_cast<const FTM::DimTriggerCounter*>(d.ptr());968 const FTM::DimTriggerCounter &sdata = d.ref<FTM::DimTriggerCounter>(); 946 969 947 970 fFtmTime->setText(QString::number(sdata.fTimeStamp/1000000., 'f', 6)+ " s"); … … 1027 1050 } 1028 1051 1029 const uint32_t *sdata = reinterpret_cast<const uint32_t*>(d.ptr());1052 const uint32_t *sdata = d.ptr<uint32_t>(); 1030 1053 1031 1054 fFtmCounterH->setValue(sdata[0]); … … 1051 1074 } 1052 1075 1053 const FTM::DimDynamicData &sdata = *reinterpret_cast<const FTM::DimDynamicData*>(d.ptr());1076 const FTM::DimDynamicData &sdata = d.ref<FTM::DimDynamicData>(); 1054 1077 1055 1078 fOnTime->setText(QString::number(sdata.fOnTimeCounter/1000000., 'f', 6)+" s"); … … 1252 1275 } 1253 1276 1254 const FTM::DimStaticData &sdata = *reinterpret_cast<const FTM::DimStaticData*>(d.ptr());1277 const FTM::DimStaticData &sdata = d.ref<FTM::DimStaticData>(); 1255 1278 1256 1279 fTriggerInterval->setValue(sdata.fTriggerInterval); … … 1324 1347 } 1325 1348 1326 const FTM::DimPassport &sdata = *reinterpret_cast<const FTM::DimPassport*>(d.ptr());1349 const FTM::DimPassport &sdata = d.ref<FTM::DimPassport>(); 1327 1350 1328 1351 stringstream str1, str2; … … 1347 1370 fFtuPing->setChecked(false); 1348 1371 1349 const FTM::DimFtuList &sdata = *reinterpret_cast<const FTM::DimFtuList*>(d.ptr());1372 const FTM::DimFtuList &sdata = d.ref<FTM::DimFtuList>(); 1350 1373 1351 1374 stringstream str; … … 1383 1406 return; 1384 1407 1385 const FTM::DimError &sdata = *reinterpret_cast<const FTM::DimError*>(d.ptr());1408 const FTM::DimError &sdata = d.ref<FTM::DimError>(); 1386 1409 1387 1410 SetFtuLed(sdata.fError.fDestAddress , sdata.fError.fNumCalls, d.time); … … 1439 1462 if (s.index<FAD::kDisconnected) // No Dim connection 1440 1463 SetLedColor(fStatusFADLed, kLedGray, time); 1464 if (s.index==FAD::kOffline) // Dim connection / FTM disconnected 1465 SetLedColor(fStatusFADLed, kLedRed, time); 1441 1466 if (s.index==FAD::kDisconnected) // Dim connection / FTM disconnected 1467 SetLedColor(fStatusFADLed, kLedOrange, time); 1468 if (s.index==FAD::kConnecting) // Dim connection / FTM disconnected 1442 1469 SetLedColor(fStatusFADLed, kLedYellow, time); 1443 if (s.index ==FAD::kConnected) // Dim connection / FTM connected1470 if (s.index>=FAD::kConnected) // Dim connection / FTM connected 1444 1471 { 1445 1472 SetLedColor(fStatusFADLed, kLedGreen, time); … … 1663 1690 if (getInfo()==&fDimDNS) 1664 1691 return PostInfoHandler(&FactGui::handleDimDNS); 1665 1692 #ifdef DEBUG_DIM 1666 1693 cout << "HandleDimInfo " << getInfo()->getName() << endl; 1667 1694 #endif 1668 1695 if (getInfo()==&fDimLoggerStats) 1669 1696 return PostInfoHandler(&FactGui::handleLoggerStats); … … 1671 1698 if (getInfo()==&fDimFadFiles) 1672 1699 return PostInfoHandler(&FactGui::handleFadFiles); 1700 1701 if (getInfo()==&fDimFadConnections) 1702 return PostInfoHandler(&FactGui::handleFadConnections); 1703 1704 if (getInfo()==&fDimFadEvents) 1705 return PostInfoHandler(&FactGui::handleFadEvents); 1706 1707 if (getInfo()==&fDimFadRuns) 1708 return PostInfoHandler(&FactGui::handleFadRuns); 1709 1710 if (getInfo()==&fDimFadCurrentEvent) 1711 return PostInfoHandler(&FactGui::handleFadCurrentEvent); 1673 1712 1674 1713 /* … … 1957 1996 fDimFtmDynamicData ("FTM_CONTROL/DYNAMIC_DATA", (void*)NULL, 0, this), 1958 1997 fDimFtmCounter ("FTM_CONTROL/COUNTER", (void*)NULL, 0, this), 1959 fDimFadFiles ("FAD_CONTROL/FILES", (void*)NULL, 0, this) 1998 fDimFadFiles ("FAD_CONTROL/FILES", (void*)NULL, 0, this), 1999 fDimFadRuns ("FAD_CONTROL/RUNS", (void*)NULL, 0, this), 2000 fDimFadEvents ("FAD_CONTROL/EVENTS", (void*)NULL, 0, this), 2001 fDimFadCurrentEvent ("FAD_CONTROL/CURRENT_EVENT", (void*)NULL, 0, this), 2002 fDimFadConnections ("FAD_CONTROL/CONNECTIONS", (void*)NULL, 0, this) 1960 2003 { 1961 2004 fTriggerWidget->setEnabled(false);
Note:
See TracChangeset
for help on using the changeset viewer.