7 namespace remote_base {
21 RCSwitchBase(uint32_t sync_high, uint32_t sync_low, uint32_t zero_high, uint32_t zero_low, uint32_t one_high,
22 uint32_t one_low,
bool inverted);
38 bool decode(
RemoteReceiveData &src, uint64_t *out_data, uint8_t *out_nbits)
const;
42 static void simple_code_to_tristate(uint16_t
code, uint8_t nbits, uint64_t *out_code);
44 static void type_a_code(uint8_t switch_group, uint8_t switch_device,
bool state, uint64_t *out_code,
47 static void type_b_code(uint8_t address_code, uint8_t channel_code,
bool state, uint64_t *out_code,
50 static void type_c_code(uint8_t family, uint8_t group, uint8_t device,
bool state, uint64_t *out_code,
53 static void type_d_code(uint8_t group, uint8_t device,
bool state, uint64_t *out_code, uint8_t *out_nbits);
56 uint32_t sync_high_{};
58 uint32_t zero_high_{};
74 TEMPLATABLE_VALUE(std::string,
code);
77 auto code = this->code_.value(
x...);
79 uint8_t nbits =
code.size();
81 auto proto = this->protocol_.value(
x...);
82 proto.transmit(dst, the_code, nbits);
89 TEMPLATABLE_VALUE(std::string, group);
90 TEMPLATABLE_VALUE(std::string, device);
91 TEMPLATABLE_VALUE(
bool,
state);
94 auto group = this->group_.value(
x...);
95 auto device = this->device_.value(
x...);
96 auto state = this->state_.value(
x...);
104 auto proto = this->protocol_.value(
x...);
105 proto.transmit(dst, code, nbits);
112 TEMPLATABLE_VALUE(uint8_t,
address);
113 TEMPLATABLE_VALUE(uint8_t, channel);
114 TEMPLATABLE_VALUE(
bool,
state);
117 auto address = this->address_.value(
x...);
118 auto channel = this->channel_.value(
x...);
119 auto state = this->state_.value(
x...);
125 auto proto = this->protocol_.value(
x...);
126 proto.transmit(dst, code, nbits);
133 TEMPLATABLE_VALUE(std::string, family);
134 TEMPLATABLE_VALUE(uint8_t, group);
135 TEMPLATABLE_VALUE(uint8_t, device);
136 TEMPLATABLE_VALUE(
bool,
state);
139 auto family = this->family_.value(
x...);
140 auto group = this->group_.value(
x...);
141 auto device = this->device_.value(
x...);
142 auto state = this->state_.value(
x...);
144 auto u_family =
static_cast<uint8_t
>(tolower(family[0]) -
'a');
150 auto proto = this->protocol_.value(
x...);
151 proto.transmit(dst, code, nbits);
157 TEMPLATABLE_VALUE(std::string, group);
158 TEMPLATABLE_VALUE(uint8_t, device);
159 TEMPLATABLE_VALUE(
bool,
state);
162 auto group = this->group_.value(
x...);
163 auto device = this->device_.value(
x...);
164 auto state = this->state_.value(
x...);
166 auto u_group =
static_cast<uint8_t
>(tolower(group[0]) -
'a');
172 auto proto = this->protocol_.value(
x...);
173 proto.transmit(dst, code, nbits);
184 this->nbits_ = code.size();
196 auto u_family =
static_cast<uint8_t
>(tolower(family[0]) -
'a');
200 auto u_group =
static_cast<uint8_t
>(tolower(group[0]) -
'a');
209 uint64_t mask_{0xFFFFFFFFFFFFFFFF};
void set_code(uint64_t code)
static void type_d_code(uint8_t group, uint8_t device, bool state, uint64_t *out_code, uint8_t *out_nbits)
void encode(RemoteTransmitData *dst, Ts... x) override
void set_type_b(uint8_t address_code, uint8_t channel_code, bool state)
static void type_c_code(uint8_t family, uint8_t group, uint8_t device, bool state, uint64_t *out_code, uint8_t *out_nbits)
void set_type_a(const std::string &group, const std::string &device, bool state)
void set_type_c(std::string family, uint8_t group, uint8_t device, bool state)
void set_nbits(uint8_t nbits)
static void type_a_code(uint8_t switch_group, uint8_t switch_device, bool state, uint64_t *out_code, uint8_t *out_nbits)
void encode(RemoteTransmitData *dst, Ts... x) override
uint64_t decode_binary_string_mask(const std::string &data)
void set_type_d(std::string group, uint8_t device, bool state)
const RCSwitchBase RC_SWITCH_PROTOCOLS[9]
void set_code(const std::string &code)
uint64_t decode_binary_string(const std::string &data)
static void type_b_code(uint8_t address_code, uint8_t channel_code, bool state, uint64_t *out_code, uint8_t *out_nbits)
bool operator==(const RCSwitchData &rhs) const
Implementation of SPI Controller mode.
void set_protocol(const RCSwitchBase &a_protocol)
void encode(RemoteTransmitData *dst, Ts... x) override
void encode(RemoteTransmitData *dst, Ts... x) override
void encode(RemoteTransmitData *dst, Ts... x) override