forked from r10r/he853-remote
-
Notifications
You must be signed in to change notification settings - Fork 3
/
he853.cpp
583 lines (497 loc) · 15.1 KB
/
he853.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
#include "he853.h"
#define BYTE_TO_BINARY_PATTERN "%c%c%c%c%c%c%c%c"
#define BYTE_TO_BINARY(byte) \
(byte & 0x80 ? '1' : '0'), \
(byte & 0x40 ? '1' : '0'), \
(byte & 0x20 ? '1' : '0'), \
(byte & 0x10 ? '1' : '0'), \
(byte & 0x08 ? '1' : '0'), \
(byte & 0x04 ? '1' : '0'), \
(byte & 0x02 ? '1' : '0'), \
(byte & 0x01 ? '1' : '0')
HE853Controller::HE853Controller()
{
const char name[] = "HE853 USB device (04d9:01357 Holtek Semiconductor, Inc.)";
const unsigned short idVendor = 0x4d9; // 1241
const unsigned short idProduct = 0x1357; // 4951
anban_cnt = 0;
m_initialized = false;
#if RUN_DRY == 0
struct hid_device_info *devs;
devs = hid_enumerate(idVendor, idProduct);
if (!devs) {
printf("%s not found\n", name);
hid_free_enumeration(devs);
}
else
{
hid_free_enumeration(devs);
handle = hid_open(idVendor, idProduct, NULL);
if (!handle) {
printf("%s not fully accessible\n", name);
}
else
{
m_initialized = true;
}
}
#else
m_initialized = true;
#endif
}
HE853Controller::~HE853Controller()
{
}
bool HE853Controller::sendOutputReports(uint8_t* buf, uint16_t nReports)
{
int rv = 0;
#if DEBUG == 1
DEBUG_PRINTF(("\nsendToStick:\n"));
DEBUG_PRINTF((" buffer: "));
for(uint16_t h=0; h < sizeof(buf); h++ ) {
DEBUG_PRINTF((" %02X", buf[h]));
DEBUG_PRINTF((" "BYTE_TO_BINARY_PATTERN, BYTE_TO_BINARY(buf[h])));
}
DEBUG_PRINTF(("\n"));
#endif
DEBUG_PRINTF((" Sending "));
for (uint16_t i=0; i < nReports; i++) {
//DEBUG_PRINTF((" Report %d report %02X first byte %02X\n", i, buf[i*9], buf[i*9+1]));
DEBUG_PRINTF(("%d ", i));
#if RUN_DRY == 0
rv = hid_write(handle, buf + (i * 9), 9);
#endif
}
#if RUN_DRY == 0
DEBUG_PRINTF(("\n"));
#else
rv = true;
DEBUG_PRINTF(("\n Dry run - nothing send\n"));
#endif
return (bool) rv;
}
bool HE853Controller::readDeviceStatus()
{
uint8_t buf[9];
if (!m_initialized) return false;
memset(buf, 0x00, sizeof(buf));
buf[0] = 0x00; // report id = 0, as it seems to be the only report
buf[1] = 0x06;
buf[2] = 0x01;
#if RUN_DRY == 0
return sendOutputReports(buf, 1);
#else
return true;
#endif
}
char HE853Controller::readDeviceName()
{
return name;
}
#define MicroToTicksHe853(t,x) ((((t)->BaseTime) * ((t)->x)) / 10)
#define MicroToTicksMSB(t, x) (uint8_t) ((MicroToTicksHe853(t,x) >> 8) & 0xFF)
#define MicroToTicksLSB(t, x) (uint8_t) (MicroToTicksHe853(t,x) & 0xFF)
#define MicroToTicks(t, x) MicroToTicksLSB(t, x)
bool HE853Controller::sendRfData(He853Timings *t, uint8_t* data, uint8_t nDataBytes) {
uint8_t rfCmdBuf[32 + 4 + 9]; // rename to output report cmdbuf + execute
uint8_t i = 0;
memset(rfCmdBuf, 0x00, sizeof(rfCmdBuf));
rfCmdBuf[0*8+0+0] = 0x0; // report id = 0, as it seems to be the only report
rfCmdBuf[0*8+1+0] = 0x01; // index
// StartBit_HTime
rfCmdBuf[0*8+1+1] = MicroToTicksMSB(t,StartBitHighTime);
rfCmdBuf[0*8+1+2] = MicroToTicksLSB(t,StartBitHighTime);
// StartBit_LTime
rfCmdBuf[0*8+1+3] = MicroToTicksMSB(t,StartBitLowTime);
rfCmdBuf[0*8+1+4] = MicroToTicksLSB(t,StartBitLowTime);
// EndBit_HTime
rfCmdBuf[0*8+1+5] = MicroToTicksMSB(t,EndBitHighTime);
rfCmdBuf[0*8+1+6] = MicroToTicksLSB(t,EndBitHighTime);
// EndBit_LTime
rfCmdBuf[0*8+1+7] = MicroToTicksMSB(t,EndBitLowTime);
rfCmdBuf[1*9+0 + 0] = 0x0; // report id = 0, as it seems to be the only report
rfCmdBuf[1*9+1 + 0] = 0x2; // index
// EndBit_LTime
rfCmdBuf[1*9+1+1] = MicroToTicksLSB(t,EndBitLowTime);
// DataBit0_HTime
rfCmdBuf[1*9+1+2] = MicroToTicks(t,DataBit0HighTime);
// DataBit0_LTime
rfCmdBuf[1*9+1+3] = MicroToTicks(t,DataBit0LowTime);
// DataBit1_HTime
rfCmdBuf[1*9+1+4] = MicroToTicks(t,DataBit1HighTime);
// DataBit1_LTime
rfCmdBuf[1*9+1+5] = MicroToTicks(t,DataBit1LowTime);
// DataBit_Count
rfCmdBuf[1*9+1+6] = t->DataBitCount;
// Frame_Count
rfCmdBuf[1*9+1+7] = t->FrameCount;
rfCmdBuf[2*9+0+0] = 0x0; // report id = 0, as it seems to be the only report
rfCmdBuf[2*9+1+0] = 0x03;
DEBUG_PRINTF(("\nProtocol %s, %d Bytes, %d Bits:\n ", t->ProtocolName, nDataBytes, t->DataBitCount));
for (; i< nDataBytes && i < 7; i++) {
DEBUG_PRINTF(("%02X ", data[i]));
DEBUG_PRINTF((BYTE_TO_BINARY_PATTERN" ", BYTE_TO_BINARY(data[i])));
rfCmdBuf[2*9+1+1 + i] = data[i];
}
rfCmdBuf[3*9+0+0] = 0x0; // report id = 0, as it seems to be the only report
rfCmdBuf[3*9+1+0] = 0x04;
DEBUG_PRINTF(("\n "));
for (;i< nDataBytes && i < 7+7; i++) {
DEBUG_PRINTF(("%02X ", data[i]));
DEBUG_PRINTF((BYTE_TO_BINARY_PATTERN" ", BYTE_TO_BINARY(data[i])));
rfCmdBuf[3*9+1+1 + i-7] = data[i];
}
rfCmdBuf[4*9+0+0] = 0x0; // report id = 0, as it seems to be the only report
rfCmdBuf[4*9+1+0] = 0x05; // Exec 'command'
DEBUG_PRINTF(("\n"));
return sendOutputReports(rfCmdBuf, 5);
}
const char cAnBan[] = "AnBan";
static struct He853Timings AnBanTimings = {
(char *)&cAnBan,
1, // no T
320, 4800,
0, 0,
320, 960,
960, 320,
28,
7
} ;
const char cUK[] = "UK";
static struct He853Timings UKTimings = {
(char *)&cUK,
1, // no T
320, 9700,
0,0,
320, 960,
960, 320,
24,
18
};
const char cEU[] = "EU";
static struct He853Timings EUTimings = {
(char *)&cEU,
1, // no T
260, 8600,
0, 0,
260, 260,
260, 1300,
57,
7
};
/*********************************************************************************************\
Some information about the old KlikAanKlikUit / Intertechno PAR ... protocol
More comments in the send method
* https://github.com/rinie/NodoDueRkr/blob/master/KAKU.ino
* Deze routine berekent de RAW pulsen uit een CMD_KAKU plaatst deze in de buffer RawSignal
*
* KAKU
* Encoding volgens Princeton PT2262 / MOSDESIGN M3EB / Domia Lite spec.
* Pulse (T) is 350us PWDM
* 0 = T,3T,T,3T, 1 = T,3T,3T,T, short 0 = T,3T,T,T
*
* KAKU ondersteund:
* on/off ---- 000x Off/On
* all on/off ---- 001x AllOff/AllOn // is group (unit code bestaat uit short 0s)
NOTE: Not sure about the group on/off, couldn't verify with Intertechno PAR-1500
http://www.mikrocontroller.net/topic/124084#1131698
; Intertechno Protocol - 12 databits + 1 syncbit
;
; 0-Bit = 1T High + 3T Low + 1T High + 3T Low
; 1-Bit = 1T High + 3T Low + 3T High + 1T Low
; Sync-Bit = 1T High + 31T Low
;
; 1T ~ 360 Microsecs
;
; 4-Bit familycode (LSB...MSB), 4-Bit devicecode (LSB...MSB), 4-Bit command (LSB...MSB)
;
; 0 = 1H
; 1 = 3L
; 2 = 1H/3H
; 3 = 3L/1L X 12
; ...
; 48 = 1H
; 49 = 31L
https://isn-systems.com/tools/it2elro/
familycode: a = 0 ... p = F
devicecode: (device+group*4)
device: (x1) 1 = 0 .. 4 = 3
group: (x4) 1 = 0 .. 4 = 3
https://wiki.pilight.org/doku.php/arctech_switch_old#unit_and_device_id_s
\*********************************************************************************************/
const char cKAKU[] = "KAKU";
static struct He853Timings KakuTimings = {
(char *)&cKAKU,
350, // Base Time us
0, 0,
1,32,
1, 3,
3, 1,
24,
7
};
bool HE853Controller::sendKaku(uint16_t deviceCode, bool cmd)
{
uint8_t data[3];
/*
data[0] 4 bit channel, encoded, reversed
data[1] 2 bit device + 2 bit group, encoded, reversed
data[2] 1 bit const 0, 1 bit const 1, 1 bit const 1, 1 bit on/off
Encoding: '0' => '01', '1' => '10'
Example: For the logical datastream 0111, is sent over the air as 01101010
3 -> 0010 -> 01011001 -> reverse -> 10011010
2 -> 0001 -> 01010110 -> reverse -> 01101010
On 1110 -> 10101001 -> reverse -> 10010101
Off 0110 -> 01101001 -> reverse -> 10010110
NOTE: The expected encoding does not apply. '0' => '00', '1' => '10' seems used - see signalMap
*/
// C3 00100010 ON
// data[0] = 0b00010000;
// data[1] = 0b00010000;
// B2 00010001 ON
// data[0] = 0b01000000;
// data[1] = 0b01000000;
// D1 00100010 ON
// data[0] = 0b01010000;
// data[1] = 0b00000000;
// Map ID to signal
static unsigned char signalMap[16] = {
0b00000000, 0b01000000, 0b00010000, 0b01010000,
0b00000100, 0b01000100, 0b00010100, 0b01010100,
0b00000001, 0b01000001, 0b00010001, 0b01010001,
0b00000101, 0b01000101, 0b00010101, 0b01010101
};
#define lookupSignal(n) (uint8_t) (signalMap[n])
data[0] = (uint8_t) (lookupSignal(((uint8_t) deviceCode & 0b11110000) >> 4));
data[1] = (uint8_t) (lookupSignal( (uint8_t) deviceCode & 0b00001111));
data[2] = 0b00010100;
if (cmd == true)
data[2] |= 0x01;
DEBUG_PRINTF((" data: %02x %02x %02x\n", data[0], data[1], data[2]));
sendRfData(&KakuTimings, data, sizeof(data));
return true;
}
/*********************************************************************************************\
* NewKAKU
* Encoding volgens Arduino Home Easy pagina
* Pulse (T) is 275us PDM
* 0 = T,T,T,4T, 1 = T,4T,T,T, dim = T,T,T,T op bit 27
*
* NewKAKU ondersteund:
* on/off ---- 000x Off/On
* all on/off ---- 001x AllOff/AllOn
* dim absolute xxxx 0110 Dim16 // dim op bit 27 + 4 extra bits voor dim level
*
* NewKAKU (org.) = AAAAAAAAAAAAAAAAAAAAAAAAAACCUUUU(LLLL) -> A=KAKU_adres, C=commando, U=KAKU-Unit, L=extra dimlevel bits (optioneel)
* Bit = 01234567890123456789012345678901 2345 -> Bit-0 gaat als eerste door de ether.
* 1111111111222222222233 3333
*
\*********************************************************************************************/
const char cKAKUNEW[] = "KAKUNEW";
static struct He853Timings KakuNewTimings = {
(char *)&cKAKUNEW,
275, // Base time in us
1, 8,
1,32,
1, 1, // 0 = 01, Dim = 00
1, 4, // 1 = 10
64,
18
};
bool HE853Controller::sendKakuNew(uint16_t deviceCode, bool cmd)
{
uint8_t data[8];
// C3 ON
data[0] = 0x55; // 0b01010101;
data[1] = 0xA9; // 0b10101001;
data[2] = 0x96; // 0b10010110;
data[3] = 0xA9; // 0b10101001;
data[4] = 0x95; // 0b10010110;
data[5] = 0x5A; // 0b01011010;
data[6] = 0x96; // 0b10010110;
data[7] = 0x55; // 0b01011001;
sendRfData(&KakuNewTimings, data, sizeof(data));
return true;
}
bool HE853Controller::sendRfData_AnBan(uint16_t deviceCode, uint8_t cmd)
{
uint8_t data[4];
unsigned int tb_fx[16] = { 0x609, 0x306, 0x803, 0xa08,
0x00a, 0x200, 0xc02, 0x40c,
0xe04, 0x70e, 0x507, 0x105,
0xf01, 0xb0f, 0xd0b, 0x90d };
uint8_t gbuf[6];
uint8_t kbuf[6];
uint8_t cbuf[6];
uint8_t idx;
uint32_t temp;
anban_cnt++;
gbuf[0] = 1;
gbuf[1] = (anban_cnt << 2) & 15;
if (cmd > 0) { // if not off
gbuf[1] |= 2;
}
gbuf[2] = deviceCode & 15;
gbuf[3] = (deviceCode >> 4) & 15;
gbuf[4] = (deviceCode >> 8) & 15;
gbuf[5] = (deviceCode >> 12) & 15;
if (cmd >= 9 || cmd == 0) {
gbuf[6] = 0;
} else {
gbuf[6] = cmd - 1;
gbuf[6] |= 8;
}
idx = gbuf[0];
kbuf[0] = (uint8_t) (tb_fx[idx] >> 8);
idx = gbuf[1] ^ kbuf[0];
kbuf[1] = (uint8_t) (tb_fx[idx] >> 8);
idx = gbuf[2] ^ kbuf[1];
kbuf[2] = (uint8_t) (tb_fx[idx] >> 8);
idx = gbuf[3] ^ kbuf[2];
kbuf[3] = (uint8_t) (tb_fx[idx] >> 8);
idx = gbuf[4] ^ kbuf[3];
kbuf[4] = (uint8_t) (tb_fx[idx] >> 8);
idx = gbuf[5] ^ kbuf[4];
kbuf[5] = (uint8_t) (tb_fx[idx] >> 8);
kbuf[6] = (uint8_t) gbuf[6];
idx = kbuf[0];
cbuf[0] = (uint8_t) tb_fx[idx];
idx = kbuf[1] ^ cbuf[0];
cbuf[1] = (uint8_t) tb_fx[idx];
idx = kbuf[2] ^ cbuf[1];
cbuf[2] = (uint8_t) tb_fx[idx];
idx = kbuf[3] ^ cbuf[2];
cbuf[3] = (uint8_t) tb_fx[idx];
idx = kbuf[4] ^ cbuf[3];
cbuf[4] = (uint8_t) tb_fx[idx];
idx = kbuf[5] ^ cbuf[4];
cbuf[5] = (uint8_t) tb_fx[idx];
cbuf[6] = (uint8_t) (kbuf[6] ^ 9);
temp = (cbuf[6] << 0x18) | (cbuf[5] << 0x14) |
(cbuf[4] << 0x10) | (cbuf[3] << 0x0c) |
(cbuf[2] << 0x08) | (cbuf[1] << 0x04) | cbuf[0];
temp = (temp >> 2) | ((temp & 3) << 0x1a);
data[0] = (uint8_t) (temp >> 20);
data[1] = (uint8_t) (temp >> 12);
data[2] = (uint8_t) (temp >> 4);
data[3] = (uint8_t) (temp << 4);
DEBUG_PRINTF(("\nBuffer debug for %s:\n", AnBanTimings.ProtocolName));
DEBUG_PRINTF((" cbuf: %02x %02x %02x %02x %02x %02x %02x\n", cbuf[0], cbuf[1], cbuf[2], cbuf[3], cbuf[4], cbuf[5], cbuf[6]));
DEBUG_PRINTF((" gbuf: %02x %02x %02x %02x %02x %02x %02x\n", gbuf[0], gbuf[1], gbuf[2], gbuf[3], gbuf[4], gbuf[5], gbuf[6]));
DEBUG_PRINTF((" kbuf: %02x %02x %02x %02x %02x %02x %02x\n", kbuf[0], kbuf[1], kbuf[2], kbuf[3], kbuf[4], kbuf[5], kbuf[6]));
return sendRfData(&AnBanTimings, data, sizeof(data));
}
bool HE853Controller::sendRfData_EU(uint16_t deviceCode, bool cmd)
{
uint8_t data[8];
int i = 0;
uint8_t tb_fx[16] = {
0x07, 0x0b, 0x0d, 0x0e,
0x13, 0x15, 0x16, 0x19,
0x1a, 0x1c, 0x03, 0x05,
0x06, 0x09, 0x0a, 0x0c
};
uint8_t buf[4] = { 0x00,
(uint8_t) ((deviceCode >> 8) & 0xff),
(uint8_t) (deviceCode & 0xff),
0x00
};
if (cmd == true)
buf[3] |= 0x10;
uint8_t gbuf[8] = { (uint8_t) (buf[0] >> 4),
(uint8_t) (buf[0] & 15),
(uint8_t) (buf[1] >> 4),
(uint8_t) (buf[1] & 15),
(uint8_t) (buf[2] >> 4),
(uint8_t) (buf[2] & 15),
(uint8_t) (buf[3] >> 4),
(uint8_t) (buf[3] & 15) };
uint8_t kbuf[8];
for (i = 0; i < 8; i++) {
kbuf[i] = (uint8_t) ((tb_fx[gbuf[i]] | 0x40) & 0x7f);
}
kbuf[0] |= 0x80;
uint64_t t64 = 0;
t64 = kbuf[0];
for (i = 1; i < 8; i++)
{
t64 = (t64 << 7) | kbuf[i];
}
t64 = t64 << 7;
data[0] = (uint8_t) (t64 >> 56);
data[1] = (uint8_t) (t64 >> 48);
data[2] = (uint8_t) (t64 >> 40);
data[3] = (uint8_t) (t64 >> 32);
data[4] = (uint8_t) (t64 >> 24);
data[5] = (uint8_t) (t64 >> 16);
data[6] = (uint8_t) (t64 >> 8);
data[7] = (uint8_t) t64;
DEBUG_PRINTF(("\nBuffer debug for %s:\n", EUTimings.ProtocolName));
DEBUG_PRINTF((" buf: %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3]));
DEBUG_PRINTF((" gbuf: %02x %02x %02x %02x %02x %02x %02x %02x\n", gbuf[0], gbuf[1], gbuf[2], gbuf[3], gbuf[4], gbuf[5], gbuf[6], gbuf[7]));
DEBUG_PRINTF((" kbuf: %02x %02x %02x %02x %02x %02x %02x %02x\n", kbuf[0], kbuf[1], kbuf[2], kbuf[3], kbuf[4], kbuf[5], kbuf[6], kbuf[7]));
return sendRfData(&EUTimings, data, sizeof(data));
}
bool HE853Controller::sendRfData_UK(uint16_t deviceCode, bool cmd)
{
uint8_t data[3];
int8_t i = 0;
uint16_t buf[8];
for (i = 0; i < 8; i++) {
buf[i] = deviceCode % 3;
deviceCode /= 3;
switch (buf[i]) {
case 0:
buf[i] = 0;
break;
case 1:
buf[i] = 3;
break;
case 2:
buf[i] = 1;
break;
}
}
uint16_t addr = 0;
for (i = 7; i >= 0; i--) {
addr = (uint16_t) ((addr << 2) | buf[i]);
}
uint8_t sbuf = 0x14;
if (cmd == true)
sbuf |= 0x01;
data[0] = (uint8_t) (addr >> 8);
data[1] = (uint8_t) addr;
data[2] = sbuf;
DEBUG_PRINTF(("\nBuffer debug for %s:\n", UKTimings.ProtocolName));
DEBUG_PRINTF((" buf: %02x %02x %02x %02x %02x %02x %02x %02x\n", buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]));
return sendRfData(&UKTimings, data, sizeof(data));
}
bool HE853Controller::getDeviceStatus(void)
{
return readDeviceStatus();
}
char HE853Controller::getDeviceName(void)
{
return readDeviceName();
}
bool HE853Controller::sendAnBan(uint16_t deviceId, uint8_t command)
{
return sendRfData_AnBan(deviceId, command);
}
bool HE853Controller::sendUK(uint16_t deviceId, bool command)
{
return sendRfData_UK(deviceId, command);
}
bool HE853Controller::sendEU(uint16_t deviceId, bool command)
{
return sendRfData_EU(deviceId, command);
}
// This is for the lazy - better just for test purposes
bool HE853Controller::sendAll(uint16_t deviceId, uint8_t command)
{
return sendAnBan(deviceId, command) &&
sendEU(deviceId, (bool)command) &&
sendKaku(deviceId, (bool)command) &&
//sendKakuNew(deviceId, (bool)command) &&
sendUK(deviceId, (bool)command);
}