Subversion Repositories HomeAutomation

Rev

Rev 1489 | Rev 1817 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1489 Rev 1492
Line 18... Line 18...
18
    }*/
18
    }*/
19
   
19
   
20
    this.CanService.prototype.canMessageHandler.call(this, canMessage);
20
    this.CanService.prototype.canMessageHandler.call(this, canMessage);
21
}
21
}
22
 
22
 
23
irTransceive.prototype.sendClick = function(remoteName, buttonName, time)
23
irTransceive.prototype.sendClick = function(channel, remoteName, buttonName, time)
24
{
24
{
25
    this.sendButton(remoteName, buttonName, true);
25
    this.sendButton(channel, remoteName, buttonName, true);
26
   
26
   
27
    if (time)
27
    if (time)
28
    {
28
    {
29
        sleep(time);
29
        sleep(time);
30
    }
30
    }
31
    else
31
    else
32
    {
32
    {
33
        sleep(50000);
33
        sleep(50000);
34
    }
34
    }
35
   
35
   
36
    this.sendButton(remoteName, buttonName, false);
36
    this.sendButton(channel, remoteName, buttonName, false);
37
}
37
}
38
 
38
 
39
irTransceive.prototype.sendButton = function(remoteName, buttonName, down)
39
irTransceive.prototype.sendButton = function(channel, remoteName, buttonName, down)
40
{
40
{
41
    var remotesStore = DataStore.getStore("IRRemotes");
41
    var remotesStore = DataStore.getStore("IRRemotes");
42
   
42
   
43
    if (remotesStore)
43
    if (remotesStore)
44
    {
44
    {
Line 48... Line 48...
48
            {
48
            {
49
                for (var code in remotesStore['remotes'][n]['codes'])
49
                for (var code in remotesStore['remotes'][n]['codes'])
50
                {
50
                {
51
                    if (remotesStore['remotes'][n]['codes'][code] == buttonName)
51
                    if (remotesStore['remotes'][n]['codes'][code] == buttonName)
52
                    {
52
                    {
53
                        this.sendData(remotesStore['remotes'][n]['protocol'], code, down ? "Pressed" : "Released");
53
                        this.sendData(channel, remotesStore['remotes'][n]['protocol'], code, down ? "Pressed" : "Released");
54
                        return;
54
                        return;
55
                    }
55
                    }
56
                }
56
                }
57
            }
57
            }
58
        }
58
        }
59
    }
59
    }
60
}
60
}
61
 
61
 
62
irTransceive.prototype.sendData = function(protocol, data, status)
62
irTransceive.prototype.sendData = function(channel, protocol, data, status)
63
{
63
{
64
    var canMessage = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IR");
64
    var canMessage = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IR");
-
 
65
    canMessage.setData("Channel", channel);
65
    canMessage.setData("Status", status);
66
    canMessage.setData("Status", status);
66
    canMessage.setData("Protocol", protocol);
67
    canMessage.setData("Protocol", protocol);
67
    canMessage.setData("IRdata", data);
68
    canMessage.setData("IRdata", data);
68
    sendMessage(canMessage);
69
    sendMessage(canMessage);
69
}
70
}