Subversion Repositories HomeAutomation

Rev

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

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