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