Материал из Module developer
Перейти к: навигация, поиск
  // The function for the action 
  function changeLight (in_data) {
     // Output the message about the method launch 
     IR.Log("changeLight run");
     // Output the sent parameters 
     // lamp: 1, set: 100 - the message output in the log 
     IR.JSONLog(in_data);
     // Send the received parameters to the device 
     device.Send(in_data);
  };
  
  // The function for filling in the list of subdevices 
  function fillListSubDevice () {
     listDevice.Clear();
     for (var i=0; i<md.length; i++) {
        listDevice.CreateItem(i, 0, {Text: md[i].data});                     
     };  
  };
  
  // The function for filling in the list of free channels 
  function fillListFreeChannel () {
     m.sort(function(a,b){return a-b;}); // The function for sorting items in ascending order
     list.Clear();   // Clearing the list
     for (var i=0; i<m.length; i++) {
       list.CreateItem(i, 1, {Text: m[i].toString()});  // Заполнение листа
     };
  };
  // Call the function for initial forming of the list of free channels 
  fillListFreeChannel();