5 newVal < 3 * (oldVal / 4) ? 0
6 : newVal > 5 * (oldVal / 4) ? 2
15void HashDecoder::decode(
const microseconds_t* data,
size_t length) {
16 if (length < minMeaningfulLength)
19 for (
unsigned int i = 0; i < length - offset - 1; i++) {
20 uint32_t value = compare(data[i], data[i + offset]);
21 hash = (hash * FNVprime) ^ value;
27void HashDecoder::decode(
const IrReader& irReader) {
29 if (length < minMeaningfulLength)
32 for (
unsigned int i = 0; i < length - offset - 1; i++) {
34 hash = (hash * FNVprime) ^ value;
This file defines a hash based "decoder class".
uint16_t microseconds_t
Type for durations in micro seconds.
A decoder class using FNV-1 hashes of length 32.
uint32_t getHash() const
Returns the hash value.
static bool tryDecode(const IrReader &irReader, Stream &stream)
Convenience function; constructs a HashDecoder and calls its printDecode.
static uint32_t decodeHash(const IrSequence &irSequence)
void setValid(bool valid_)
bool printDecode(Stream &stream) const
If valid, prints the decode to the stream.
Abstract base class for all IR readers, capturing or receiving.
virtual size_t getDataLength() const =0
Returns the number of collected durations.
virtual microseconds_t getDuration(unsigned int index) const =0
Returns the index-th duration, if possible.
This class consists of a vector of durations.