20static constexpr size_t MAX_FRAME_SIZE = 255;
71 void setup()
override;
Collects binary frames that give their own length, of up to N bytes, in one or more FrameFormats; the...
The RealTimeClock class exposes common timekeeping functions via the device's local real-time clock.
Transport-agnostic Tuya controller.
Tuya MCU controller connected over UART (the standard Tuya serial protocol).
bool gmt_time_sync_callback_registered_
time::RealTimeClock * time_id_
void set_force_time_sync(bool force_time_sync)
uint8_t last_force_time_sync_minute_
void send_command_(TuyaCommand command)
uint32_t last_rx_char_timestamp_
uint8_t protocol_version_
optional< TuyaCommandType > expected_response_
void register_local_time_sync_callback_()
void send_datapoint_command(uint8_t datapoint_id, TuyaDatapointType datapoint_type, const uint8_t *data, size_t len) override
void send_local_time_(bool periodic=false)
void set_status_pin(InternalGPIOPin *status_pin)
void set_time_id(time::RealTimeClock *time_id)
void handle_command_(uint8_t command, uint8_t version, const uint8_t *buffer, size_t len)
bool time_sync_callback_registered_
void send_raw_command_(TuyaCommand command)
TuyaInitState get_init_state()
TuyaInitState init_state_
InternalGPIOPin * status_pin_
void process_command_queue_()
LengthFrameReader< MAX_FRAME_SIZE, TuyaFrame > reader_
void dump_config() override
void send_empty_command_(TuyaCommandType command)
bool handle_frame_(const uint8_t *frame, size_t len)
Returns false for a frame that fails the checksum.
std::vector< TuyaCommand > command_queue_
void handle_datapoints_(const uint8_t *buffer, size_t len)
uint32_t last_command_timestamp_
std::unique_ptr< char[]> product_
void check_force_time_sync_()
uint8_t get_wifi_status_code_()
TuyaExtendedServicesCommandType
PayloadLengthU16BE< LengthField{.offset=4,.trailer=1}> TuyaLength
void warn_too_long(size_t len)
offset: where the length field starts, counted from the first header byte.
FrameFormat option: a frame longer than MAX calls WARN(length) and is skipped; a replay can warn agai...
std::vector< uint8_t > payload