Subversion Repositories HomeAutomation

Rev

Details | Last modification | View Log | SVN | RSS feed

Rev Author Line No. Line
1603 runge 1
 
2
function irReceive(name)
3
{
4
    this.Module(name);
1620 runge 5
    irReceive.instance_ = this;
1603 runge 6
}
7
 
8
Extend(irReceive, Module);
9
 
1620 runge 10
irReceive.instance_ = null;
11
 
1603 runge 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
            }
1619 runge 31
            else
32
            {
33
                Log("Unknown status of IR signal, " + status);
34
            }
1603 runge 35
 
36
            break;
37
        }
38
    }
39
 
40
    this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
41
}
42