| 105 | } |
| 106 | |
| 107 | bool IRrecv::decodeSony() { |
| 108 | |
| 109 | if (!checkHeader_P(&SonyProtocolConstants)) { |
| 110 | return false; |
| 111 | } |
| 112 | |
| 113 | // Check we have enough data. +2 for initial gap and start bit mark and space minus the last/MSB space. NO stop bit! 26, 32, 42 |
| 114 | if (!(decodedIRData.rawlen == (2 * SONY_BITS_MIN) + 2 || decodedIRData.rawlen == (2 * SONY_BITS_MAX) + 2 |
| 115 | || decodedIRData.rawlen == (2 * SONY_BITS_15) + 2)) { |
| 116 | DEBUG_PRINT(F("Sony: Data length=")); |
| 117 | DEBUG_PRINT(decodedIRData.rawlen); |
| 118 | DEBUG_PRINTLN(F(" is not 12, 15 or 20")); |
| 119 | return false; |
| 120 | } |
| 121 | |
| 122 | decodePulseDistanceWidthData_P(&SonyProtocolConstants, (decodedIRData.rawlen - 1) / 2, 3); |
| 123 | |
| 124 | // Success |
| 125 | // decodedIRData.flags = IRDATA_FLAGS_IS_LSB_FIRST; // Not required, since this is the start value |
| 126 | decodedIRData.command = decodedIRData.decodedRawData & 0x7F; // first 7 bits |
| 127 | decodedIRData.address = decodedIRData.decodedRawData >> 7; // next 5 or 8 or 13 bits |
| 128 | decodedIRData.numberOfBits = (decodedIRData.rawlen - 1) / 2; |
| 129 | decodedIRData.protocol = SONY; |
| 130 | |
| 131 | //Check for repeat |
| 132 | checkForRepeatSpaceTicksAndSetFlag(SONY_MAXIMUM_REPEAT_DISTANCE / MICROS_PER_TICK); |
| 133 | |
| 134 | return true; |
| 135 | } |
| 136 | |
| 137 | /********************************************************************************* |
| 138 | * Old deprecated functions, kept for backward compatibility to old 2.0 tutorials |
nothing calls this directly
no outgoing calls
no test coverage detected