Rev 1844 | Rev 1852 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1844 | Rev 1847 | ||
|---|---|---|---|
| Line 76... | Line 76... | ||
| 76 | canMessage2.setData("Channel", channel); |
76 | canMessage2.setData("Channel", channel); |
| 77 | canMessage2.setData("Direction", direction); |
77 | canMessage2.setData("Direction", direction); |
| 78 | canMessage2.setData("Transmit power", power); |
78 | canMessage2.setData("Transmit power", power); |
| 79 | canMessage2.setData("Modulation divider", modfreq); |
79 | canMessage2.setData("Modulation divider", modfreq); |
| 80 | sendMessage(canMessage2); |
80 | sendMessage(canMessage2); |
| 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", 7); |
- | |
| 91 | msg.setData("RepSeqLen", 0); |
- | |
| 92 | sendMessage(msg); |
- | |
| 93 | sleep(10); |
- | |
| 94 | - | ||
| 95 | // pronto data |
- | |
| 96 | msg = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrProntoData1"); |
- | |
| 97 | msg.setData("Act1", 150); // 3.9 |
- | |
| 98 | msg.setData("Pas1", 45); // 1.2 |
- | |
| 99 | msg.setData("Act2", 40); // 1.2 |
- | |
| 100 | msg.setData("Pas2", 65); // 1.7 |
- | |
| 101 | msg.setData("Act3", 37); // 0.98 |
- | |
| 102 | msg.setData("Pas3", 26); // 0.7 |
- | |
| 103 | msg.setData("Act4", 40); // 1.05 |
- | |
| 104 | msg.setData("Pas4", 62); // 1.6 |
- | |
| 105 | sendMessage(msg); |
- | |
| 106 | sleep(10); |
- | |
| 107 | - | ||
| 108 | // pronto data/end |
- | |
| 109 | msg = new CanMessage("sns", "To_Owner", this.myName, this.myId, "IrProntoEnd2"); |
- | |
| 110 | msg.setData("Act1", 93); // 2.4 |
- | |
| 111 | msg.setData("Pas1", 40); // 1.1 |
- | |
| 112 | msg.setData("Act2", 40); // 1.1 |
- | |
| 113 | msg.setData("Pas2", 80); // 2.1 |
- | |
| 114 | msg.setData("Act3", 80); // 2.1 |
- | |
| 115 | msg.setData("Pas3", 83); |
- | |
| 116 | msg.setData("Repeat", 0); |
- | |
| 117 | sendMessage(msg); |
- | |
| 118 | sleep(10); |
- | |
| 119 | } |
81 | } |
| 120 | 82 | ||
| 121 | function hexString2NumberArray(hexString) |
83 | function hexString2NumberArray(hexString) |
| 122 | { |
84 | { |
| 123 | var tokens = hexString.split(' '); |
85 | var tokens = hexString.split(' '); |
| Line 127... | Line 89... | ||
| 127 | } |
89 | } |
| 128 | return numbers; |
90 | return numbers; |
| 129 | } |
91 | } |
| 130 | 92 | ||
| 131 | // prontoHexString is a space-separated hex string, including both the pronto header and the data |
93 | // prontoHexString is a space-separated hex string, including both the pronto header and the data |
| 132 | irTransceive.prototype.sendProntoHex = function(channel, prontoHexString) |
94 | irTransceive.prototype.sendProntoHex = function(channel, repeatCount, prontoHexString) |
| 133 | { |
95 | { |
| 134 | var prontoNumbers = hexString2NumberArray(prontoHexString); |
96 | var prontoNumbers = hexString2NumberArray(prontoHexString); |
| 135 | 97 | ||
| 136 | // header |
98 | // header |
| 137 | var format = prontoNumbers[0]; |
99 | var format = prontoNumbers[0]; |
| Line 195... | Line 157... | ||
| 195 | if (nrBytes > 2) msg.setData("Pas1", bytes[1]); |
157 | if (nrBytes > 2) msg.setData("Pas1", bytes[1]); |
| 196 | if (nrBytes > 3) msg.setData("Act2", bytes[2]); |
158 | if (nrBytes > 3) msg.setData("Act2", bytes[2]); |
| 197 | if (nrBytes > 4) msg.setData("Pas2", bytes[3]); |
159 | if (nrBytes > 4) msg.setData("Pas2", bytes[3]); |
| 198 | if (nrBytes > 5) msg.setData("Act3", bytes[4]); |
160 | if (nrBytes > 5) msg.setData("Act3", bytes[4]); |
| 199 | if (nrBytes > 6) msg.setData("Pas3", bytes[5]); |
161 | if (nrBytes > 6) msg.setData("Pas3", bytes[5]); |
| 200 | msg.setData("Repeat", |
162 | msg.setData("Repeat", repeatCount); |
| 201 | sendMessage(msg); |
163 | sendMessage(msg); |
| 202 | sleep(10); |
164 | sleep(10); |
| 203 | } |
165 | } |
| 204 | 166 | ||
| 205 | function sendProntoTest() |
167 | function sendProntoTest() |
| 206 | { |
168 | { |
| 207 | var ir = ServiceManager.getService("Can","irTransceive",1); |
169 | var ir = ServiceManager.getService("Can","irTransceive",1); |
| 208 | ir.sendProntoHex(1, "0000 006d 0022 0002 0156 00ad 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 05ed 0156 0056 0016 0e62"); |
170 | ir.sendProntoHex(1, 255, "0000 006d 0022 0002 0156 00ad 0016 0016 0016 0041 0016 0041 0016 0041 0016 0016 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0041 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0016 0041 0016 0041 0016 0016 0016 0016 0016 0041 0016 05ed 0156 0056 0016 0e62"); |
| - | 171 | //ir.sendProntoHex(1, "0000 006d 0022 0000 0156 00A9 0015 0014 0015 003D 0016 003D 0015 003F 0015 0015 0015 003E 0015 003D 0016 003D 0016 003E 0015 003E 0016 003E 0015 0014 0016 0014 0017 0013 0017 0013 0017 003C 0016 0014 0017 003C 0017 0013 0016 003D 0017 0013 0016 0014 0017 0013 0017 0013 0016 0014 0017 003C 0017 0013 0017 0013 0016 003D 0018 003B 0017 003C 0017 003D 0017 01CD"); |
|
| 209 | } |
172 | } |