9#ifdef USE_HOERMANN_HCP_IDENTITY
28#ifdef USE_HOERMANN_HCP_IDENTITY
30static constexpr size_t SERIAL_FIRST_HALF_REGS = 7;
31static constexpr size_t SERIAL_SECOND_HALF_REGS = 6;
32static constexpr size_t FIRMWARE_REGS = 6;
35static constexpr uint8_t NO_TRANSFER_ANSWER = 0xFF;
58#ifdef USE_HOERMANN_HCP_IDENTITY
61 SUB_TEXT_SENSOR(version)
66 void dump_config()
override;
69 template<
typename F>
void add_on_state_callback(F &&callback) {
86 bool half_open_door();
90 bool set_light(
bool on);
97 bool is_valid()
const {
return this->
valid_; }
98 bool is_light_on()
const {
return this->
light_on_; }
101 bool is_light_known()
const {
return this->
light_seen_; }
119#ifdef USE_HOERMANN_HCP_IDENTITY
194#ifdef USE_HOERMANN_HCP_IDENTITY
206 char serial_number_[2 * (SERIAL_FIRST_HALF_REGS + SERIAL_SECOND_HALF_REGS) + 1]{};
This class simplifies creating components that periodically check a state.
Minimal static vector - saves memory by avoiding std::vector overhead.
bool command_door_(const HoermannHcpCommand &command)
bool firmware_unreadable_
void on_light_reg_(uint16_t value)
void set_door_state_(DoorState state)
uint8_t identity_attempts_
bool take_identity_request_()
uint8_t take_identity_transfer_(const modbus::RegisterValues ®isters)
void on_state_reg_(uint16_t value)
uint8_t transfer_answer_counter_
void set_valid_(bool valid)
uint32_t identity_asked_at_
CallbackManager< void()> state_callback_
void set_light_seen_(bool seen)
void update_current_position_()
const HoermannHcpCommand * take_command_()
void set_light_on_(bool on)
void arm_identity_request_(IdentityPhase phase)
uint16_t command_reg_value_
uint16_t connection_timeout_ms_
const HoermannHcpCommand * next_command_
void push_command_registers_(modbus::RegisterValues ®isters)
bool status_poll_pending_
uint8_t identity_unanswered_
void add_identity_request_(modbus::RegisterValues ®isters, uint16_t command)
const HoermannHcpCommand * start_command_
bool is_moving_or_starting_() const
uint16_t start_window_ms_
char firmware_version_[2 *FIRMWARE_REGS+1]
void push_transfer_answer_(modbus::RegisterValues ®isters, uint16_t number_of_registers)
uint32_t start_fetched_at_
const HoermannHcpCommand * take_light_command_()
bool short_broadcast_logged_
IdentityPhase identity_phase_
uint32_t target_queued_at_
uint8_t firmware_unreadable_len_
DoorState target_direction_
bool queue_command_(const HoermannHcpCommand &command)
void on_position_reg_(uint16_t value)
uint8_t identity_request_() const
char serial_number_[2 *(SERIAL_FIRST_HALF_REGS+SERIAL_SECOND_HALF_REGS)+1]
uint32_t command_queued_at_
void clear_light_request_()
@ IDENTITY_PHASE_SERIAL_SECOND_HALF
@ IDENTITY_PHASE_FIRMWARE
@ IDENTITY_PHASE_SERIAL_SPLIT
std::optional< ExceptionCode > ResponseStatus