10static constexpr uint16_t BITWISE = 425;
11static constexpr uint16_t HEADER_HIGH_US = BITWISE * 8;
12static constexpr uint16_t HEADER_LOW_US = BITWISE * 4;
13static constexpr uint16_t BIT_HIGH_US = BITWISE;
14static constexpr uint16_t BIT_ONE_LOW_US = BITWISE * 3;
15static constexpr uint16_t BIT_ZERO_LOW_US = BITWISE;
16static constexpr 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 (
size_t i = 0; i <
len; i++) {
33 for (uint8_t mask = 1 << 7; mask != 0; mask >>= 1) {
35 dst->
item(BIT_HIGH_US, BIT_ONE_LOW_US);
37 dst->
item(BIT_HIGH_US, BIT_ZERO_LOW_US);
49 if (!
src.expect_item(HEADER_HIGH_US, HEADER_LOW_US))
52 for (uint16_t mask = 1 << 15; mask != 0; mask >>= 1) {
53 if (
src.expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) {
55 }
else if (
src.expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
64 for (uint8_t mask = 1 << 7; mask != 0; mask >>= 1) {
65 if (
src.expect_item(BIT_HIGH_US, BIT_ONE_LOW_US)) {
67 }
else if (
src.expect_item(BIT_HIGH_US, BIT_ZERO_LOW_US)) {
69 }
else if (
pos > 1 &&
src.expect_mark(TRAILER)) {
76 out.data.push_back(data);
79 if (
src.expect_mark(TRAILER)) {
86std::string AEHAProtocol::format_data_(
const std::vector<uint8_t> &data) {
88 for (uint8_t
byte : data) {
90 snprintf(buf,
sizeof(buf),
"0x%02X,",
byte);
98 auto data_str = format_data_(data.data);
99 ESP_LOGI(TAG,
"Received AEHA: address=0x%04X, data=[%s]", data.address, data_str.c_str());
optional< AEHAData > decode(RemoteReceiveData src)
void encode(RemoteTransmitData *dst, const AEHAData &data)
void dump(const AEHAData &data)
void mark(uint32_t length)
void item(uint32_t mark, uint32_t space)
void reserve(uint32_t len)
std::vector< uint8_t > & out
ESPHOME_LOG_TAG(TAG, "remote.abbwelcome")
uint8_t progmem_read_byte(const uint8_t *addr)