| 60 | } |
| 61 | |
| 62 | bool IRrecv::decodeBoseWave() { |
| 63 | |
| 64 | if (!checkHeader_P(&BoseWaveProtocolConstants)) { |
| 65 | return false; |
| 66 | } |
| 67 | |
| 68 | // Check we have enough data +4 for initial gap, start bit mark and space + stop bit mark |
| 69 | if (decodedIRData.rawlen != (2 * BOSEWAVE_BITS) + 4) { |
| 70 | DEBUG_PRINT(F("Bose: Data length=")); |
| 71 | DEBUG_PRINT(decodedIRData.rawlen); |
| 72 | DEBUG_PRINTLN(F(" is not 36")); |
| 73 | return false; |
| 74 | } |
| 75 | |
| 76 | decodePulseDistanceWidthData_P(&BoseWaveProtocolConstants, BOSEWAVE_BITS); |
| 77 | |
| 78 | // Stop bit |
| 79 | if (!matchMark(irparams.rawbuf[3 + (2 * BOSEWAVE_BITS)], BOSEWAVE_BIT_MARK)) { |
| 80 | DEBUG_PRINTLN(F("Bose: Stop bit mark length is wrong")); |
| 81 | return false; |
| 82 | } |
| 83 | |
| 84 | // Success |
| 85 | // decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value |
| 86 | uint16_t tDecodedValue = decodedIRData.decodedRawData; |
| 87 | uint8_t tCommandNotInverted = tDecodedValue & 0xFF; // comes first and is in the lower bits (LSB first :-)) |
| 88 | uint8_t tCommandInverted = tDecodedValue >> 8; |
| 89 | // parity check for command. Use this variant to avoid compiler warning "comparison of promoted ~unsigned with unsigned [-Wsign-compare]" |
| 90 | if ((tCommandNotInverted ^ tCommandInverted) != 0xFF) { |
| 91 | DEBUG_PRINTLN(F("Bose: Command and inverted command check failed")); |
| 92 | return false; |
| 93 | } |
| 94 | decodedIRData.command = tCommandNotInverted; |
| 95 | decodedIRData.numberOfBits = BOSEWAVE_BITS; |
| 96 | decodedIRData.protocol = BOSEWAVE; |
| 97 | |
| 98 | // check for repeat |
| 99 | checkForRepeatSpaceTicksAndSetFlag(BOSEWAVE_MAXIMUM_REPEAT_DISTANCE / MICROS_PER_TICK); |
| 100 | |
| 101 | return true; |
| 102 | } |
| 103 | |
| 104 | /** @}*/ |
| 105 | #include "LocalDebugLevelEnd.h" |
nothing calls this directly
no test coverage detected