Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | var 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
|
---|
6 | service_ftm.get(5000);
|
---|
7 |
|
---|
8 | // Check for all FTUs to be connected when the next event arrives
|
---|
9 | service_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)
|
---|
30 | dim.send("FTM_CONTROL/PING");
|
---|
31 |
|
---|
32 | // Wait for 1 second for the answer
|
---|
33 | var timeout = new Thread(3000, function(){ if (service_ftm.isOpen) throw new Error("Could not check that all FTUs are ok within 3s."); });
|
---|
34 | while (service_ftm.isOpen)
|
---|
35 | v8.sleep();
|
---|
36 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.