Changeset 10556 for trunk/FACT++
- Timestamp:
- 05/04/11 10:22:14 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r10547 r10556 324 324 }; 325 325 326 v ector<bool> fFtuDisabled;326 valarray<int8_t> fFtuStatus; 327 327 328 328 DimStampedInfo fDimDNS; … … 902 902 FTM::DimStaticData fFtmStaticData; 903 903 904 int fFtuStatus;905 906 907 904 void SetFtuLed(int idx, int counter) 908 905 { 909 if (counter<0) 906 if (counter==0) 907 counter = 3; 908 909 if (counter==-1) 910 counter = 0; 911 912 switch (counter) 913 { 914 case 0: 910 915 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 911 912 if (counter==0) 913 { 916 break; 917 918 case 1: 919 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 920 break; 921 922 case 2: 923 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/orange circle 1.png")); 924 break; 925 926 case 3: 914 927 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/red circle 1.png")); 928 break; 929 } 930 931 fFtuStatus[idx] = counter; 932 } 933 934 void SetFtuStatusLed() 935 { 936 const int max = fFtuStatus.max(); 937 938 switch (max) 939 { 940 case 0: 941 fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 942 fStatusFTULabel->setText("All disabled"); 943 fStatusFTULabel->setToolTip("All FTUs are disabled"); 944 break; 945 946 case 1: 947 fStatusFTULed->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 948 fStatusFTULabel->setToolTip("Communication with FTU is smooth."); 949 fStatusFTULabel->setText("Ok"); 950 break; 951 952 case 2: 953 fStatusFTULed->setIcon(QIcon(":/Resources/icons/orange circle 1.png")); 954 fStatusFTULabel->setText("Warning"); 955 fStatusFTULabel->setToolTip("At least one FTU didn't answer immediately"); 956 break; 957 958 case 3: 915 959 fStatusFTULed->setIcon(QIcon(":/Resources/icons/red circle 1.png")); 916 960 fStatusFTULabel->setToolTip("At least one FTU didn't answer!"); 917 961 fStatusFTULabel->setText("ERROR"); 918 fFtuStatus = 0; 919 } 920 if (counter==1) 921 { 922 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 923 if (fFtuStatus<0) 924 { 925 fStatusFTULed->setIcon(QIcon(":/Resources/icons/green circle 1.png")); 926 fStatusFTULabel->setToolTip("Communication with FTU is smooth."); 927 fStatusFTULabel->setText("Ok"); 928 fFtuStatus = 1; 929 } 930 } 931 932 if (counter>1) 933 { 934 fFtuLED[idx]->setIcon(QIcon(":/Resources/icons/orange circle 1.png")); 935 if (fFtuStatus!=0) 936 { 937 fStatusFTULed->setIcon(QIcon(":/Resources/icons/orange circle 1.png")); 938 fStatusFTULabel->setText("Warning"); 939 fStatusFTULabel->setToolTip("At least one FTU didn't answer immediately"); 940 fFtuStatus = 2; 941 } 942 } 943 944 } 945 962 break; 963 } 964 } 946 965 947 966 void handleFtmStaticData(const DimData &d) … … 990 1009 fEnableTimeMarker->setChecked(sdata.HasTimeMarker()); 991 1010 992 bool active = false;993 1011 for (int i=0; i<40; i++) 994 1012 { 995 1013 if (!sdata.IsActive(i)) 996 {997 1014 SetFtuLed(i, -1); 998 fFtuDisabled[i] = true;999 }1000 1015 else 1001 1016 { 1002 active = true; 1003 if (fFtuDisabled[i]) 1004 { 1017 if (fFtuStatus[i]==0) 1005 1018 SetFtuLed(i, 1); 1006 fFtuDisabled[i] = false;1007 }1008 1019 } 1009 } 1010 1011 if (!active) 1012 DisableStatusLedFtu(); 1020 fFtuLED[i]->setChecked(false); 1021 } 1022 cout << endl; 1023 1024 SetFtuStatusLed(); 1013 1025 1014 1026 #ifdef HAS_ROOT … … 1045 1057 fFtmBoardId->setText(str1.str().c_str()); 1046 1058 fFtmFirmwareId->setText(str2.str().c_str()); 1047 }1048 1049 void DisableStatusLedFtu()1050 {1051 fFtuStatus = -1;1052 fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png"));1053 fStatusFTULabel->setText("All disabled");1054 fStatusFTULabel->setToolTip("All FTUs are disabled");1055 1059 } 1056 1060 … … 1093 1097 fFtuAnswersCrate3->setValue(sdata.fNumBoardsCrate[3]); 1094 1098 1095 DisableStatusLedFtu();1096 1097 1099 for (int i=0; i<40; i++) 1098 { 1099 const bool active = sdata.IsActive(i); 1100 1101 SetFtuLed(i, active ? sdata.fPing[i] : -1); 1102 fFtuDisabled[i] = !active; 1103 } 1100 SetFtuLed(i, sdata.IsActive(i) ? sdata.fPing[i] : -1); 1101 1102 SetFtuStatusLed(); 1104 1103 } 1105 1104 … … 1112 1111 1113 1112 SetFtuLed(sdata.fError.fDestAddress , sdata.fError.fNumCalls); 1113 SetFtuStatusLed(); 1114 1114 1115 1115 // Write to special window! … … 1149 1149 if (!enable) 1150 1150 { 1151 fFtuStatus = -1;1152 1151 fStatusFTULed->setIcon(QIcon(":/Resources/icons/gray circle 1.png")); 1153 1152 fStatusFTULabel->setText("Offline"); … … 1580 1579 public: 1581 1580 FactGui() : 1582 fFtu Disabled(40),1581 fFtuStatus(40), 1583 1582 fDimDNS("DIS_DNS/VERSION_NUMBER", 1, int(0), this), 1584 1583
Note:
See TracChangeset
for help on using the changeset viewer.