Subversion Repositories HomeAutomation

Rev

Rev 1603 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

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