irtxrx 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +127 -0
- package/dist/cjs/decode.d.ts +184 -0
- package/dist/cjs/decode.d.ts.map +1 -0
- package/dist/cjs/decode.js +431 -0
- package/dist/cjs/decode.js.map +1 -0
- package/dist/cjs/encode.d.ts +76 -0
- package/dist/cjs/encode.d.ts.map +1 -0
- package/dist/cjs/encode.js +185 -0
- package/dist/cjs/encode.js.map +1 -0
- package/dist/cjs/index.d.ts +34 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +99 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/protocols/coolix.d.ts +98 -0
- package/dist/cjs/protocols/coolix.d.ts.map +1 -0
- package/dist/cjs/protocols/coolix.js +331 -0
- package/dist/cjs/protocols/coolix.js.map +1 -0
- package/dist/cjs/protocols/daikin.d.ts +47 -0
- package/dist/cjs/protocols/daikin.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin.js +353 -0
- package/dist/cjs/protocols/daikin.js.map +1 -0
- package/dist/cjs/protocols/daikin128.d.ts +60 -0
- package/dist/cjs/protocols/daikin128.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin128.js +267 -0
- package/dist/cjs/protocols/daikin128.js.map +1 -0
- package/dist/cjs/protocols/daikin152.d.ts +47 -0
- package/dist/cjs/protocols/daikin152.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin152.js +256 -0
- package/dist/cjs/protocols/daikin152.js.map +1 -0
- package/dist/cjs/protocols/daikin160.d.ts +37 -0
- package/dist/cjs/protocols/daikin160.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin160.js +176 -0
- package/dist/cjs/protocols/daikin160.js.map +1 -0
- package/dist/cjs/protocols/daikin176.d.ts +44 -0
- package/dist/cjs/protocols/daikin176.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin176.js +215 -0
- package/dist/cjs/protocols/daikin176.js.map +1 -0
- package/dist/cjs/protocols/daikin2.d.ts +46 -0
- package/dist/cjs/protocols/daikin2.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin2.js +337 -0
- package/dist/cjs/protocols/daikin2.js.map +1 -0
- package/dist/cjs/protocols/daikin216.d.ts +30 -0
- package/dist/cjs/protocols/daikin216.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin216.js +167 -0
- package/dist/cjs/protocols/daikin216.js.map +1 -0
- package/dist/cjs/protocols/daikin312.d.ts +45 -0
- package/dist/cjs/protocols/daikin312.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin312.js +345 -0
- package/dist/cjs/protocols/daikin312.js.map +1 -0
- package/dist/cjs/protocols/daikin64.d.ts +79 -0
- package/dist/cjs/protocols/daikin64.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin64.js +260 -0
- package/dist/cjs/protocols/daikin64.js.map +1 -0
- package/dist/cjs/protocols/daikin_common.d.ts +28 -0
- package/dist/cjs/protocols/daikin_common.d.ts.map +1 -0
- package/dist/cjs/protocols/daikin_common.js +41 -0
- package/dist/cjs/protocols/daikin_common.js.map +1 -0
- package/dist/cjs/protocols/nec.d.ts +50 -0
- package/dist/cjs/protocols/nec.d.ts.map +1 -0
- package/dist/cjs/protocols/nec.js +180 -0
- package/dist/cjs/protocols/nec.js.map +1 -0
- package/dist/decode.d.ts +67 -0
- package/dist/decode.d.ts.map +1 -0
- package/dist/decode.js +242 -0
- package/dist/decode.js.map +1 -0
- package/dist/encode.d.ts +76 -0
- package/dist/encode.d.ts.map +1 -0
- package/dist/encode.js +174 -0
- package/dist/encode.js.map +1 -0
- package/dist/esm/decode.d.ts +184 -0
- package/dist/esm/decode.d.ts.map +1 -0
- package/dist/esm/decode.js +420 -0
- package/dist/esm/decode.js.map +1 -0
- package/dist/esm/encode.d.ts +76 -0
- package/dist/esm/encode.d.ts.map +1 -0
- package/dist/esm/encode.js +174 -0
- package/dist/esm/encode.js.map +1 -0
- package/dist/esm/index.d.ts +34 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +20 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/protocols/coolix.d.ts +98 -0
- package/dist/esm/protocols/coolix.d.ts.map +1 -0
- package/dist/esm/protocols/coolix.js +322 -0
- package/dist/esm/protocols/coolix.js.map +1 -0
- package/dist/esm/protocols/daikin.d.ts +47 -0
- package/dist/esm/protocols/daikin.d.ts.map +1 -0
- package/dist/esm/protocols/daikin.js +344 -0
- package/dist/esm/protocols/daikin.js.map +1 -0
- package/dist/esm/protocols/daikin128.d.ts +60 -0
- package/dist/esm/protocols/daikin128.d.ts.map +1 -0
- package/dist/esm/protocols/daikin128.js +260 -0
- package/dist/esm/protocols/daikin128.js.map +1 -0
- package/dist/esm/protocols/daikin152.d.ts +47 -0
- package/dist/esm/protocols/daikin152.d.ts.map +1 -0
- package/dist/esm/protocols/daikin152.js +247 -0
- package/dist/esm/protocols/daikin152.js.map +1 -0
- package/dist/esm/protocols/daikin160.d.ts +37 -0
- package/dist/esm/protocols/daikin160.d.ts.map +1 -0
- package/dist/esm/protocols/daikin160.js +167 -0
- package/dist/esm/protocols/daikin160.js.map +1 -0
- package/dist/esm/protocols/daikin176.d.ts +44 -0
- package/dist/esm/protocols/daikin176.d.ts.map +1 -0
- package/dist/esm/protocols/daikin176.js +208 -0
- package/dist/esm/protocols/daikin176.js.map +1 -0
- package/dist/esm/protocols/daikin2.d.ts +46 -0
- package/dist/esm/protocols/daikin2.d.ts.map +1 -0
- package/dist/esm/protocols/daikin2.js +328 -0
- package/dist/esm/protocols/daikin2.js.map +1 -0
- package/dist/esm/protocols/daikin216.d.ts +30 -0
- package/dist/esm/protocols/daikin216.d.ts.map +1 -0
- package/dist/esm/protocols/daikin216.js +158 -0
- package/dist/esm/protocols/daikin216.js.map +1 -0
- package/dist/esm/protocols/daikin312.d.ts +45 -0
- package/dist/esm/protocols/daikin312.d.ts.map +1 -0
- package/dist/esm/protocols/daikin312.js +336 -0
- package/dist/esm/protocols/daikin312.js.map +1 -0
- package/dist/esm/protocols/daikin64.d.ts +79 -0
- package/dist/esm/protocols/daikin64.d.ts.map +1 -0
- package/dist/esm/protocols/daikin64.js +253 -0
- package/dist/esm/protocols/daikin64.js.map +1 -0
- package/dist/esm/protocols/daikin_common.d.ts +28 -0
- package/dist/esm/protocols/daikin_common.d.ts.map +1 -0
- package/dist/esm/protocols/daikin_common.js +38 -0
- package/dist/esm/protocols/daikin_common.js.map +1 -0
- package/dist/esm/protocols/nec.d.ts +50 -0
- package/dist/esm/protocols/nec.d.ts.map +1 -0
- package/dist/esm/protocols/nec.js +175 -0
- package/dist/esm/protocols/nec.js.map +1 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/protocols/daikin.d.ts +47 -0
- package/dist/protocols/daikin.d.ts.map +1 -0
- package/dist/protocols/daikin.js +343 -0
- package/dist/protocols/daikin.js.map +1 -0
- package/dist/protocols/daikin128.d.ts +60 -0
- package/dist/protocols/daikin128.d.ts.map +1 -0
- package/dist/protocols/daikin128.js +259 -0
- package/dist/protocols/daikin128.js.map +1 -0
- package/dist/protocols/daikin152.d.ts +47 -0
- package/dist/protocols/daikin152.d.ts.map +1 -0
- package/dist/protocols/daikin152.js +246 -0
- package/dist/protocols/daikin152.js.map +1 -0
- package/dist/protocols/daikin160.d.ts +37 -0
- package/dist/protocols/daikin160.d.ts.map +1 -0
- package/dist/protocols/daikin160.js +166 -0
- package/dist/protocols/daikin160.js.map +1 -0
- package/dist/protocols/daikin176.d.ts +44 -0
- package/dist/protocols/daikin176.d.ts.map +1 -0
- package/dist/protocols/daikin176.js +207 -0
- package/dist/protocols/daikin176.js.map +1 -0
- package/dist/protocols/daikin2.d.ts +46 -0
- package/dist/protocols/daikin2.d.ts.map +1 -0
- package/dist/protocols/daikin2.js +326 -0
- package/dist/protocols/daikin2.js.map +1 -0
- package/dist/protocols/daikin216.d.ts +30 -0
- package/dist/protocols/daikin216.d.ts.map +1 -0
- package/dist/protocols/daikin216.js +157 -0
- package/dist/protocols/daikin216.js.map +1 -0
- package/dist/protocols/daikin312.d.ts +45 -0
- package/dist/protocols/daikin312.d.ts.map +1 -0
- package/dist/protocols/daikin312.js +334 -0
- package/dist/protocols/daikin312.js.map +1 -0
- package/dist/protocols/daikin64.d.ts +79 -0
- package/dist/protocols/daikin64.d.ts.map +1 -0
- package/dist/protocols/daikin64.js +251 -0
- package/dist/protocols/daikin64.js.map +1 -0
- package/dist/protocols/daikin_common.d.ts +28 -0
- package/dist/protocols/daikin_common.d.ts.map +1 -0
- package/dist/protocols/daikin_common.js +38 -0
- package/dist/protocols/daikin_common.js.map +1 -0
- package/dist/protocols/nec.d.ts +50 -0
- package/dist/protocols/nec.d.ts.map +1 -0
- package/dist/protocols/nec.js +175 -0
- package/dist/protocols/nec.js.map +1 -0
- package/package.json +37 -0
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Core IR encoding engine.
|
|
4
|
+
*
|
|
5
|
+
* Mirrors the encoding logic of IRremoteESP8266's IRsend::sendGeneric /
|
|
6
|
+
* IRsend::sendData, but produces a plain timing array instead of driving
|
|
7
|
+
* hardware.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.reverseBits = reverseBits;
|
|
11
|
+
exports.bcdToUint8 = bcdToUint8;
|
|
12
|
+
exports.uint8ToBcd = uint8ToBcd;
|
|
13
|
+
exports.sumBytes = sumBytes;
|
|
14
|
+
exports.sumNibbles64 = sumNibbles64;
|
|
15
|
+
exports.sumNibbles = sumNibbles;
|
|
16
|
+
exports.encodeData = encodeData;
|
|
17
|
+
exports.sendGeneric = sendGeneric;
|
|
18
|
+
exports.sendGenericBytes = sendGenericBytes;
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Bit utilities
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
/**
|
|
23
|
+
* Reverse the least-significant `nbits` bits of `input`.
|
|
24
|
+
* Any higher bits are preserved above the reversed region.
|
|
25
|
+
*
|
|
26
|
+
* Matches IRremoteESP8266 `reverseBits(uint64_t, uint16_t)`.
|
|
27
|
+
*/
|
|
28
|
+
function reverseBits(input, nbits) {
|
|
29
|
+
if (nbits <= 1)
|
|
30
|
+
return input;
|
|
31
|
+
let output = 0;
|
|
32
|
+
let inp = input;
|
|
33
|
+
for (let i = 0; i < nbits; i++) {
|
|
34
|
+
output = (output << 1) | (inp & 1);
|
|
35
|
+
inp >>>= 1;
|
|
36
|
+
}
|
|
37
|
+
return (inp << nbits) | output;
|
|
38
|
+
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// BCD utilities
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/** Convert a BCD-encoded byte to a plain integer. */
|
|
43
|
+
function bcdToUint8(bcd) {
|
|
44
|
+
if (bcd > 0x99)
|
|
45
|
+
return 255;
|
|
46
|
+
return ((bcd >> 4) * 10) + (bcd & 0xf);
|
|
47
|
+
}
|
|
48
|
+
/** Convert an integer (0–99) to BCD encoding. */
|
|
49
|
+
function uint8ToBcd(integer) {
|
|
50
|
+
if (integer > 99)
|
|
51
|
+
return 255;
|
|
52
|
+
return (Math.trunc(integer / 10) << 4) + (integer % 10);
|
|
53
|
+
}
|
|
54
|
+
// ---------------------------------------------------------------------------
|
|
55
|
+
// Checksum utilities
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
/** Sum all bytes in a Uint8Array (or slice). Returns result & 0xFF. */
|
|
58
|
+
function sumBytes(data, start = 0, end = data.length) {
|
|
59
|
+
let sum = 0;
|
|
60
|
+
for (let i = start; i < end; i++)
|
|
61
|
+
sum += data[i];
|
|
62
|
+
return sum & 0xff;
|
|
63
|
+
}
|
|
64
|
+
/** Sum all nibbles of a uint64 up to `nbits` bits. Returns result & 0xF. */
|
|
65
|
+
function sumNibbles64(value, nbits) {
|
|
66
|
+
let data = value & ((1n << BigInt(nbits)) - 1n);
|
|
67
|
+
let result = 0;
|
|
68
|
+
for (; data; data >>= 4n)
|
|
69
|
+
result += Number(data & 0xfn);
|
|
70
|
+
return result & 0xf;
|
|
71
|
+
}
|
|
72
|
+
/** Sum all nibbles (upper + lower) of each byte in a range. */
|
|
73
|
+
function sumNibbles(data, start, length, init = 0) {
|
|
74
|
+
let sum = init;
|
|
75
|
+
for (let i = start; i < start + length; i++)
|
|
76
|
+
sum += (data[i] >> 4) + (data[i] & 0xf);
|
|
77
|
+
return sum & 0xff;
|
|
78
|
+
}
|
|
79
|
+
// ---------------------------------------------------------------------------
|
|
80
|
+
// Data encoding
|
|
81
|
+
// ---------------------------------------------------------------------------
|
|
82
|
+
/**
|
|
83
|
+
* Encode `nbits` of `data` as mark/space pairs.
|
|
84
|
+
*
|
|
85
|
+
* Matches IRremoteESP8266 `IRsend::sendData`.
|
|
86
|
+
*/
|
|
87
|
+
function encodeData(oneMark, oneSpace, zeroMark, zeroSpace, data, nbits, msbFirst) {
|
|
88
|
+
if (nbits === 0)
|
|
89
|
+
return [];
|
|
90
|
+
const timings = [];
|
|
91
|
+
if (msbFirst) {
|
|
92
|
+
// Send leading zeros for bits beyond 64.
|
|
93
|
+
let bits = nbits;
|
|
94
|
+
while (bits > 64) {
|
|
95
|
+
timings.push(zeroMark, zeroSpace);
|
|
96
|
+
bits--;
|
|
97
|
+
}
|
|
98
|
+
for (let i = bits - 1; i >= 0; i--) {
|
|
99
|
+
if (data & (1n << BigInt(i))) {
|
|
100
|
+
timings.push(oneMark, oneSpace);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
timings.push(zeroMark, zeroSpace);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
let d = data;
|
|
109
|
+
for (let i = 0; i < nbits; i++) {
|
|
110
|
+
if (d & 1n) {
|
|
111
|
+
timings.push(oneMark, oneSpace);
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
timings.push(zeroMark, zeroSpace);
|
|
115
|
+
}
|
|
116
|
+
d >>= 1n;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return timings;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Generic IR protocol encoder.
|
|
123
|
+
*
|
|
124
|
+
* Produces a flat array of alternating mark (IR LED on) / space (IR LED off)
|
|
125
|
+
* durations in microseconds, matching the output of
|
|
126
|
+
* IRremoteESP8266's `IRsend::sendGeneric`.
|
|
127
|
+
*/
|
|
128
|
+
function sendGeneric(opts) {
|
|
129
|
+
const { headerMark, headerSpace, oneMark, oneSpace, zeroMark, zeroSpace, footerMark, gap, mesgTime = 0, data, nbits, msbFirst, repeat = 0, } = opts;
|
|
130
|
+
const result = [];
|
|
131
|
+
for (let r = 0; r <= repeat; r++) {
|
|
132
|
+
const frame = [];
|
|
133
|
+
// Header
|
|
134
|
+
if (headerMark)
|
|
135
|
+
frame.push(headerMark);
|
|
136
|
+
if (headerSpace)
|
|
137
|
+
frame.push(headerSpace);
|
|
138
|
+
// Data bits
|
|
139
|
+
const bits = encodeData(oneMark, oneSpace, zeroMark, zeroSpace, data, nbits, msbFirst);
|
|
140
|
+
for (let i = 0; i < bits.length; i++)
|
|
141
|
+
frame.push(bits[i]);
|
|
142
|
+
// Footer mark
|
|
143
|
+
if (footerMark)
|
|
144
|
+
frame.push(footerMark);
|
|
145
|
+
// Gap — adjusted to meet minimum message time
|
|
146
|
+
let elapsed = 0;
|
|
147
|
+
for (let i = 0; i < frame.length; i++)
|
|
148
|
+
elapsed += frame[i];
|
|
149
|
+
const gapTime = elapsed >= mesgTime ? gap : Math.max(gap, mesgTime - elapsed);
|
|
150
|
+
frame.push(gapTime);
|
|
151
|
+
for (let i = 0; i < frame.length; i++)
|
|
152
|
+
result.push(frame[i]);
|
|
153
|
+
}
|
|
154
|
+
return result;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Generic IR encoder for byte-array payloads (AC protocols).
|
|
158
|
+
*
|
|
159
|
+
* Encodes each byte individually (8 bits each) via `encodeData`, matching
|
|
160
|
+
* the `sendGeneric(uint8_t *dataptr, uint16_t nbytes, ...)` overload in
|
|
161
|
+
* IRremoteESP8266.
|
|
162
|
+
*/
|
|
163
|
+
function sendGenericBytes(opts) {
|
|
164
|
+
const { headerMark, headerSpace, oneMark, oneSpace, zeroMark, zeroSpace, footerMark, gap, data, msbFirst, repeat = 0, } = opts;
|
|
165
|
+
const result = [];
|
|
166
|
+
for (let r = 0; r <= repeat; r++) {
|
|
167
|
+
// Header
|
|
168
|
+
if (headerMark)
|
|
169
|
+
result.push(headerMark);
|
|
170
|
+
if (headerSpace)
|
|
171
|
+
result.push(headerSpace);
|
|
172
|
+
// Data — encode each byte individually (8 bits)
|
|
173
|
+
for (let i = 0; i < data.length; i++) {
|
|
174
|
+
const bits = encodeData(oneMark, oneSpace, zeroMark, zeroSpace, BigInt(data[i]), 8, msbFirst);
|
|
175
|
+
for (let j = 0; j < bits.length; j++)
|
|
176
|
+
result.push(bits[j]);
|
|
177
|
+
}
|
|
178
|
+
// Footer
|
|
179
|
+
if (footerMark)
|
|
180
|
+
result.push(footerMark);
|
|
181
|
+
result.push(gap);
|
|
182
|
+
}
|
|
183
|
+
return result;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=encode.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../src/encode.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAYH,kCASC;AAOD,gCAGC;AAGD,gCAGC;AAOD,4BAIC;AAGD,oCAKC;AAGD,gCAOC;AAWD,gCAuCC;AA8BD,kCAqDC;AA2BD,4CA0CC;AA1QD,8EAA8E;AAC9E,gBAAgB;AAChB,8EAA8E;AAE9E;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAa,EAAE,K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,EACV,WAAW,EACX,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,UAAU,EACV,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,MAAM,GAAG,CAAC,GACX,GAAG,IAAI,CAAC;IAET,MAAM,MAAM,GAAa,EAAE,CAAC;IAE5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACjC,SAAS;QACT,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,IAAI,WAAW;YAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAE1C,gDAAgD;QAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,UAAU,CACrB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,EAChB,CAAC,EACD,QAAQ,CACT,CAAC;YACF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE;gBAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAE,CAAC,CAAC;QAC9D,CAAC;QAED,SAAS;QACT,IAAI,UAAU;YAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACxC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* irtxrx — Raw IR remote control frame encoder and decoder
|
|
3
|
+
*
|
|
4
|
+
* TX: state → flat arrays of alternating mark/space durations in microseconds.
|
|
5
|
+
* RX: raw timings → protocol identification + state extraction.
|
|
6
|
+
*/
|
|
7
|
+
export { reverseBits, encodeData, sendGeneric, sendGenericBytes, bcdToUint8, uint8ToBcd, sumBytes, sumNibbles64, } from "./encode.js";
|
|
8
|
+
export type { SendGenericOptions, SendGenericBytesOptions } from "./encode.js";
|
|
9
|
+
export { matchTiming, matchMark, matchSpace, matchAtLeast, matchData, matchGeneric, matchGenericBytes, decode, kTolerance, kMarkExcess, } from "./decode.js";
|
|
10
|
+
export type { MatchDataResult, MatchGenericResult, MatchGenericBytesResult, DecodeResult, DecodeOptions, ProtocolName, BrandName, ProtocolType, } from "./decode.js";
|
|
11
|
+
export { encodeNEC, sendNEC, decodeNEC } from "./protocols/nec.js";
|
|
12
|
+
export type { NECDecodeResult } from "./protocols/nec.js";
|
|
13
|
+
export { sendDaikin64, encodeDaikin64Raw, buildDaikin64Raw, decodeDaikin64, Daikin64Mode, Daikin64Fan, } from "./protocols/daikin64.js";
|
|
14
|
+
export type { Daikin64State } from "./protocols/daikin64.js";
|
|
15
|
+
export { sendDaikin152, encodeDaikin152Raw, buildDaikin152Raw, decodeDaikin152, DaikinMode, DaikinFan, } from "./protocols/daikin152.js";
|
|
16
|
+
export type { Daikin152State } from "./protocols/daikin152.js";
|
|
17
|
+
export type { DaikinModeValue, DaikinFanValue } from "./protocols/daikin_common.js";
|
|
18
|
+
export { sendDaikin160, encodeDaikin160Raw, buildDaikin160Raw, decodeDaikin160, Daikin160SwingV, } from "./protocols/daikin160.js";
|
|
19
|
+
export type { Daikin160State } from "./protocols/daikin160.js";
|
|
20
|
+
export { sendDaikin176, encodeDaikin176Raw, buildDaikin176Raw, decodeDaikin176, Daikin176Mode, Daikin176SwingH, } from "./protocols/daikin176.js";
|
|
21
|
+
export type { Daikin176State } from "./protocols/daikin176.js";
|
|
22
|
+
export { sendDaikin216, encodeDaikin216Raw, buildDaikin216Raw, decodeDaikin216, } from "./protocols/daikin216.js";
|
|
23
|
+
export type { Daikin216State } from "./protocols/daikin216.js";
|
|
24
|
+
export { sendDaikinESP, encodeDaikinESPRaw, buildDaikinESPRaw, decodeDaikinESP, } from "./protocols/daikin.js";
|
|
25
|
+
export type { DaikinESPState } from "./protocols/daikin.js";
|
|
26
|
+
export { sendDaikin128, encodeDaikin128Raw, buildDaikin128Raw, decodeDaikin128, Daikin128Mode, Daikin128Fan, } from "./protocols/daikin128.js";
|
|
27
|
+
export type { Daikin128State } from "./protocols/daikin128.js";
|
|
28
|
+
export { sendDaikin2, encodeDaikin2Raw, buildDaikin2Raw, decodeDaikin2, } from "./protocols/daikin2.js";
|
|
29
|
+
export type { Daikin2State } from "./protocols/daikin2.js";
|
|
30
|
+
export { sendDaikin312, encodeDaikin312Raw, buildDaikin312Raw, decodeDaikin312, } from "./protocols/daikin312.js";
|
|
31
|
+
export type { Daikin312State } from "./protocols/daikin312.js";
|
|
32
|
+
export { buildCoolixRaw, encodeCoolixRaw, sendCoolix, decodeCoolixRaw, decodeCoolix, parseCoolixState, CoolixMode, CoolixFan, CoolixCommand, } from "./protocols/coolix.js";
|
|
33
|
+
export type { CoolixState, CoolixRawResult } from "./protocols/coolix.js";
|
|
34
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,WAAW,EACX,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,QAAQ,EACR,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAC/E,OAAO,EACL,WAAW,EACX,SAAS,EACT,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,MAAM,EACN,UAAU,EACV,WAAW,GACZ,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,uBAAuB,EACvB,YAAY,EACZ,aAA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,EACf,aAAa,EACb,YAAY,GACb,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,aAAa,GACd,MAAM,wBAAwB,CAAC;AAChC,YAAY,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EACL,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,GAChB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EACL,cAAc,EACd,eAAe,EACf,UAAU,EACV,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,UAAU,EACV,SAAS,EACT,aAAa,GACd,MAAM,uBAAuB,CAAC;AAC/B,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* irtxrx — Raw IR remote control frame encoder and decoder
|
|
4
|
+
*
|
|
5
|
+
* TX: state → flat arrays of alternating mark/space durations in microseconds.
|
|
6
|
+
* RX: raw timings → protocol identification + state extraction.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.encodeDaikinESPRaw = exports.sendDaikinESP = exports.decodeDaikin216 = exports.buildDaikin216Raw = exports.encodeDaikin216Raw = exports.sendDaikin216 = exports.Daikin176SwingH = exports.Daikin176Mode = exports.decodeDaikin176 = exports.buildDaikin176Raw = exports.encodeDaikin176Raw = exports.sendDaikin176 = exports.Daikin160SwingV = exports.decodeDaikin160 = exports.buildDaikin160Raw = exports.encodeDaikin160Raw = exports.sendDaikin160 = exports.DaikinFan = exports.DaikinMode = exports.decodeDaikin152 = exports.buildDaikin152Raw = exports.encodeDaikin152Raw = exports.sendDaikin152 = exports.Daikin64Fan = exports.Daikin64Mode = exports.decodeDaikin64 = exports.buildDaikin64Raw = exports.encodeDaikin64Raw = exports.sendDaikin64 = exports.decodeNEC = exports.sendNEC = exports.encodeNEC = exports.kMarkExcess = exports.kTolerance = exports.decode = exports.matchGenericBytes = exports.matchGeneric = exports.matchData = exports.matchAtLeast = exports.matchSpace = exports.matchMark = exports.matchTiming = exports.sumNibbles64 = exports.sumBytes = exports.uint8ToBcd = exports.bcdToUint8 = exports.sendGenericBytes = exports.sendGeneric = exports.encodeData = exports.reverseBits = void 0;
|
|
10
|
+
exports.CoolixCommand = exports.CoolixFan = exports.CoolixMode = exports.parseCoolixState = exports.decodeCoolix = exports.decodeCoolixRaw = exports.sendCoolix = exports.encodeCoolixRaw = exports.buildCoolixRaw = exports.decodeDaikin312 = exports.buildDaikin312Raw = exports.encodeDaikin312Raw = exports.sendDaikin312 = exports.decodeDaikin2 = exports.buildDaikin2Raw = exports.encodeDaikin2Raw = exports.sendDaikin2 = exports.Daikin128Fan = exports.Daikin128Mode = exports.decodeDaikin128 = exports.buildDaikin128Raw = exports.encodeDaikin128Raw = exports.sendDaikin128 = exports.decodeDaikinESP = exports.buildDaikinESPRaw = void 0;
|
|
11
|
+
var encode_js_1 = require("./encode.js");
|
|
12
|
+
Object.defineProperty(exports, "reverseBits", { enumerable: true, get: function () { return encode_js_1.reverseBits; } });
|
|
13
|
+
Object.defineProperty(exports, "encodeData", { enumerable: true, get: function () { return encode_js_1.encodeData; } });
|
|
14
|
+
Object.defineProperty(exports, "sendGeneric", { enumerable: true, get: function () { return encode_js_1.sendGeneric; } });
|
|
15
|
+
Object.defineProperty(exports, "sendGenericBytes", { enumerable: true, get: function () { return encode_js_1.sendGenericBytes; } });
|
|
16
|
+
Object.defineProperty(exports, "bcdToUint8", { enumerable: true, get: function () { return encode_js_1.bcdToUint8; } });
|
|
17
|
+
Object.defineProperty(exports, "uint8ToBcd", { enumerable: true, get: function () { return encode_js_1.uint8ToBcd; } });
|
|
18
|
+
Object.defineProperty(exports, "sumBytes", { enumerable: true, get: function () { return encode_js_1.sumBytes; } });
|
|
19
|
+
Object.defineProperty(exports, "sumNibbles64", { enumerable: true, get: function () { return encode_js_1.sumNibbles64; } });
|
|
20
|
+
var decode_js_1 = require("./decode.js");
|
|
21
|
+
Object.defineProperty(exports, "matchTiming", { enumerable: true, get: function () { return decode_js_1.matchTiming; } });
|
|
22
|
+
Object.defineProperty(exports, "matchMark", { enumerable: true, get: function () { return decode_js_1.matchMark; } });
|
|
23
|
+
Object.defineProperty(exports, "matchSpace", { enumerable: true, get: function () { return decode_js_1.matchSpace; } });
|
|
24
|
+
Object.defineProperty(exports, "matchAtLeast", { enumerable: true, get: function () { return decode_js_1.matchAtLeast; } });
|
|
25
|
+
Object.defineProperty(exports, "matchData", { enumerable: true, get: function () { return decode_js_1.matchData; } });
|
|
26
|
+
Object.defineProperty(exports, "matchGeneric", { enumerable: true, get: function () { return decode_js_1.matchGeneric; } });
|
|
27
|
+
Object.defineProperty(exports, "matchGenericBytes", { enumerable: true, get: function () { return decode_js_1.matchGenericBytes; } });
|
|
28
|
+
Object.defineProperty(exports, "decode", { enumerable: true, get: function () { return decode_js_1.decode; } });
|
|
29
|
+
Object.defineProperty(exports, "kTolerance", { enumerable: true, get: function () { return decode_js_1.kTolerance; } });
|
|
30
|
+
Object.defineProperty(exports, "kMarkExcess", { enumerable: true, get: function () { return decode_js_1.kMarkExcess; } });
|
|
31
|
+
var nec_js_1 = require("./protocols/nec.js");
|
|
32
|
+
Object.defineProperty(exports, "encodeNEC", { enumerable: true, get: function () { return nec_js_1.encodeNEC; } });
|
|
33
|
+
Object.defineProperty(exports, "sendNEC", { enumerable: true, get: function () { return nec_js_1.sendNEC; } });
|
|
34
|
+
Object.defineProperty(exports, "decodeNEC", { enumerable: true, get: function () { return nec_js_1.decodeNEC; } });
|
|
35
|
+
var daikin64_js_1 = require("./protocols/daikin64.js");
|
|
36
|
+
Object.defineProperty(exports, "sendDaikin64", { enumerable: true, get: function () { return daikin64_js_1.sendDaikin64; } });
|
|
37
|
+
Object.defineProperty(exports, "encodeDaikin64Raw", { enumerable: true, get: function () { return daikin64_js_1.encodeDaikin64Raw; } });
|
|
38
|
+
Object.defineProperty(exports, "buildDaikin64Raw", { enumerable: true, get: function () { return daikin64_js_1.buildDaikin64Raw; } });
|
|
39
|
+
Object.defineProperty(exports, "decodeDaikin64", { enumerable: true, get: function () { return daikin64_js_1.decodeDaikin64; } });
|
|
40
|
+
Object.defineProperty(exports, "Daikin64Mode", { enumerable: true, get: function () { return daikin64_js_1.Daikin64Mode; } });
|
|
41
|
+
Object.defineProperty(exports, "Daikin64Fan", { enumerable: true, get: function () { return daikin64_js_1.Daikin64Fan; } });
|
|
42
|
+
var daikin152_js_1 = require("./protocols/daikin152.js");
|
|
43
|
+
Object.defineProperty(exports, "sendDaikin152", { enumerable: true, get: function () { return daikin152_js_1.sendDaikin152; } });
|
|
44
|
+
Object.defineProperty(exports, "encodeDaikin152Raw", { enumerable: true, get: function () { return daikin152_js_1.encodeDaikin152Raw; } });
|
|
45
|
+
Object.defineProperty(exports, "buildDaikin152Raw", { enumerable: true, get: function () { return daikin152_js_1.buildDaikin152Raw; } });
|
|
46
|
+
Object.defineProperty(exports, "decodeDaikin152", { enumerable: true, get: function () { return daikin152_js_1.decodeDaikin152; } });
|
|
47
|
+
Object.defineProperty(exports, "DaikinMode", { enumerable: true, get: function () { return daikin152_js_1.DaikinMode; } });
|
|
48
|
+
Object.defineProperty(exports, "DaikinFan", { enumerable: true, get: function () { return daikin152_js_1.DaikinFan; } });
|
|
49
|
+
var daikin160_js_1 = require("./protocols/daikin160.js");
|
|
50
|
+
Object.defineProperty(exports, "sendDaikin160", { enumerable: true, get: function () { return daikin160_js_1.sendDaikin160; } });
|
|
51
|
+
Object.defineProperty(exports, "encodeDaikin160Raw", { enumerable: true, get: function () { return daikin160_js_1.encodeDaikin160Raw; } });
|
|
52
|
+
Object.defineProperty(exports, "buildDaikin160Raw", { enumerable: true, get: function () { return daikin160_js_1.buildDaikin160Raw; } });
|
|
53
|
+
Object.defineProperty(exports, "decodeDaikin160", { enumerable: true, get: function () { return daikin160_js_1.decodeDaikin160; } });
|
|
54
|
+
Object.defineProperty(exports, "Daikin160SwingV", { enumerable: true, get: function () { return daikin160_js_1.Daikin160SwingV; } });
|
|
55
|
+
var daikin176_js_1 = require("./protocols/daikin176.js");
|
|
56
|
+
Object.defineProperty(exports, "sendDaikin176", { enumerable: true, get: function () { return daikin176_js_1.sendDaikin176; } });
|
|
57
|
+
Object.defineProperty(exports, "encodeDaikin176Raw", { enumerable: true, get: function () { return daikin176_js_1.encodeDaikin176Raw; } });
|
|
58
|
+
Object.defineProperty(exports, "buildDaikin176Raw", { enumerable: true, get: function () { return daikin176_js_1.buildDaikin176Raw; } });
|
|
59
|
+
Object.defineProperty(exports, "decodeDaikin176", { enumerable: true, get: function () { return daikin176_js_1.decodeDaikin176; } });
|
|
60
|
+
Object.defineProperty(exports, "Daikin176Mode", { enumerable: true, get: function () { return daikin176_js_1.Daikin176Mode; } });
|
|
61
|
+
Object.defineProperty(exports, "Daikin176SwingH", { enumerable: true, get: function () { return daikin176_js_1.Daikin176SwingH; } });
|
|
62
|
+
var daikin216_js_1 = require("./protocols/daikin216.js");
|
|
63
|
+
Object.defineProperty(exports, "sendDaikin216", { enumerable: true, get: function () { return daikin216_js_1.sendDaikin216; } });
|
|
64
|
+
Object.defineProperty(exports, "encodeDaikin216Raw", { enumerable: true, get: function () { return daikin216_js_1.encodeDaikin216Raw; } });
|
|
65
|
+
Object.defineProperty(exports, "buildDaikin216Raw", { enumerable: true, get: function () { return daikin216_js_1.buildDaikin216Raw; } });
|
|
66
|
+
Object.defineProperty(exports, "decodeDaikin216", { enumerable: true, get: function () { return daikin216_js_1.decodeDaikin216; } });
|
|
67
|
+
var daikin_js_1 = require("./protocols/daikin.js");
|
|
68
|
+
Object.defineProperty(exports, "sendDaikinESP", { enumerable: true, get: function () { return daikin_js_1.sendDaikinESP; } });
|
|
69
|
+
Object.defineProperty(exports, "encodeDaikinESPRaw", { enumerable: true, get: function () { return daikin_js_1.encodeDaikinESPRaw; } });
|
|
70
|
+
Object.defineProperty(exports, "buildDaikinESPRaw", { enumerable: true, get: function () { return daikin_js_1.buildDaikinESPRaw; } });
|
|
71
|
+
Object.defineProperty(exports, "decodeDaikinESP", { enumerable: true, get: function () { return daikin_js_1.decodeDaikinESP; } });
|
|
72
|
+
var daikin128_js_1 = require("./protocols/daikin128.js");
|
|
73
|
+
Object.defineProperty(exports, "sendDaikin128", { enumerable: true, get: function () { return daikin128_js_1.sendDaikin128; } });
|
|
74
|
+
Object.defineProperty(exports, "encodeDaikin128Raw", { enumerable: true, get: function () { return daikin128_js_1.encodeDaikin128Raw; } });
|
|
75
|
+
Object.defineProperty(exports, "buildDaikin128Raw", { enumerable: true, get: function () { return daikin128_js_1.buildDaikin128Raw; } });
|
|
76
|
+
Object.defineProperty(exports, "decodeDaikin128", { enumerable: true, get: function () { return daikin128_js_1.decodeDaikin128; } });
|
|
77
|
+
Object.defineProperty(exports, "Daikin128Mode", { enumerable: true, get: function () { return daikin128_js_1.Daikin128Mode; } });
|
|
78
|
+
Object.defineProperty(exports, "Daikin128Fan", { enumerable: true, get: function () { return daikin128_js_1.Daikin128Fan; } });
|
|
79
|
+
var daikin2_js_1 = require("./protocols/daikin2.js");
|
|
80
|
+
Object.defineProperty(exports, "sendDaikin2", { enumerable: true, get: function () { return daikin2_js_1.sendDaikin2; } });
|
|
81
|
+
Object.defineProperty(exports, "encodeDaikin2Raw", { enumerable: true, get: function () { return daikin2_js_1.encodeDaikin2Raw; } });
|
|
82
|
+
Object.defineProperty(exports, "buildDaikin2Raw", { enumerable: true, get: function () { return daikin2_js_1.buildDaikin2Raw; } });
|
|
83
|
+
Object.defineProperty(exports, "decodeDaikin2", { enumerable: true, get: function () { return daikin2_js_1.decodeDaikin2; } });
|
|
84
|
+
var daikin312_js_1 = require("./protocols/daikin312.js");
|
|
85
|
+
Object.defineProperty(exports, "sendDaikin312", { enumerable: true, get: function () { return daikin312_js_1.sendDaikin312; } });
|
|
86
|
+
Object.defineProperty(exports, "encodeDaikin312Raw", { enumerable: true, get: function () { return daikin312_js_1.encodeDaikin312Raw; } });
|
|
87
|
+
Object.defineProperty(exports, "buildDaikin312Raw", { enumerable: true, get: function () { return daikin312_js_1.buildDaikin312Raw; } });
|
|
88
|
+
Object.defineProperty(exports, "decodeDaikin312", { enumerable: true, get: function () { return daikin312_js_1.decodeDaikin312; } });
|
|
89
|
+
var coolix_js_1 = require("./protocols/coolix.js");
|
|
90
|
+
Object.defineProperty(exports, "buildCoolixRaw", { enumerable: true, get: function () { return coolix_js_1.buildCoolixRaw; } });
|
|
91
|
+
Object.defineProperty(exports, "encodeCoolixRaw", { enumerable: true, get: function () { return coolix_js_1.encodeCoolixRaw; } });
|
|
92
|
+
Object.defineProperty(exports, "sendCoolix", { enumerable: true, get: function () { return coolix_js_1.sendCoolix; } });
|
|
93
|
+
Object.defineProperty(exports, "decodeCoolixRaw", { enumerable: true, get: function () { return coolix_js_1.decodeCoolixRaw; } });
|
|
94
|
+
Object.defineProperty(exports, "decodeCoolix", { enumerable: true, get: function () { return coolix_js_1.decodeCoolix; } });
|
|
95
|
+
Object.defineProperty(exports, "parseCoolixState", { enumerable: true, get: function () { return coolix_js_1.parseCoolixState; } });
|
|
96
|
+
Object.defineProperty(exports, "CoolixMode", { enumerable: true, get: function () { return coolix_js_1.CoolixMode; } });
|
|
97
|
+
Object.defineProperty(exports, "CoolixFan", { enumerable: true, get: function () { return coolix_js_1.CoolixFan; } });
|
|
98
|
+
Object.defineProperty(exports, "CoolixCommand", { enumerable: true, get: function () { return coolix_js_1.CoolixCommand; } });
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;AAEH,yCASqB;AARnB,wGAAA,WAAW,OAAA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A,kBAAkB,OAAA;AAClB,iHAAA,iBAAiB,OAAA;AACjB,+GAAA,eAAe,OAAA;AAGjB,mDAK+B;AAJ7B,0GAAA,aAAa,OAAA;AACb,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,4GAAA,eAAe,OAAA;AAGjB,yDAOkC;AANhC,6GAAA,aAAa,OAAA;AACb,kHAAA,kBAAkB,OAAA;AAClB,iHAAA,iBAAiB,OAAA;AACjB,+GAAA,eAAe,OAAA;AACf,6GAAA,aAAa,OAAA;AACb,4GAAA,YAAY,OAAA;AAGd,qDAKgC;AAJ9B,yGAAA,WAAW,OAAA;AACX,8GAAA,gBAAgB,OAAA;AAChB,6GAAA,eAAe,OAAA;AACf,2GAAA,aAAa,OAAA;AAGf,yDAKkC;AAJhC,6GAAA,aAAa,OAAA;AACb,kHAAA,kBAAkB,OAAA;AAClB,iHAAA,iBAAiB,OAAA;AACjB,+GAAA,eAAe,OAAA;AAGjB,mDAU+B;AAT7B,2GAAA,cAAc,OAAA;AACd,4GAAA,eAAe,OAAA;AACf,uGAAA,UAAU,OAAA;AACV,4GAAA,eAAe,OAAA;AACf,yGAAA,YAAY,OAAA;AACZ,6GAAA,gBAAgB,OAAA;AAChB,uGAAA,UAAU,OAAA;AACV,sGAAA,SAAS,OAAA;AACT,0GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Coolix IR protocol encoder and decoder.
|
|
3
|
+
*
|
|
4
|
+
* Ported from IRremoteESP8266 `ir_Coolix.cpp` / `ir_Coolix.h`.
|
|
5
|
+
*
|
|
6
|
+
* Wire format: 24-bit data sent as 3 bytes MSB-first, each byte
|
|
7
|
+
* followed by its bitwise inverse (48 bits total on the wire).
|
|
8
|
+
*
|
|
9
|
+
* @see https://github.com/crankyoldgit/IRremoteESP8266/issues/484
|
|
10
|
+
*/
|
|
11
|
+
export declare const CoolixMode: {
|
|
12
|
+
readonly Cool: 0;
|
|
13
|
+
readonly Dry: 1;
|
|
14
|
+
readonly Auto: 2;
|
|
15
|
+
readonly Heat: 3;
|
|
16
|
+
/** Synthetic mode: encoded as Dry + special temp code on the wire. */
|
|
17
|
+
readonly Fan: 4;
|
|
18
|
+
};
|
|
19
|
+
export type CoolixModeValue = (typeof CoolixMode)[keyof typeof CoolixMode];
|
|
20
|
+
export declare const CoolixFan: {
|
|
21
|
+
readonly Auto0: 0;
|
|
22
|
+
readonly Max: 1;
|
|
23
|
+
readonly Med: 2;
|
|
24
|
+
readonly Min: 4;
|
|
25
|
+
readonly Auto: 5;
|
|
26
|
+
readonly ZoneFollow: 6;
|
|
27
|
+
readonly Fixed: 7;
|
|
28
|
+
};
|
|
29
|
+
export type CoolixFanValue = (typeof CoolixFan)[keyof typeof CoolixFan];
|
|
30
|
+
export declare const CoolixCommand: {
|
|
31
|
+
readonly Off: 11697120;
|
|
32
|
+
readonly Swing: 11693024;
|
|
33
|
+
readonly SwingH: 11924898;
|
|
34
|
+
readonly SwingV: 11669472;
|
|
35
|
+
readonly Sleep: 11722755;
|
|
36
|
+
readonly Turbo: 11924898;
|
|
37
|
+
readonly Led: 11924901;
|
|
38
|
+
readonly Clean: 11924906;
|
|
39
|
+
readonly CmdFan: 11714532;
|
|
40
|
+
};
|
|
41
|
+
export interface CoolixState {
|
|
42
|
+
/** Temperature in °C (17–30). Omit for Fan mode. */
|
|
43
|
+
temp?: number;
|
|
44
|
+
mode?: CoolixModeValue;
|
|
45
|
+
fan?: CoolixFanValue;
|
|
46
|
+
/** Sensor temperature 0–30°C. Omit to ignore. */
|
|
47
|
+
sensorTemp?: number;
|
|
48
|
+
zoneFollow?: boolean;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Build a raw 24-bit Coolix code from a state object.
|
|
52
|
+
*/
|
|
53
|
+
export declare function buildCoolixRaw(state: CoolixState): number;
|
|
54
|
+
/**
|
|
55
|
+
* Encode a raw 24-bit Coolix code into IR timings.
|
|
56
|
+
*
|
|
57
|
+
* Each of the 3 data bytes is sent normal then inverted (MSB-first).
|
|
58
|
+
* Matches IRremoteESP8266 `IRsend::sendCOOLIX`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function encodeCoolixRaw(data: number, repeat?: number): number[];
|
|
61
|
+
/**
|
|
62
|
+
* Encode a Coolix AC state into raw IR timings.
|
|
63
|
+
*/
|
|
64
|
+
export declare function sendCoolix(state: CoolixState, repeat?: number): number[];
|
|
65
|
+
export interface CoolixRawResult {
|
|
66
|
+
/** Raw 24-bit Coolix code. */
|
|
67
|
+
data: number;
|
|
68
|
+
/** Number of timing entries consumed. */
|
|
69
|
+
used: number;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Decode raw IR timings into a 24-bit Coolix code.
|
|
73
|
+
*
|
|
74
|
+
* Validates byte inversion parity for all 3 bytes.
|
|
75
|
+
*
|
|
76
|
+
* @returns Raw 24-bit code and entries consumed, or null on mismatch.
|
|
77
|
+
*/
|
|
78
|
+
export declare function decodeCoolixRaw(timings: number[], offset?: number, headerOptional?: boolean): CoolixRawResult | null;
|
|
79
|
+
/**
|
|
80
|
+
* Parse a raw 24-bit Coolix code into a state object.
|
|
81
|
+
*
|
|
82
|
+
* Returns null for command codes (Off, Swing, Turbo, etc.) since
|
|
83
|
+
* they don't encode AC state.
|
|
84
|
+
*/
|
|
85
|
+
export declare function parseCoolixState(data: number): CoolixState | null;
|
|
86
|
+
/**
|
|
87
|
+
* Decode raw IR timings as a Coolix AC state.
|
|
88
|
+
*
|
|
89
|
+
* Returns null if the timings don't match Coolix protocol, or if
|
|
90
|
+
* the decoded code is a command (Off, Swing, etc.) rather than a state frame.
|
|
91
|
+
* Use {@link decodeCoolixRaw} to decode command codes.
|
|
92
|
+
*
|
|
93
|
+
* @param timings Raw mark/space timing array in microseconds.
|
|
94
|
+
* @param offset Starting index in the timings array (default 0).
|
|
95
|
+
* @returns Decoded state (same shape as encode input), or null.
|
|
96
|
+
*/
|
|
97
|
+
export declare function decodeCoolix(timings: number[], offset?: number, headerOptional?: boolean): CoolixState | null;
|
|
98
|
+
//# sourceMappingURL=coolix.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"coolix.d.ts","sourceRoot":"","sources":["../../../src/protocols/coolix.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAqDH,eAAO,MAAM,UAAU;;;;;IAKrB,sEAAsE;;CAE9D,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAM3E,eAAO,MAAM,SAAS;;;;;;;;CAQZ,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAMxE,eAAO,MAAM,aAAa;;;;;;;;;;CAUhB,CAAC;AAmBX,MAAM,WAAW,WAAW;IAC1B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,eAAe,CAAC;IACvB,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAUD;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CAuEzD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,EAAE,CA+B1E;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,MAAM,GAAE,MAAU,GAAG,MAAM,EAAE,CAE3E;AAMD,MAAM,WAAW,eAAe;IAC9B,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;GAMG;AACH,wBA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