Subversion Repositories HomeAutomation

Rev

Rev 999 | Rev 1008 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | SVN | RSS feed

  1.  
  2. function quit()
  3. {
  4.     if (ClientId)
  5.     {
  6.         _quit(ClientId);
  7.     }
  8. }
  9.  
  10. function print(text)
  11. {
  12.     if (ClientId)
  13.     {
  14.         _print(ClientId, text);
  15.     }
  16.     else
  17.     {
  18.         log(text);
  19.     }
  20. }
  21.  
  22. function services()
  23. {
  24.     var list = new Array();
  25.    
  26.     var row = new Array();
  27.    
  28.     row[row.length] = "Type";
  29.     row[row.length] = "Name";
  30.     row[row.length] = "Id";
  31.     row[row.length] = "Online";
  32.    
  33.     list[list.length] = row;
  34.    
  35.     for (var n in ServiceManager.Services)
  36.     {
  37.         var row = new Array();
  38.        
  39.         row[row.length] = ServiceManager.Services[n].getType();
  40.         row[row.length] = ServiceManager.Services[n].getName();
  41.         row[row.length] = ServiceManager.Services[n].getId();
  42.         if (ServiceManager.Services[n].getType() == "CAN")
  43.         {
  44.             row[row.length] = ServiceManager.Services[n].isOnline();
  45.         }
  46.         else
  47.         {
  48.             row[row.length] = "";
  49.         }
  50.        
  51.         list[list.length] = row;
  52.     }
  53.  
  54.     var lines = TextTable.create(list);
  55.    
  56.     for (var n in lines)
  57.     {
  58.         print(lines[n] + "\n");
  59.     }
  60. }
  61.  
  62. function getService(id, name)
  63. {
  64.     var fullId = name + id;
  65.  
  66.     if (!ServiceManager.Services[fullId])
  67.     {
  68.         print("No such service found.\n");
  69.     }
  70.    
  71.     return ServiceManager.Services[fullId];
  72. }
  73.