source: trunk/FACT++/scripts/CheckFTU.js@ 16430

Last change on this file since 16430 was 15296, checked in by tbretz, 12 years ago
Fixed a typo in a command.
File size: 1.0 KB
Line 
1'use strict';
2
3var service_ftm = new Subscription("FTM_CONTROL/FTU_LIST");
4
5// Make sure that we receive a 'Yes, we are connected and names are available' event
6service_ftm.get(5000);
7
8// Check for all FTUs to be connected when the next event arrives
9service_ftm.onchange = function(event)
10{
11 var ping = event.obj['Ping'];
12 for (var i=0; i<40; i++)
13 {
14 if (ping[i]==1)
15 continue;
16
17 console.out("Problems in the FTU communication found.");
18 console.out("Send command to disable all FTUs.");
19 console.out(" => Crate reset needed.");
20
21 dim.send("FTM_CONTROL/ENABLE_FTU", -1, false);
22 throw new Error("CrateReset[FTU]");
23 }
24
25 // Signal success by closing the connection
26 service_ftm.close();
27}
28
29// Send ping (request FTU status)
30dim.send("FTM_CONTROL/PING");
31
32// Wait for 1 second for the answer
33var timeout = new Thread(3000, function(){ if (service_ftm.isOpen) throw new Error("Could not check that all FTUs are ok within 3s."); });
34while (service_ftm.isOpen)
35 v8.sleep();
36
Note: See TracBrowser for help on using the repository browser.