- Timestamp:
- 12/10/10 09:59:23 (14 years ago)
- Location:
- fact/Evidence
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/Evidence/Alarm.cc
r9852 r10068 27 27 28 28 const char* LevelStr[] = {"OK", "WARN", "ERROR", "FATAL", "UNAVAILABLE"}; 29 const int MIN_PERIOD = 5; // Minimum period in seconds for checking servers are alive 29 30 30 31 // … … 38 39 char *AlarmText; 39 40 int MasterAlarm; 40 bool Active;41 41 42 42 void infoHandler(); … … 56 56 }; 57 57 vector<struct Item> List; 58 bool Active; 58 59 59 60 void UpdateAlarmSummary(); … … 128 129 void AlarmHandler::infoHandler() { 129 130 131 // Check if alarm server active 132 if (!Active) return; 133 130 134 // Identify status service 131 135 for (int i=0; i<List.size(); i++) if (getInfo() == List[i].Subscription) { … … 134 138 else { 135 139 int Severity = atoi(ToString(getInfo()->getFormat(), getInfo()->getData(), getInfo()->getSize()).c_str()); 136 if ( Severity > List[i].Level) List[i].Level = Severity;140 if ((Severity>List[i].Level) || (List[i].Level==4 && Severity==0)) List[i].Level = Severity; 137 141 } 138 142 } … … 231 235 // Static declaration ensures calling of destructor by exit() 232 236 static AlarmHandler A; 233 237 238 // Verify periodically that servers exist (if Alarm is active) 234 239 while(!A.ExitRequest) { 235 for (int i=0; i<A.List.size() ; i++) {240 for (int i=0; i<A.List.size() && A.Active; i++) { 236 241 // Check if server exists 237 242 Exist = false; … … 242 247 if (!Exist) A.List[i].Level = 4; 243 248 244 // Check if standard service available in case server not yet ch cked (Level is -1)249 // Check if standard service available in case server not yet checked (Level is -1) 245 250 if (B.getServices((A.List[i].Server+"/VERSION_NUMBER").c_str())>0 && A.List[i].Level==-1) A.List[i].Level = 0; 246 251 } 247 252 248 249 sleep(atoi(A.GetConfig("period").c_str()));250 } 251 } 253 A.UpdateAlarmSummary(); 254 sleep(max(atoi(A.GetConfig("period").c_str()), MIN_PERIOD)); 255 } 256 } -
fact/Evidence/Edd/Edd.cc
r274 r10068 956 956 957 957 Name = "drsdaq/EventData"; 958 Active = false; 958 959 959 960 Tmpfile = tmpfile(); … … 980 981 printf("Failed connection for %s\n", Name.toAscii().data()); 981 982 } 982 Handler->Subscribe(Name);983 SetActive(true); 983 984 } 984 985 … … 986 987 EventScope::~EventScope() { 987 988 988 Handler->Unsubscribe(Name);989 SetActive(false); 989 990 while (!List.isEmpty()) DeleteCurve(List.last().Signal); 990 991 delete RD; … … 1091 1092 1092 1093 // Only process if valid data in RawDataCTX class 1093 if ( ErrCode != CTX_OK) return;1094 if (!Active || ErrCode != CTX_OK) return; 1094 1095 1095 1096 // Set x axis title … … 1161 1162 } 1162 1163 } 1164 1165 // Set display active (if inactive, disconnect from server) 1166 void EventScope::SetActive(bool State) { 1167 1168 if (State && !Active) Handler->Subscribe("drsdaq/EventData"); 1169 if (!State && Active) Handler->Unsubscribe("drsdaq/EventData"); 1170 Active = State; 1171 } 1172 1163 1173 1164 1174 //------------------------------------------------------------------ … … 1209 1219 Plot->setMinimumWidth(400); 1210 1220 for (int i=0; i<18; i++) { 1211 Line = new EddLineDisplay("Bias/VOLT/ID00", i );1221 Line = new EddLineDisplay("Bias/VOLT/ID00", i+64); 1212 1222 Layout->addWidget(Line, i%9+1, 0+i/9, 1, 1); 1213 Plot->AddService("Bias/VOLT/ID00", i );1214 1215 Line = new EddLineDisplay("Bias/VOLT/ID00", i+ 32);1223 Plot->AddService("Bias/VOLT/ID00", i+64); 1224 1225 Line = new EddLineDisplay("Bias/VOLT/ID00", i+96); 1216 1226 Layout->addWidget(Line, i%9+1, 2+i/9, 1, 1); 1217 Plot->AddService("Bias/VOLT/ID00",i+ 32);1227 Plot->AddService("Bias/VOLT/ID00",i+96); 1218 1228 } 1219 1229 … … 1229 1239 Text->setFixedWidth(400); 1230 1240 Layout->addWidget(Text, 11, 0, 4, 4); 1241 1242 QWidget *Button = new QPushButton("Currents"); 1243 Layout->addWidget(Button, 13, 4, 1, 1); 1244 connect(Button, SIGNAL(pressed()), SLOT(BiasCurrents())); 1245 } 1246 1247 void TP_Bias::BiasCurrents() { 1248 1249 QMainWindow *M = new QMainWindow; 1250 M->setCentralWidget(new QWidget); 1251 M->setStatusBar(new QStatusBar(M)); 1252 M->setWindowTitle("Edd - Bias currents"); 1253 M->setAttribute(Qt::WA_DeleteOnClose); 1254 1255 QGridLayout *Layout = new QGridLayout(M->centralWidget()); 1256 EddLineDisplay *Line; 1257 EddPlot *Plot = new EddPlot(); 1258 1259 for (int i=0; i<36; i++) { 1260 Line = new EddLineDisplay("Bias/MICROAMP/ID00", i+64); 1261 Line->setMaximumWidth(60); 1262 Layout->addWidget(Line, i%9, 0+i/9, 1, 1); 1263 Plot->AddService("Bias/MICROAMP/ID00", i+64); 1264 } 1265 Layout->addWidget(Plot, 0, 4, 30, 12); 1266 1267 M->show(); 1231 1268 } 1232 1269 … … 1263 1300 Layout->addWidget(Button, 12, 0, 1, 1); 1264 1301 connect(Button, SIGNAL(pressed()), SLOT(FeedbackDetails())); 1265 1266 1302 } 1267 1303 … … 1341 1377 Layout->addWidget(TabWidget, 1, 1, 5, 5); 1342 1378 1343 connect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString)));1344 connect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString)));1345 1346 1379 // Channel number 1347 1380 Channel = new QSpinBox; … … 1381 1414 connect(Button, SIGNAL(clicked()), SLOT(KeepCurrent())); 1382 1415 1416 // Stop/start 1417 StartStopButton = new QPushButton("Stop"); 1418 StartStopButton->setToolTip("Start/stop display"); 1419 StartStopButton->setMaximumWidth(80); 1420 StartStopButton->setCheckable(true); 1421 QPalette Palette = StartStopButton->palette(); 1422 Palette.setColor(QPalette::ButtonText, Qt::blue); 1423 Palette.setColor(QPalette::Button, Qt::green); 1424 StartStopButton->setPalette(Palette); 1425 StartStopButton->setFont(QFont("Times", 10, QFont::Bold)); 1426 Layout->addWidget(StartStopButton, 4, 0); 1427 connect(StartStopButton, SIGNAL(toggled(bool)), SLOT(StartStop(bool))); 1428 1383 1429 // Button to show event display 1384 1430 QPushButton *PixDisplay = new QPushButton("Pixel display"); … … 1386 1432 PixDisplay->setToolTip("Show event display window"); 1387 1433 PixDisplay->setMaximumWidth(80); 1388 Layout->addWidget(PixDisplay, 4, 0);1434 Layout->addWidget(PixDisplay, 5, 0); 1389 1435 connect(PixDisplay, SIGNAL(clicked()), SLOT(ShowPixelDisplay())); 1390 1436 … … 1411 1457 } 1412 1458 1459 StartStop(false); 1413 1460 connect(Scope, SIGNAL(PixelData(QVector<double>)), SLOT(SetPixelData(QVector<double>))); 1414 1461 } … … 1432 1479 } 1433 1480 1434 // Update event scope1481 // Keep current trace 1435 1482 void TP_DAQ::KeepCurrent() { 1436 1483 1437 1484 Scope->AddTrace(Board->value(), Chip->value(), Channel->value()); 1485 } 1486 1487 // Start/stop event acquisition 1488 void TP_DAQ::StartStop(bool State) { 1489 1490 Scope->SetActive(!State); 1491 StartStopButton->setText(State ? "Start" : "Stop"); 1492 if (!State) { 1493 connect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString))); 1494 connect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString))); 1495 } 1496 else { 1497 disconnect(Scope, SIGNAL(RunHeaderChanged(QString)), RunHeaderDisplay, SLOT(setPlainText(QString))); 1498 disconnect(Scope, SIGNAL(EventHeaderChanged(QString)), EventHeaderDisplay, SLOT(setPlainText(QString))); 1499 } 1438 1500 } 1439 1501 … … 1477 1539 Line->setMaximumWidth(200); 1478 1540 Layout->addWidget(Line, 0, 0, 1, 2); 1541 1542 QPushButton *Button = new QPushButton(); 1543 Button->setText("ON/OFF"); 1544 Button->setCheckable(true); 1545 connect(Button, SIGNAL(toggled(bool)), SLOT(ToggleAlarm(bool))); 1546 Layout->addWidget(Button, 0, 3, 1, 1); 1479 1547 1480 1548 Line = new EddLineDisplay("Alarm/MasterAlarm"); … … 1510 1578 Layout->addWidget(Line, 7, 0, 1, 1); 1511 1579 1512 QPushButton *Button = new QPushButton();1580 Button = new QPushButton(); 1513 1581 Button->setText("eLogBook"); 1514 1582 connect(Button, SIGNAL(released()), SLOT(StartELog())); … … 1522 1590 Line = new EddLineDisplay("Edd/Rate_kBSec"); 1523 1591 Layout->addWidget(Line, 8, 0, 1, 1); 1592 } 1593 1594 // Toggle state of Alarm server 1595 void TP_Evidence::ToggleAlarm(bool State) { 1596 1597 if (State) DimClient::sendCommandNB((char *) "Alarm/Switch", (char *) "off"); 1598 else DimClient::sendCommandNB((char *) "Alarm/Switch", (char *) "on"); 1524 1599 } 1525 1600 -
fact/Evidence/Edd/Edd.h
r274 r10068 276 276 QAction *PhysPipeAction; 277 277 FILE *Tmpfile; 278 bool Active; 278 279 279 280 public: … … 283 284 void UpdateFirst(int, int, int); 284 285 void AddTrace(int, int, int); 286 void SetActive(bool); 285 287 286 288 private slots: … … 306 308 class TP_Bias: public QWidget { 307 309 Q_OBJECT 310 311 private slots: 312 void BiasCurrents(); 308 313 309 314 public: … … 334 339 QWidget *Display; 335 340 QPushButton **Pixel; 341 QPushButton *StartStopButton; 336 342 337 343 private slots: … … 339 345 void UpdateScope(int); 340 346 void KeepCurrent(); 347 void StartStop(bool); 341 348 void ShowPixelDisplay(); 342 349 void SetPixelData(QVector<double>); … … 351 358 352 359 private slots: 360 void ToggleAlarm(bool); 353 361 void StartDIMBrowser(); 354 362 void StartELog(); -
fact/Evidence/readme.txt
r9852 r10068 46 46 is checked in GetConfig() and also from this thread it will make blocking requests. 47 47 12/8/2010 Added command to switch alarm server on/off (command 'Alarm/Switch'). 48 9/12/2010 Minimum period for checking server status in Alarm set to 5 seconds.
Note:
See TracChangeset
for help on using the changeset viewer.