1 'use strict';
  2 
  3 function handleFtuCheck(wait_state)
  4 {
  5     var service = this.ftuList.get();
  6     if (!service.obj || service.obj.length==0)
  7         return undefined;
  8 
  9     if (!wait_state)
 10     {
 11         dim.send("FTM_CONTOL/PING");
 12         return toString(service.counter);
 13     }
 14 
 15     if (toInt(wait_state)==service.counter)
 16         return wait_state;
 17 
 18     var ping = service.data['Ping'];
 19     for (var i=0; i<40; i++)
 20     {
 21         if (ping[i]==1)
 22             continue;
 23 
 24         dim.log("Problems in the FTU communication found.");
 25         dim.log("Send command to disable all FTUs.");
 26         dim.log(" => Power cycle needed.");
 27         dim.send("FTM_CONTOL/ENABLE_FTU", -1, false);
 28         throw new Error("CrateReset[FTU]");
 29     }
 30 
 31     return "";
 32 }
 33