-
Notifications
You must be signed in to change notification settings - Fork 835
/
ir_Toshiba.cpp
568 lines (519 loc) · 20.7 KB
/
ir_Toshiba.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
// Copyright 2017-2021 David Conran
/// @file
/// @brief Support for Toshiba protocols.
/// @see https://github.com/r45635/HVAC-IR-Control
/// @see https://github.com/r45635/HVAC-IR-Control/blob/master/HVAC_ESP8266/HVAC_ESP8266T.ino#L77
/// @see https://github.com/crankyoldgit/IRremoteESP8266/issues/1205
/// @see https://www.toshiba-carrier.co.jp/global/about/index.htm
/// @see http://www.toshiba-carrier.co.th/AboutUs/Pages/CompanyProfile.aspx
#include "ir_Toshiba.h"
#include <algorithm>
#include <cstring>
#ifndef ARDUINO
#include <string>
#endif
#include "IRrecv.h"
#include "IRsend.h"
#include "IRtext.h"
#include "IRutils.h"
// Constants
// Toshiba A/C
const uint16_t kToshibaAcHdrMark = 4400;
const uint16_t kToshibaAcHdrSpace = 4300;
const uint16_t kToshibaAcBitMark = 580;
const uint16_t kToshibaAcOneSpace = 1600;
const uint16_t kToshibaAcZeroSpace = 490;
// Some models have a different inter-message gap.
// See: https://github.com/crankyoldgit/IRremoteESP8266/issues/1420
const uint16_t kToshibaAcMinGap = 4600; // WH-UB03NJ remote
const uint16_t kToshibaAcUsualGap = 7400; // Others
using irutils::addBoolToString;
using irutils::addFanToString;
using irutils::addIntToString;
using irutils::addLabeledString;
using irutils::addModeToString;
using irutils::addTempToString;
using irutils::checkInvertedBytePairs;
using irutils::invertBytePairs;
using irutils::addModelToString;
#if SEND_TOSHIBA_AC
/// Send a Toshiba A/C message.
/// Status: STABLE / Working.
/// @param[in] data The message to be sent.
/// @param[in] nbytes The number of bytes of message to be sent.
/// @param[in] repeat The number of times the command is to be repeated.
void IRsend::sendToshibaAC(const uint8_t data[], const uint16_t nbytes,
const uint16_t repeat) {
sendGeneric(kToshibaAcHdrMark, kToshibaAcHdrSpace, kToshibaAcBitMark,
kToshibaAcOneSpace, kToshibaAcBitMark, kToshibaAcZeroSpace,
kToshibaAcBitMark, kToshibaAcUsualGap, data, nbytes, 38, true,
repeat, 50);
}
#endif // SEND_TOSHIBA_AC
/// Class constructor
/// @param[in] pin GPIO to be used when sending.
/// @param[in] inverted Is the output signal to be inverted?
/// @param[in] use_modulation Is frequency modulation to be used?
IRToshibaAC::IRToshibaAC(const uint16_t pin, const bool inverted,
const bool use_modulation)
: _irsend(pin, inverted, use_modulation) { stateReset(); }
/// Reset the state of the remote to a known good state/sequence.
/// @see https://github.com/r45635/HVAC-IR-Control/blob/master/HVAC_ESP8266/HVAC_ESP8266T.ino#L103
void IRToshibaAC::stateReset(void) {
static const uint8_t kReset[kToshibaACStateLength] = {
0xF2, 0x0D, 0x03, 0xFC, 0x01};
memcpy(_.raw, kReset, kToshibaACStateLength);
setTemp(22); // Remote defaults to 22C after factory reset. So do the same.
setSwing(kToshibaAcSwingOff);
_prev_mode = getMode();
}
/// Set up hardware to be able to send a message.
void IRToshibaAC::begin(void) { _irsend.begin(); }
#if SEND_TOSHIBA_AC
/// Send the current internal state as IR messages.
/// @param[in] repeat Nr. of times the message will be repeated.
void IRToshibaAC::send(const uint16_t repeat) {
_backupState();
_irsend.sendToshibaAC(getRaw(), getStateLength(), repeat);
if (_send_swing && (getStateLength() != kToshibaACStateLengthShort)) {
setStateLength(kToshibaACStateLengthShort);
// Swing settings expect the min temp to be set.
// Ref: https://github.com/crankyoldgit/IRremoteESP8266/issues/1205#issuecomment-653922374
setTemp(kToshibaAcMinTemp);
setSwing(_swing_mode);
_irsend.sendToshibaAC(getRaw(), getStateLength(), repeat);
_restoreState();
}
_send_swing = false;
}
#endif // SEND_TOSHIBA_AC
/// Get the length of the supplied Toshiba state per it's protocol structure.
/// @param[in] state The array to get the built-in length from.
/// @param[in] size The physical size of the state array.
/// @return Nr. of bytes in use for the provided state message.
uint16_t IRToshibaAC::getInternalStateLength(const uint8_t state[],
const uint16_t size) {
if (size < kToshibaAcLengthByte) return 0;
// Fix: Extract the last 4 bits instead
return std::min((uint16_t)((state[kToshibaAcLengthByte] & 0xF)
+ kToshibaAcMinLength), kToshibaACStateLengthLong);
}
/// Get the length of the current internal state per the protocol structure.
/// @return Nr. of bytes in use for the current internal state message.
uint16_t IRToshibaAC::getStateLength(void) const {
return getInternalStateLength(_.raw, kToshibaACStateLengthLong);
}
/// Set the internal length of the current internal state per the protocol.
/// @param[in] size Nr. of bytes in use for the current internal state message.
void IRToshibaAC::setStateLength(const uint16_t size) {
if (size < kToshibaAcMinLength) return;
_.Length = size - kToshibaAcMinLength;
}
/// Make a copy of the internal code-form A/C state.
void IRToshibaAC::_backupState(void) {
memcpy(backup, _.raw, kToshibaACStateLengthLong);
}
/// Recover the internal code-form A/C state from the backup.
void IRToshibaAC::_restoreState(void) {
memcpy(_.raw, backup, kToshibaACStateLengthLong);
}
/// Get a PTR to the internal state/code for this protocol with all integrity
/// checks passing.
/// @return PTR to a code for this protocol based on the current internal state.
uint8_t* IRToshibaAC::getRaw(void) {
checksum(getStateLength());
return _.raw;
}
/// Set the internal state from a valid code for this protocol.
/// @param[in] newState A valid code for this protocol.
/// @param[in] length The length/size of the array.
void IRToshibaAC::setRaw(const uint8_t newState[], const uint16_t length) {
memcpy(_.raw, newState, length);
_prev_mode = getMode();
_send_swing = true;
}
/// Calculate the checksum for a given state.
/// @param[in] state The array to calc the checksum of.
/// @param[in] length The length/size of the array.
/// @return The calculated checksum value.
uint8_t IRToshibaAC::calcChecksum(const uint8_t state[],
const uint16_t length) {
return length ? xorBytes(state, length - 1) : 0;
}
/// Verify the checksum is valid for a given state.
/// @param[in] state The array to verify the checksum of.
/// @param[in] length The length/size of the array.
/// @return true, if the state has a valid checksum. Otherwise, false.
bool IRToshibaAC::validChecksum(const uint8_t state[], const uint16_t length) {
return length >= kToshibaAcMinLength &&
state[length - 1] == IRToshibaAC::calcChecksum(state, length) &&
checkInvertedBytePairs(state, kToshibaAcInvertedLength) &&
IRToshibaAC::getInternalStateLength(state, length) == length;
}
/// Calculate & set the checksum for the current internal state of the remote.
/// @param[in] length The length/size of the internal array to checksum.
void IRToshibaAC::checksum(const uint16_t length) {
// Stored the checksum value in the last byte.
if (length >= kToshibaAcMinLength) {
// Set/clear the short msg bit.
_.ShortMsg = (getStateLength() == kToshibaACStateLengthShort);
// Set/clear the long msg bit.
_.LongMsg = (getStateLength() == kToshibaACStateLengthLong);
invertBytePairs(_.raw, kToshibaAcInvertedLength);
// Always do the Xor checksum LAST!
_.raw[length - 1] = calcChecksum(_.raw, length);
}
}
/// Set the requested power state of the A/C to on.
void IRToshibaAC::on(void) { setPower(true); }
/// Set the requested power state of the A/C to off.
void IRToshibaAC::off(void) { setPower(false); }
/// Change the power setting.
/// @param[in] on true, the setting is on. false, the setting is off.
void IRToshibaAC::setPower(const bool on) {
if (on) { // On
// If not already on, pick the last non-off mode used
if (!getPower()) setMode(_prev_mode);
} else { // Off
setMode(kToshibaAcOff);
}
}
/// Get the value of the current power setting.
/// @return true, the setting is on. false, the setting is off.
bool IRToshibaAC::getPower(void) const {
return getMode(true) != kToshibaAcOff;
}
/// Set the temperature.
/// @param[in] degrees The temperature in degrees celsius.
void IRToshibaAC::setTemp(const uint8_t degrees) {
uint8_t temp = std::max(kToshibaAcMinTemp, degrees);
temp = std::min(kToshibaAcMaxTemp, temp);
_.Temp = temp - kToshibaAcMinTemp;
}
/// Get the current temperature setting.
/// @return The current setting for temp. in degrees celsius.
uint8_t IRToshibaAC::getTemp(void) const { return _.Temp + kToshibaAcMinTemp; }
/// Set the speed of the fan.
/// @param[in] speed The desired setting (0 is Auto, 1-5 is the speed, 5 is Max)
void IRToshibaAC::setFan(const uint8_t speed) {
uint8_t fan = speed;
// Bounds check
if (fan > kToshibaAcFanMax)
fan = kToshibaAcFanMax; // Set the fan to maximum if out of range.
if (fan > kToshibaAcFanAuto) fan++;
_.Fan = fan;
}
/// Get the current fan speed setting.
/// @return The current fan speed/mode.
uint8_t IRToshibaAC::getFan(void) const {
uint8_t fan = _.Fan;
if (fan == kToshibaAcFanAuto) return kToshibaAcFanAuto;
return --fan;
}
/// Get the swing setting of the A/C.
/// @param[in] raw Calculate the answer from just the state data.
/// @return The current swing mode setting.
uint8_t IRToshibaAC::getSwing(const bool raw) const {
return raw ? _.Swing : _swing_mode;
}
/// Set the swing setting of the A/C.
/// @param[in] setting The value of the desired setting.
void IRToshibaAC::setSwing(const uint8_t setting) {
switch (setting) {
case kToshibaAcSwingStep:
case kToshibaAcSwingOn:
case kToshibaAcSwingOff:
case kToshibaAcSwingToggle:
_send_swing = true;
_swing_mode = setting;
if (getStateLength() == kToshibaACStateLengthShort)
_.Swing = setting;
}
}
/// Get the operating mode setting of the A/C.
/// @param[in] raw Get the value without any intelligent processing.
/// @return The current operating mode setting.
uint8_t IRToshibaAC::getMode(const bool raw) const {
const uint8_t mode = _.Mode;
if (raw) return mode;
switch (mode) {
case kToshibaAcOff: return _prev_mode;
default: return mode;
}
}
/// Set the operating mode of the A/C.
/// @param[in] mode The desired operating mode.
/// @note If we get an unexpected mode, default to AUTO.
/// @see https://github.com/crankyoldgit/IRremoteESP8266/issues/1205#issuecomment-654446771
void IRToshibaAC::setMode(const uint8_t mode) {
if (mode != _prev_mode)
// Changing mode or power turns Econo & Turbo to off on a real remote.
// Setting the internal message length to "normal" will do that.
setStateLength(kToshibaACStateLength);
switch (mode) {
case kToshibaAcAuto:
case kToshibaAcCool:
case kToshibaAcDry:
case kToshibaAcHeat:
case kToshibaAcFan:
_prev_mode = mode;
// FALL-THRU
case kToshibaAcOff:
_.Mode = mode;
break;
default:
_prev_mode = kToshibaAcAuto;
_.Mode = kToshibaAcAuto;
}
}
/// Get the Turbo (Powerful) setting of the A/C.
/// @return true, if the current setting is on. Otherwise, false.
bool IRToshibaAC::getTurbo(void) const {
if (getStateLength() == kToshibaACStateLengthLong)
return _.EcoTurbo == kToshibaAcTurboOn;
return false;
}
/// Set the Turbo (Powerful) setting of the A/C.
/// @param[in] on true, the setting is on. false, the setting is off.
/// Note: Turbo mode is mutually exclusive with Economy mode.
void IRToshibaAC::setTurbo(const bool on) {
if (on) {
_.EcoTurbo = kToshibaAcTurboOn;
setStateLength(kToshibaACStateLengthLong);
} else {
if (!getEcono()) setStateLength(kToshibaACStateLength);
}
}
/// Get the Economy mode setting of the A/C.
/// @return true, if the current setting is on. Otherwise, false.
bool IRToshibaAC::getEcono(void) const {
if (getStateLength() == kToshibaACStateLengthLong)
return _.EcoTurbo == kToshibaAcEconoOn;
return false;
}
/// Set the Economy mode setting of the A/C.
/// @param[in] on true, the setting is on. false, the setting is off.
/// Note: Economy mode is mutually exclusive with Turbo mode.
void IRToshibaAC::setEcono(const bool on) {
if (on) {
_.EcoTurbo = kToshibaAcEconoOn;
setStateLength(kToshibaACStateLengthLong);
} else {
if (!getTurbo()) setStateLength(kToshibaACStateLength);
}
}
/// Get the filter (Pure/Ion Filter) setting of the A/C.
/// @return true, if the current setting is on. Otherwise, false.
bool IRToshibaAC::getFilter(void) const {
return (getStateLength() >= kToshibaACStateLength) ? _.Filter : false;
}
/// Set the filter (Pure/Ion Filter) setting of the A/C.
/// @param[in] on true, the setting is on. false, the setting is off.
void IRToshibaAC::setFilter(const bool on) {
_.Filter = on;
if (on) setStateLength(std::min(kToshibaACStateLength, getStateLength()));
}
/// Convert a stdAc::opmode_t enum into its native mode.
/// @param[in] mode The enum to be converted.
/// @return The native equivalent of the enum.
uint8_t IRToshibaAC::convertMode(const stdAc::opmode_t mode) {
switch (mode) {
case stdAc::opmode_t::kCool: return kToshibaAcCool;
case stdAc::opmode_t::kHeat: return kToshibaAcHeat;
case stdAc::opmode_t::kDry: return kToshibaAcDry;
case stdAc::opmode_t::kFan: return kToshibaAcFan;
case stdAc::opmode_t::kOff: return kToshibaAcOff;
default: return kToshibaAcAuto;
}
}
/// Convert a stdAc::fanspeed_t enum into it's native speed.
/// @param[in] speed The enum to be converted.
/// @return The native equivalent of the enum.
uint8_t IRToshibaAC::convertFan(const stdAc::fanspeed_t speed) {
switch (speed) {
case stdAc::fanspeed_t::kMin: return kToshibaAcFanMax - 4;
case stdAc::fanspeed_t::kLow: return kToshibaAcFanMax - 3;
case stdAc::fanspeed_t::kMedium: return kToshibaAcFanMax - 2;
case stdAc::fanspeed_t::kHigh: return kToshibaAcFanMax - 1;
case stdAc::fanspeed_t::kMax: return kToshibaAcFanMax;
default: return kToshibaAcFanAuto;
}
}
/// Convert a native mode into its stdAc equivalent.
/// @param[in] mode The native setting to be converted.
/// @return The stdAc equivalent of the native setting.
stdAc::opmode_t IRToshibaAC::toCommonMode(const uint8_t mode) {
switch (mode) {
case kToshibaAcCool: return stdAc::opmode_t::kCool;
case kToshibaAcHeat: return stdAc::opmode_t::kHeat;
case kToshibaAcDry: return stdAc::opmode_t::kDry;
case kToshibaAcFan: return stdAc::opmode_t::kFan;
case kToshibaAcOff: return stdAc::opmode_t::kOff;
default: return stdAc::opmode_t::kAuto;
}
}
/// Convert a native fan speed into its stdAc equivalent.
/// @param[in] spd The native setting to be converted.
/// @return The stdAc equivalent of the native setting.
stdAc::fanspeed_t IRToshibaAC::toCommonFanSpeed(const uint8_t spd) {
switch (spd) {
case kToshibaAcFanMax: return stdAc::fanspeed_t::kMax;
case kToshibaAcFanMax - 1: return stdAc::fanspeed_t::kHigh;
case kToshibaAcFanMax - 2: return stdAc::fanspeed_t::kMedium;
case kToshibaAcFanMax - 3: return stdAc::fanspeed_t::kLow;
case kToshibaAcFanMax - 4: return stdAc::fanspeed_t::kMin;
default: return stdAc::fanspeed_t::kAuto;
}
}
/// Convert the current internal state into its stdAc::state_t equivalent.
/// @return The stdAc equivalent of the native settings.
stdAc::state_t IRToshibaAC::toCommon(const stdAc::state_t *prev) const {
stdAc::state_t result{};
// Start with the previous state if given it.
if (prev != NULL) {
result = *prev;
} else {
// Set defaults for non-zero values that are not implicitly set for when
// there is no previous state.
// e.g. Any setting that toggles should probably go here.
result.swingv = stdAc::swingv_t::kOff;
}
result.protocol = decode_type_t::TOSHIBA_AC;
result.model = -1; // Not supported.
// Do we have enough current state info to override any previous state?
// i.e. Was the class just setRaw()'ed with a short "swing" message.
// This should enables us to also ignore the Swing msg's special 17C setting.
if (getStateLength() != kToshibaACStateLengthShort) {
result.power = getPower();
result.mode = toCommonMode(getMode());
result.celsius = true;
result.degrees = getTemp();
result.fanspeed = toCommonFanSpeed(getFan());
result.turbo = getTurbo();
result.econo = getEcono();
result.filter = getFilter();
}
switch (getSwing()) {
case kToshibaAcSwingOn:
result.swingv = stdAc::swingv_t::kAuto;
break;
case kToshibaAcSwingToggle:
if (prev->swingv != stdAc::swingv_t::kOff)
result.swingv = stdAc::swingv_t::kOff;
else
result.swingv = stdAc::swingv_t::kAuto;
break;
default: result.swingv = stdAc::swingv_t::kOff;
}
// Not supported.
result.light = false;
result.swingh = stdAc::swingh_t::kOff;
result.quiet = false;
result.clean = false;
result.beep = false;
result.sleep = -1;
result.clock = -1;
return result;
}
/// Convert the current internal state into a human readable string.
/// @return A human readable string.
String IRToshibaAC::toString(void) const {
String result = "";
result.reserve(95);
result += addModelToString(decode_type_t::TOSHIBA_AC, getModel(), false);
result += addTempToString(getTemp(), true);
switch (getStateLength()) {
case kToshibaACStateLengthShort:
result += addIntToString(getSwing(true), kSwingVStr);
result += kSpaceLBraceStr;
switch (getSwing(true)) {
case kToshibaAcSwingOff: result += kOffStr; break;
case kToshibaAcSwingOn: result += kOnStr; break;
case kToshibaAcSwingStep: result += kStepStr; break;
case kToshibaAcSwingToggle: result += kToggleStr; break;
default: result += kUnknownStr;
}
result += ')';
break;
case kToshibaACStateLengthLong:
case kToshibaACStateLength:
default:
result += addBoolToString(getPower(), kPowerStr);
if (getPower())
result += addModeToString(getMode(), kToshibaAcAuto, kToshibaAcCool,
kToshibaAcHeat, kToshibaAcDry, kToshibaAcFan);
result += addFanToString(getFan(), kToshibaAcFanMax, kToshibaAcFanMin,
kToshibaAcFanAuto, kToshibaAcFanAuto,
kToshibaAcFanMed);
result += addBoolToString(getTurbo(), kTurboStr);
result += addBoolToString(getEcono(), kEconoStr);
result += addBoolToString(getFilter(), kFilterStr);
}
return result;
}
/// Get the model information currently known.
/// @return The known model number.
toshiba_ac_remote_model_t IRToshibaAC::getModel(void) const {
switch (_.Model) {
case kToshibaAcRemoteB:
return toshiba_ac_remote_model_t::kToshibaGenericRemote_B;
default:
return toshiba_ac_remote_model_t::kToshibaGenericRemote_A;
}
}
/// Set the current model for the remote.
/// @param[in] model The model number.
void IRToshibaAC::setModel(const toshiba_ac_remote_model_t model) {
switch (model) {
case toshiba_ac_remote_model_t::kToshibaGenericRemote_B:
_.Model = kToshibaAcRemoteB;
break;
default:
_.Model = kToshibaAcRemoteA;
break;
}
}
#if DECODE_TOSHIBA_AC
/// Decode the supplied Toshiba A/C message.
/// Status: STABLE / Working.
/// @param[in,out] results Ptr to the data to decode & where to store the result
/// @param[in] offset The starting index to use when attempting to decode the
/// raw data. Typically/Defaults to kStartOffset.
/// @param[in] nbits The number of data bits to expect.
/// @param[in] strict Flag indicating if we should perform strict matching.
/// @return True if it can decode it, false if it can't.
bool IRrecv::decodeToshibaAC(decode_results* results, uint16_t offset,
const uint16_t nbits, const bool strict) {
// Compliance
if (strict) {
switch (nbits) { // Must be called with the correct nr. of bits.
case kToshibaACBits:
case kToshibaACBitsShort:
case kToshibaACBitsLong:
break;
default:
return false;
}
}
// Match Header + Data + Footer
if (!matchGeneric(results->rawbuf + offset, results->state,
results->rawlen - offset, nbits,
kToshibaAcHdrMark, kToshibaAcHdrSpace,
kToshibaAcBitMark, kToshibaAcOneSpace,
kToshibaAcBitMark, kToshibaAcZeroSpace,
kToshibaAcBitMark, kToshibaAcMinGap, true,
_tolerance, kMarkExcess)) return false;
// Compliance
if (strict) {
// Check that the checksum of the message is correct.
if (!IRToshibaAC::validChecksum(results->state, nbits / 8)) return false;
}
// Success
results->decode_type = TOSHIBA_AC;
results->bits = nbits;
// No need to record the state as we stored it as we decoded it.
// As we use result->state, we don't record value, address, or command as it
// is a union data type.
return true;
}
#endif // DECODE_TOSHIBA_AC