Rev 1817 | Rev 1832 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1817 | Rev 1830 | ||
|---|---|---|---|
| Line -... | Line 1... | ||
| - | 1 | ||
| 1 | 2 | ||
| 2 | function irTransceive(type, name, id) |
3 | function irTransceive(type, name, id) |
| 3 | { |
4 | { |
| 4 | this.CanService(type, name, id); |
5 | this.CanService(type, name, id); |
| 5 | } |
6 | } |
| Line 16... | Line 17... | ||
| 16 | break; |
17 | break; |
| 17 | } |
18 | } |
| 18 | }*/ |
19 | }*/ |
| 19 | 20 | ||
| 20 | this.CanService.prototype.canMessageHandler.call(this, canMessage); |
21 | this.CanService.prototype.canMessageHandler.call(this, canMessage); |
| 21 | } |
22 | } |
| 22 | 23 | ||
| 23 | irTransceive.prototype.sendClick = function(channel, remoteName, buttonName, time) |
24 | irTransceive.prototype.sendClick = function(channel, remoteName, buttonName, time) |
| 24 | { |
25 | { |
| 25 | this.sendButton(channel, remoteName, buttonName, true); |
26 | this.sendButton(channel, remoteName, buttonName, true); |
| 26 | 27 | ||
| Line 50... | Line 51... | ||
| 50 | { |
51 | { |
| 51 | if (remotesStore['remotes'][n]['codes'][code] == buttonName) |
52 | if (remotesStore['remotes'][n]['codes'][code] == buttonName) |
| 52 | { |
53 | { |
| 53 | this.sendData(channel, remotesStore['remotes'][n]['protocol'], code, down ? "Pressed" : "Released"); |
54 | this.sendData(channel, remotesStore['remotes'][n]['protocol'], code, down ? "Pressed" : "Released"); |
| 54 | return; |
55 | return; |
| 55 | } |
56 | } |
| 56 | } |
57 | } |
| 57 | } |
58 | } |
| 58 | } |
59 | } |
| 59 | } |
60 | } |
| 60 | } |
61 | } |
| 61 | 62 | ||
| 62 | irTransceive.prototype.sendData = function(channel, protocol, data, status) |
63 | irTransceive.prototype.sendData = function(channel, protocol, data, status) |
| 63 | { |
64 | { |
| 64 | var canMessage = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IR"); |
65 | var canMessage = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IR"); |
| 65 | canMessage.setData("Channel", channel); |
66 | canMessage.setData("Channel", channel); |
| 66 | canMessage.setData("Status", status); |
67 | canMessage.setData("Status", status); |
| 67 | canMessage.setData("Protocol", protocol); |
68 | canMessage.setData("Protocol", protocol); |
| 68 | canMessage.setData("IRdata", data); |
69 | canMessage.setData("IRdata", data); |
| 69 | sendMessage(canMessage); |
70 | sendMessage(canMessage); |
| 70 | } |
71 | } |
| 71 | 72 | ||
| 72 | irTransceive.prototype.sendConfig = function(channel, direction, power, modfreq) |
73 | irTransceive.prototype.sendConfig = function(channel, direction, power, modfreq) |
| 73 | { |
74 | { |
| 74 | var canMessage2 = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrConfig"); |
75 | var canMessage2 = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrConfig"); |
| 75 | canMessage2.setData("Channel", channel); |
76 | canMessage2.setData("Channel", channel); |
| 76 | canMessage2.setData("Direction", direction); |
77 | canMessage2.setData("Direction", direction); |
| 77 | canMessage2.setData("Transmit power", power); |
78 | canMessage2.setData("Transmit power", power); |
| 78 | canMessage2.setData("Modulation frequency", modfreq); |
79 | canMessage2.setData("Modulation frequency", modfreq); |
| 79 | sendMessage(canMessage2); |
80 | sendMessage(canMessage2); |
| 80 | } |
81 | } |
| - | 82 | ||
| - | 83 | irTransceive.prototype.sendProntoTest = function(channel) |
|
| - | 84 | { |
|
| - | 85 | // pronto start |
|
| - | 86 | var msg = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrProntoStart"); |
|
| - | 87 | msg.setData("Channel", channel); |
|
| - | 88 | msg.setData("Format", 0); |
|
| - | 89 | msg.setData("wFrqDiv", 109); // 4.145146MHz / 38kHz |
|
| - | 90 | msg.setData("OnceSeqLen", 8); |
|
| - | 91 | msg.setData("RepSeqLen", 0); |
|
| - | 92 | sendMessage(msg); |
|
| - | 93 | sleep(1); |
|
| - | 94 | ||
| - | 95 | // pronto data |
|
| - | 96 | msg = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrProntoData1"); |
|
| - | 97 | msg.setData("Act1", 20); |
|
| - | 98 | msg.setData("Pas1", 100); |
|
| - | 99 | msg.setData("Act2", 12); |
|
| - | 100 | msg.setData("Pas2", 25); |
|
| - | 101 | msg.setData("Act3", 1); |
|
| - | 102 | msg.setData("Pas3", 200); |
|
| - | 103 | msg.setData("Act4", 65); |
|
| - | 104 | msg.setData("Pas4", 13); |
|
| - | 105 | sendMessage(msg); |
|
| - | 106 | sleep(1); |
|
| 81 | 107 | ||
| - | 108 | // pronto data/end |
|
| - | 109 | msg = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrProntoEnd2"); |
|
| - | 110 | msg.setData("Act1", 220); |
|
| - | 111 | msg.setData("Pas1", 20); |
|
| - | 112 | msg.setData("Act2", 2); |
|
| - | 113 | msg.setData("Pas2", 75); |
|
| - | 114 | msg.setData("Act3", 19); |
|
| - | 115 | msg.setData("Pas3", 2); |
|
| - | 116 | msg.setData("Act4", 73); |
|
| - | 117 | msg.setData("Pas4", 37); |
|
| - | 118 | sendMessage(msg); |
|
| - | 119 | sleep(1); |
|
| - | 120 | } |
|