6 namespace remote_base {
8 static const char *
const TAG =
"remote.aeha";
10 static const uint16_t BITWISE = 425;
11 static const uint16_t HEADER_HIGH_US = BITWISE * 8;
12 static const uint16_t HEADER_LOW_US = BITWISE * 4;
13 static const uint16_t BIT_HIGH_US = BITWISE;
14 static const uint16_t BIT_ONE_LOW_US = BITWISE * 3;
15 static const uint16_t BIT_ZERO_LOW_US = BITWISE;
16 static const uint16_t TRAILER = BITWISE;
21 dst->
item(HEADER_HIGH_US, HEADER_LOW_US);
23 for (uint16_t mask = 1 << 15; mask != 0; mask >>= 1) {
25 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
27 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
31 for (uint8_t bit : data.
data) {
32 for (uint8_t mask = 1 << 7; mask != 0; mask >>= 1) {
34 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
36 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
48 if (!src.
expect_item(HEADER_HIGH_US, HEADER_LOW_US))
51 for (uint16_t mask = 1 << 15; mask != 0; mask >>= 1) {
54 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
61 for (uint8_t pos = 0; pos < 35; pos++) {
63 for (uint8_t mask = 1 << 7; mask != 0; mask >>= 1) {
66 }
else if (src.
expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
75 out.data.push_back(data);
85 std::string AEHAProtocol::format_data_(
const std::vector<uint8_t> &data) {
87 for (uint8_t byte : data) {
89 sprintf(buf,
"0x%02X,", byte);
97 auto data_str = format_data_(data.
data);
98 ESP_LOGI(TAG,
"Received AEHA: address=0x%04X, data=[%s]", data.
address, data_str.c_str());
void item(uint32_t mark, uint32_t space)
optional< AEHAData > decode(RemoteReceiveData src) override
bool expect_mark(uint32_t length)
void mark(uint32_t length)
std::vector< uint8_t > data
Implementation of SPI Controller mode.
void reserve(uint32_t len)
bool expect_item(uint32_t mark, uint32_t space)
void dump(const AEHAData &data) override
void encode(RemoteTransmitData *dst, const AEHAData &data) override