Ejemplo n.º 1
0
// 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;
}
Ejemplo n.º 2
0
// 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 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 Samsung2 decode");
#endif 
    if (decodeSamsung2(results)) {
        return DECODED;
    }
#ifdef DEBUG
    Serial.println("Attempting JVC decode");
#endif 
    if (decodeJVC(results)) {
        return DECODED;
    }
#ifdef DEBUG
    Serial.println("Attempting Samsung decode");
#endif 
    if (decodeSamsung(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;
}