Subversion Repositories HomeAutomation

Rev

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

Rev 1620 Rev 1646
-
 
1
 
-
 
2
IRIn_ModuleName     = "irReceive";
-
 
3
IRIn_Channels       = function() { return [ 0 ]; };
-
 
4
 
-
 
5
function IRIr_MessageAliasLookup(module_id, command, variables)
-
 
6
{
-
 
7
    var aliases_data = {};
-
 
8
   
-
 
9
    aliases_data = Module_LookupAliases({
-
 
10
        "module_name" : IRIn_ModuleName,
-
 
11
        "module_id"   : module_id,
-
 
12
        "channel"     : channel
-
 
13
    });
-
 
14
   
-
 
15
    return aliases_data;
-
 
16
}
-
 
17
Module_RegisterMessageAliasLookup(IROut_ModuleName, IROut_MessageAliasLookup);
-
 
18
 
-
 
19
 
-
 
20
 
-
 
21
 
-
 
22
 
-
 
23
 
-
 
24
 
-
 
25
 
-
 
26
 
-
 
27
 
-
 
28
 
-
 
29
 
1
 
30
 
2
function irReceive(name)
31
function irReceive(name)
3
{
32
{
4
    this.Module(name);
33
    this.Module(name);
5
    irReceive.instance_ = this;
34
    irReceive.instance_ = this;
6
}
35
}
7
 
36
 
8
Extend(irReceive, Module);
37
Extend(irReceive, Module);
9
 
38
 
10
irReceive.instance_ = null;
39
irReceive.instance_ = null;
11
 
40
 
12
irReceive.prototype.ReceiveMessage = function(id, command, variables)
41
irReceive.prototype.ReceiveMessage = function(id, command, variables)
13
{
42
{
14
    switch (command)
43
    switch (command)
15
    {
44
    {
16
        case "IR":
45
        case "IR":
17
        {
46
        {
18
            var channel = variables["Channel"];
47
            var channel = variables["Channel"];
19
            var data = variables["IRdata"];
48
            var data = variables["IRdata"];
20
            var protocol = variables["Protocol"];
49
            var protocol = variables["Protocol"];
21
            var status = variables["Status"];
50
            var status = variables["Status"];
22
           
51
           
23
            if (status == "Pressed")
52
            if (status == "Pressed")
24
            {
53
            {
25
                this.EventBase.prototype.Trigger.call(this, "onPressed", id, channel, data, protocol);
54
                this.EventBase.prototype.Trigger.call(this, "onPressed", id, channel, data, protocol);
26
            }
55
            }
27
            else if (status == "Released")
56
            else if (status == "Released")
28
            {
57
            {
29
                this.EventBase.prototype.Trigger.call(this, "onReleased", id, channel, data, protocol);
58
                this.EventBase.prototype.Trigger.call(this, "onReleased", id, channel, data, protocol);
30
            }
59
            }
31
            else
60
            else
32
            {
61
            {
33
                Log("Unknown status of IR signal, " + status);
62
                Log("Unknown status of IR signal, " + status);
34
            }
63
            }
35
           
64
           
36
            break;
65
            break;
37
        }
66
        }
38
    }
67
    }
39
   
68
   
40
    this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
69
    this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
41
}
70
}
42
 
71
 
43
 
72