Subversion Repositories HomeAutomation

Rev

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

  1.  
  2. function irReceive(name)
  3. {
  4.     this.Module(name);
  5.     irReceive.instance_ = this;
  6. }
  7.  
  8. Extend(irReceive, Module);
  9.  
  10. irReceive.instance_ = null;
  11.  
  12. irReceive.prototype.ReceiveMessage = function(id, command, variables)
  13. {
  14.     switch (command)
  15.     {
  16.         case "IR":
  17.         {
  18.             var channel = variables["Channel"];
  19.             var data = variables["IRdata"];
  20.             var protocol = variables["Protocol"];
  21.             var status = variables["Status"];
  22.            
  23.             if (status == "Pressed")
  24.             {
  25.                 this.EventBase.prototype.Trigger.call(this, "onPressed", id, channel, data, protocol);
  26.             }
  27.             else if (status == "Released")
  28.             {
  29.                 this.EventBase.prototype.Trigger.call(this, "onReleased", id, channel, data, protocol);
  30.             }
  31.             else
  32.             {
  33.                 Log("Unknown status of IR signal, " + status);
  34.             }
  35.            
  36.             break;
  37.         }
  38.     }
  39.    
  40.     this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
  41. }
  42.  
  43.