Subversion Repositories HomeAutomation

Rev

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

Rev Author Line No. Line
1603 runge 1
 
1646 runge 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
 
30
 
1603 runge 31
function irReceive(name)
32
{
33
    this.Module(name);
1620 runge 34
    irReceive.instance_ = this;
1603 runge 35
}
36
 
37
Extend(irReceive, Module);
38
 
1620 runge 39
irReceive.instance_ = null;
40
 
1603 runge 41
irReceive.prototype.ReceiveMessage = function(id, command, variables)
42
{
43
    switch (command)
44
    {
45
        case "IR":
46
        {
47
            var channel = variables["Channel"];
48
            var data = variables["IRdata"];
49
            var protocol = variables["Protocol"];
50
            var status = variables["Status"];
51
 
52
            if (status == "Pressed")
53
            {
54
                this.EventBase.prototype.Trigger.call(this, "onPressed", id, channel, data, protocol);
55
            }
56
            else if (status == "Released")
57
            {
58
                this.EventBase.prototype.Trigger.call(this, "onReleased", id, channel, data, protocol);
59
            }
1619 runge 60
            else
61
            {
62
                Log("Unknown status of IR signal, " + status);
63
            }
1603 runge 64
 
65
            break;
66
        }
67
    }
68
 
69
    this.Module.prototype.ReceiveMessage.call(this, id, command, variables);
70
}
71