Changeset 11080 for trunk/FACT++/src
- Timestamp:
- 06/20/11 16:35:45 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/fadctrl.cc
r11079 r11080 846 846 } 847 847 848 int PrintEvent(const EventImp &evt) 849 { 850 if (!CheckEventSize(evt.GetSize(), "PrintEvent", 2)) 851 return T::kSM_FatalError; 852 853 const int16_t slot = evt.Get<int16_t>(); 854 855 if (slot<0) 856 { 857 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 858 i->second.second->PrintEvent(); 859 } 860 else 861 { 862 const BoardList::iterator it=fBoards.find(slot); 863 if (it!=fBoards.end()) 864 { 865 it->second.second->PrintEvent(); 866 return T::GetCurrentState(); 867 } 868 848 const BoardList::iterator GetSlot(uint16_t slot) 849 { 850 const BoardList::iterator it=fBoards.find(slot); 851 if (it==fBoards.end()) 852 { 869 853 ostringstream str; 870 854 str << "Slot " << slot << " not found."; … … 872 856 } 873 857 858 return it; 859 } 860 861 int PrintEvent(const EventImp &evt) 862 { 863 if (!CheckEventSize(evt.GetSize(), "PrintEvent", 2)) 864 return T::kSM_FatalError; 865 866 const int16_t slot = evt.Get<int16_t>(); 867 868 if (slot<0) 869 { 870 for (BoardList::iterator i=fBoards.begin(); i!=fBoards.end(); i++) 871 i->second.second->PrintEvent(); 872 } 873 else 874 { 875 const BoardList::iterator it=GetSlot(slot); 876 if (it!=fBoards.end()) 877 it->second.second->PrintEvent(); 878 } 879 874 880 return T::GetCurrentState(); 875 881 } … … 882 888 const int16_t slot = evt.Get<int32_t>(); 883 889 884 const BoardList::iterator it=fBoards.find(slot); 885 if (it==fBoards.end()) 886 { 887 ostringstream str; 888 str << "Slot " << slot << " not found."; 889 T::Warn(str); 890 const BoardList::iterator it=GetSlot(slot); 891 if (it!=fBoards.end()) 892 it->second.second->SetBlockTransmission(evt.Get<uint8_t>(2)); 893 894 return T::GetCurrentState(); 895 } 896 897 int SetBlockTransmissionRange(const EventImp &evt) 898 { 899 if (!CheckEventSize(evt.GetSize(), "SetBlockTransmissionRange", 5)) 900 return T::kSM_FatalError; 901 902 const int16_t *slot = evt.Ptr<int16_t>(); 903 const bool block = evt.Get<uint8_t>(4); 904 905 for (int i=slot[0]; i<=slot[1]; i++) 906 { 907 const BoardList::iterator it=GetSlot(i); 908 if (it!=fBoards.end()) 909 it->second.second->SetBlockTransmission(block); 910 } 911 912 return T::GetCurrentState(); 913 } 914 915 int SetIgnoreSlot(const EventImp &evt) 916 { 917 if (!CheckEventSize(evt.GetSize(), "SetIgnoreSlot", 3)) 918 return T::kSM_FatalError; 919 920 const uint16_t slot = evt.Get<uint16_t>(); 921 922 if (slot>39) 923 { 924 T::Warn("Slot out of range (0-39)."); 890 925 return T::GetCurrentState(); 891 926 } 892 927 893 it->second.second->SetBlockTransmission(evt.Get<uint8_t>(4));894 895 return T::GetCurrentState(); 896 } 897 898 int Set BlockTransmissionRange(const EventImp &evt)899 { 900 if (!CheckEventSize(evt.GetSize(), "Set BlockTransmissionRange", 5))928 SetIgnore(slot, evt.Get<uint8_t>(2)); 929 930 return T::GetCurrentState(); 931 } 932 933 int SetIgnoreSlots(const EventImp &evt) 934 { 935 if (!CheckEventSize(evt.GetSize(), "SetIgnoreSlots", 5)) 901 936 return T::kSM_FatalError; 902 937 903 938 const int16_t *slot = evt.Ptr<int16_t>(); 904 const bool block = evt.Get<uint8_t>(8); 939 const bool block = evt.Get<uint8_t>(4); 940 941 if (slot[0]<0 || slot[1]>39 || slot[0]>slot[1]) 942 { 943 T::Warn("Slot out of range."); 944 return T::GetCurrentState(); 945 } 905 946 906 947 for (int i=slot[0]; i<=slot[1]; i++) 907 { 908 const BoardList::iterator it=fBoards.find(i); 909 if (it==fBoards.end()) 910 { 911 ostringstream str; 912 str << "Slot " << i << " not found."; 913 T::Warn(str); 914 continue; 915 } 916 it->second.second->SetBlockTransmission(block); 917 } 948 SetIgnore(i, block); 918 949 919 950 return T::GetCurrentState(); … … 995 1026 996 1027 if (c->IsTransmissionBlocked()) 997 str << " [blocked]"; 1028 str << " [cmd_blocked]"; 1029 1030 if (fStatus2[idx]==7 && IsIgnored(idx)) 1031 str << " [data_ignored]"; 998 1032 999 1033 T::Out() << str.str() << endl; … … 1332 1366 "|enable[bool]:Whether the command transmission should be blockes (yes) or allowed (no)"); 1333 1367 1368 T::AddEvent("IGNORE_EVENTS_FROM_SLOT", "S:1;B:1") 1369 (boost::bind(&StateMachineFAD::SetIgnoreSlot, this, _1)) 1370 ("Instructs the event-builder to ignore events from the given slot but still read the data from the socket." 1371 "|slot[short]:Slot from which the data should be ignored when building events" 1372 "|enable[bool]:Whether the event builder should ignore data from this slot (yes) or allowed (no)"); 1373 1374 T::AddEvent("IGNORE_EVENTS_FROM_SLOT_RANGE", "S:2;B:1") 1375 (boost::bind(&StateMachineFAD::SetIgnoreSlots, this, _1)) 1376 ("Instructs the event-builder to ignore events from the given slot but still read the data from the socket." 1377 "|first[short]:First slot from which the data should be ignored when building events" 1378 "|last[short]:Last slot from which the data should be ignored when building events" 1379 "|enable[bool]:Whether the event builder should ignore data from this slot (yes) or allowed (no)"); 1380 1334 1381 // Conenction commands 1335 1382 /*
Note:
See TracChangeset
for help on using the changeset viewer.