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) {
  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;
}
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 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.º 3
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
  if (results->rawlen != 0){
	Serial.print("results->rawlen: ");
	Serial.println(irparams.rawlen);
  }
  #endif
  */
#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 RC5 decode");
#endif  
  if (decodeRC5(results)) {
    return DECODED;
  }
#ifdef DEBUG
  Serial.println("Attempting RC6 decode");
#endif 
  if (decodeRC6(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();
  debug_print("ERR in IRrecv::decode");
  return ERR;
}
Ejemplo n.º 4
0
Archivo: irrecv.c Proyecto: Mpic/avr
// 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 COMPILE_DECODE_NEC
  if (decodeNEC(results)) {
    return DECODED;
  }
#endif

#ifdef COMPILE_DECODE_SONY
  if (decodeSony(results)) {
    return DECODED;
  }
#endif

  if (decodeRC5(results)) {
    return DECODED;
  }

#ifdef COMPILE_DECODE_RC6
  if (decodeRC6(results)) {
    return DECODED;
  }
#endif

#ifdef COMPILE_DECODE_JVC
  if (decodeJVC(results)) {
    return DECODED;
  }
#endif

  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
  irrecv_resume();
  return ERR;
}
Ejemplo n.º 5
0
bool IRRemote::decode()
{
    bool rc = false;

    if (_rcvstate != STATE_STOP)
    {
        resume();
        rc = false;
    }

    else if (decodeNEC (_rawlen) || 
             decodeSony (_rawlen) ||
             decodeRC5 (_rawlen) ||
             decodeSAMSUNG (_rawlen) ||
             decodeHash (_rawlen))
             
    {
        rc = true;
    }


    return rc;
}
Ejemplo n.º 6
0
// 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;
}
Ejemplo n.º 7
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;

	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;
}
Ejemplo n.º 8
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;
  }
#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;
}
Ejemplo n.º 9
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) {
  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;
}