IR-protocol/IR_Decoder.h
2024-08-29 17:06:10 +03:00

48 lines
1.0 KiB
C++

#pragma once
#include "IR_DecoderRaw.h"
#include "PacketTypes.h"
#include "IR_Encoder.h"
class IR_Decoder : public IR_DecoderRaw
{
private:
// static std::list<IR_Decoder *> dec_list;
static std::list<IR_Decoder*>& get_dec_list();
void _tick();
uint32_t acceptSendTimer;
bool isWaitingAcceptSend;
uint16_t addrAcceptSendTo;
uint16_t acceptDelay = 75;
uint8_t acceptCustomByte;
public:
PacketTypes::Data gotData;
PacketTypes::DataBack gotBackData;
PacketTypes::Accept gotAccept;
PacketTypes::Request gotRequest;
PacketTypes::BasePack gotRaw;
// IR_Decoder();
IR_Decoder(const uint8_t pin, uint16_t addr = 0, IR_Encoder *encPair = nullptr, bool autoHandle = true);
std::function<void()> operator()();
void enable();
void disable();
~IR_Decoder();
static void tick();
inline void setAcceptDelay(uint16_t acceptDelay)
{
this->acceptDelay = acceptDelay;
}
inline uint16_t getAcceptDelay()
{
return this->acceptDelay;
}
};