// Decodes the received IR message // Returns 0 if no data ready, 1 if data ready. // Results of decoding are stored in results int IRrecv::decode(decode_results *results) { if (decodeStart(results) == ERR) return ERR; debug_println("Attempting NEC decode"); if (decodeNEC(results)) { return DECODED; } debug_println("Attempting Sony decode"); if (decodeSony(results)) { return DECODED; } debug_println("Attempting Sanyo decode"); if (decodeSanyo(results)) { return DECODED; } debug_println("Attempting Mitsubishi decode"); if (decodeMitsubishi(results)) { return DECODED; } debug_println("Attempting RC5 decode"); if (decodeRC5(results)) { return DECODED; } debug_println("Attempting RC6 decode"); if (decodeRC6(results)) { return DECODED; } debug_println("Attempting Panasonic decode"); if (decodePanasonic(results)) { return DECODED; } debug_println("Attempting JVC decode"); if (decodeJVC(results)) { return DECODED; } // decodeHash returns a hash on any input. // Thus, it needs to be last in the list. // If you add any decodes, add them before this. if (decodeHash(results)) { return DECODED; } // Throw away and start over resume(); return ERR; }
// Decodes the received IR message // Returns 0 if no data ready, 1 if data ready. // Results of decoding are stored in results int IRrecv::decode(decode_results *results) { results->rawbuf = irparams.rawbuf; results->rawlen = irparams.rawlen; if (irparams.rcvstate != STATE_STOP) { return ERR; } #ifdef DEBUG Serial.println("Attempting NEC decode"); #endif if (decodeNEC(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Panasonic decode"); #endif if (decodePanasonic(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Samsung decode"); #endif if (decodeSamsung(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Sony decode"); #endif if (decodeSony(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting RC5 decode"); #endif if (decodeRC5(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting RC6 decode"); #endif if (decodeRC6(results)) { return DECODED; } if (results->rawlen >= 6) { // Only return raw buffer if at least 6 bits results->decode_type = UNKNOWN; results->bits = 0; results->value = 0; return DECODED; } // Throw away and start over resume(); return ERR; }
// Decodes the received IR message // Returns 0 if no data ready, 1 if data ready. // Results of decoding are stored in results int IRrecvSF::decode(decode_resultsSF *results) { results->rawbuf = irparamsSF.rawbuf; results->rawlen = irparamsSF.rawlen; if (irparamsSF.rcvstate != STATE_STOP) { return ERR; } #ifdef DEBUG Serial.println("Attempting NEC decode"); #endif if (decodeNEC(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Sony decode"); #endif if (decodeSony(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Sanyo decode"); #endif if (decodeSanyo(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Mitsubishi decode"); #endif if (decodeMitsubishi(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting RC5 decode"); #endif if (decodeRC5(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting RC6 decode"); #endif if (decodeRC6(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting Panasonic decode"); #endif if (decodePanasonic(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting JVC decode"); #endif if (decodeJVC(results)) { return DECODED; } // decodeHash returns a hash on any input. // Thus, it needs to be last in the list. // If you add any decodes, add them before this. if (decodeHash(results)) { return DECODED; } // Throw away and start over resume(); return ERR; }
//+============================================================================= // Decodes the received IR message // Returns 0 if no data ready, 1 if data ready. // Results of decoding are stored in results // int IRrecv::decode (decode_results *results) { results->rawbuf = irparams.rawbuf; results->rawlen = irparams.rawlen; results->overflow = irparams.overflow; if (irparams.rcvstate != STATE_STOP) return false ; #if DECODE_NEC DBG_PRINTLN("Attempting NEC decode"); if (decodeNEC(results)) return true ; #endif #if DECODE_SONY DBG_PRINTLN("Attempting Sony decode"); if (decodeSony(results)) return true ; #endif #if DECODE_SANYO DBG_PRINTLN("Attempting Sanyo decode"); if (decodeSanyo(results)) return true ; #endif #if DECODE_MITSUBISHI DBG_PRINTLN("Attempting Mitsubishi decode"); if (decodeMitsubishi(results)) return true ; #endif #if DECODE_RC5 DBG_PRINTLN("Attempting RC5 decode"); if (decodeRC5(results)) return true ; #endif #if DECODE_RC6 DBG_PRINTLN("Attempting RC6 decode"); if (decodeRC6(results)) return true ; #endif #if DECODE_PANASONIC DBG_PRINTLN("Attempting Panasonic decode"); if (decodePanasonic(results)) return true ; #endif #if DECODE_LG DBG_PRINTLN("Attempting LG decode"); if (decodeLG(results)) return true ; #endif #if DECODE_JVC DBG_PRINTLN("Attempting JVC decode"); if (decodeJVC(results)) return true ; #endif #if DECODE_SAMSUNG DBG_PRINTLN("Attempting SAMSUNG decode"); if (decodeSAMSUNG(results)) return true ; #endif #if DECODE_WHYNTER DBG_PRINTLN("Attempting Whynter decode"); if (decodeWhynter(results)) return true ; #endif #if DECODE_AIWA_RC_T501 DBG_PRINTLN("Attempting Aiwa RC-T501 decode"); if (decodeAiwaRCT501(results)) return true ; #endif #if DECODE_DENON DBG_PRINTLN("Attempting Denon decode"); if (decodeDenon(results)) return true ; #endif // decodeHash returns a hash on any input. // Thus, it needs to be last in the list. // If you add any decodes, add them before this. if (decodeHash(results)) return true ; // Throw away and start over resume(); return false; }
// Decodes the received IR message // Returns 0 if no data ready, 1 if data ready. // Results of decoding are stored in results int IRrecv::decode(decode_results *results) { results->rawbuf = irparams.rawbuf; results->rawlen = irparams.rawlen; if (irparams.rcvstate != STATE_STOP) { return ERR; } #if TINY_PROTO_NEC #ifdef DEBUG Serial.println("Attempting NEC decode"); #endif if (decodeNEC(results)) { return DECODED; } #endif #if TINY_PROTO_SONY #ifdef DEBUG Serial.println("Attempting Sony decode"); #endif if (decodeSony(results)) { return DECODED; } #endif #if TINY_PROTO_SANYO #ifdef DEBUG Serial.println("Attempting Sanyo decode"); #endif if (decodeSanyo(results)) { return DECODED; } #endif #if TINY_PROTO_MITSUBISHI #ifdef DEBUG Serial.println("Attempting Mitsubishi decode"); #endif if (decodeMitsubishi(results)) { return DECODED; } #endif #if TINY_PROTO_RC5 #ifdef DEBUG Serial.println("Attempting RC5 decode"); #endif if (decodeRC5(results)) { return DECODED; } #endif #if TINY_PROTO_RC6 #ifdef DEBUG Serial.println("Attempting RC6 decode"); #endif if (decodeRC6(results)) { return DECODED; } #endif #if TINY_PROTO_PANASONIC #ifdef DEBUG Serial.println("Attempting Panasonic decode"); #endif if (decodePanasonic(results)) { return DECODED; } #endif #if TINY_PROTO_LG #ifdef DEBUG Serial.println("Attempting LG decode"); #endif if (decodeLG(results)) { return DECODED; } #endif #if TINY_PROTO_JVC #ifdef DEBUG Serial.println("Attempting JVC decode"); #endif if (decodeJVC(results)) { return DECODED; } #endif #if TINY_PROTO_SAMSUNG #ifdef DEBUG Serial.println("Attempting SAMSUNG decode"); #endif if (decodeSAMSUNG(results)) { return DECODED; } #endif #if TINY_PROTO_HASH // decodeHash returns a hash on any input. // Thus, it needs to be last in the list. // If you add any decodes, add them before this. if (decodeHash(results)) { return DECODED; } #endif // Throw away and start over resume(); return ERR; }
// Decode a Denon message. // // Args: // results: Ptr to the data to decode and where to store the decode result. // nbits: Expected nr. of data bits. (Typically DENON_BITS) // Returns: // boolean: True if it can decode it, false if it can't. // // Status: BETA / Should work fine. // // Ref: // https://github.com/z3t0/Arduino-IRremote/blob/master/ir_Denon.cpp bool IRrecv::decodeDenon(decode_results *results, uint16_t nbits, bool strict) { // Compliance if (strict) { switch (nbits) { case DENON_BITS: case DENON_48_BITS: case kDenonLegacyBits: break; default: return false; } } // Denon uses the Sharp & Panasonic(Kaseikyo) protocol for some // devices, so check for those first. // It is not exactly like Sharp's protocols, but close enough. // e.g. The expansion bit is not set for Denon vs. set for Sharp. // Ditto for Panasonic, it's the same except for a different // manufacturer code. if (!decodeSharp(results, nbits, true, false) && !decodePanasonic(results, nbits, true, kDenonManufacturer)) { // We couldn't decode it as expected, so try the old legacy method. // NOTE: I don't think this following protocol actually exists. // Looks like a partial version of the Sharp protocol. // Check we have enough data if (results->rawlen < 2 * nbits + kHeader + kFooter - 1) return false; if (strict && nbits != kDenonLegacyBits) return false; uint64_t data = 0; uint16_t offset = kStartOffset; // Header if (!matchMark(results->rawbuf[offset], kDenonHdrMark)) return false; // Calculate how long the common tick time is based on the header mark. uint32_t m_tick = results->rawbuf[offset++] * kRawTick / kDenonHdrMarkTicks; if (!matchSpace(results->rawbuf[offset], kDenonHdrSpace)) return false; uint32_t s_tick = results->rawbuf[offset++] * kRawTick / kDenonHdrSpaceTicks; // Data match_result_t data_result = matchData(&(results->rawbuf[offset]), nbits, kDenonBitMarkTicks * m_tick, kDenonOneSpaceTicks * s_tick, kDenonBitMarkTicks * m_tick, kDenonZeroSpaceTicks * s_tick); if (data_result.success == false) return false; data = data_result.data; offset += data_result.used; // Footer if (!matchMark(results->rawbuf[offset++], kDenonBitMarkTicks * m_tick)) return false; // Success results->bits = nbits; results->value = data; results->address = 0; results->command = 0; } // Legacy decode. // Compliance if (strict && nbits != results->bits) return false; // Success results->decode_type = DENON; return true; }
// Decodes the received IR message // Returns 0 if no data ready, 1 if data ready. // Results of decoding are stored in results int IRrecv::decode(decode_results *results) { cli(); handle_interrupt(); sei(); results->rawbuf = irparams.rawbuf; results->rawlen = irparams.rawlen; if (irparams.rcvstate != STATE_STOP) { return ERR; } #ifndef IS_AVTINY #ifdef DEBUG Serial.println("Attempting NEC decode"); #endif if (decodeNEC(results)) { return DECODED; } #endif #ifdef DEBUG Serial.println("Attempting Sony decode"); #endif if (decodeSony(results)) { return DECODED; } #ifndef IS_AVTINY #ifdef DEBUG Serial.println("Attempting RC5 decode"); #endif if (decodeRC5(results)) { return DECODED; } #endif #ifdef DEBUG Serial.println("Attempting RC6 decode"); #endif if (decodeRC6(results)) { return DECODED; } #ifndef IS_AVTINY #ifdef DEBUG Serial.println("Attempting Panasonic decode"); #endif if (decodePanasonic(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting JVC decode"); #endif if (decodeJVC(results)) { return DECODED; } #ifdef DEBUG Serial.println("Attempting RCMM decode"); #endif if (decodeRCMM(results)) { return DECODED; } #endif // decodeHash returns a hash on any input. // Thus, it needs to be last in the list. // If you add any decodes, add them before this. if (decodeHash(results)) { return DECODED; } // Throw away and start over resume(); return ERR; }