14#ifdef USE_BINARY_SENSOR
67 void setup()
override;
82#ifdef USE_BINARY_SENSOR
87#ifdef ENTITY_TRANSPORT_REMOTE_SENSOR_COUNT
92#ifdef ENTITY_TRANSPORT_REMOTE_BINARY_SENSOR_COUNT
122 size_t write_record_(
const LocalEntity &entity, uint8_t *record)
const;
128 void learn_(
const char *provider,
size_t provider_length, uint8_t
type, uint8_t number,
const char *
id,
129 size_t id_length,
uint32_t dictionary_id);
151#ifdef ENTITY_TRANSPORT_REMOTE_SENSOR_COUNT
154#ifdef ENTITY_TRANSPORT_REMOTE_BINARY_SENSOR_COUNT
Fixed-capacity vector - sized once through init() or try_init(); push_back never reallocates This avo...
Minimal static vector - saves memory by avoiding std::vector overhead.
Base class for all binary_sensor-type classes.
Sends the states of local sensors and binary sensors over a packet interface, and publishes the state...
void receive_dictionary_(std::span< const uint8_t > packet, uint32_t dictionary_id)
void clear_remote_states_(bool timed_out_only)
void add_remote_binary_sensor(const char *provider, const char *remote_id, binary_sensor::BinarySensor *sensor)
void receive_data_(std::span< const uint8_t > packet, uint32_t dictionary_id)
FixedVector< LocalEntity > entities_
void forget_unnamed_(const char *provider, size_t provider_length, uint32_t dictionary_id, bool first_time)
Clears each remote entity of provider that its complete dictionary does not name, warning if the enti...
void add_remote_sensor(const char *provider, const char *remote_id, sensor::Sensor *sensor)
void learn_(const char *provider, size_t provider_length, uint8_t type, uint8_t number, const char *id, size_t id_length, uint32_t dictionary_id)
static constexpr size_t DROP_REASON_COUNT
uint32_t last_request_ms_
EntityTransport(packet_interface::PacketInterface *interface, uint8_t *buffer, size_t buffer_size)
StaticVector< RemoteEntity< sensor::Sensor >, ENTITY_TRANSPORT_REMOTE_SENSOR_COUNT > remote_sensors_
void set_entity_count(size_t count)
void add_sensor(const char *id, sensor::Sensor *sensor)
std::array< uint32_t, 8 > seen_dictionaries_
DropReason
The kinds of dropped packet, each warned about at most once a minute, so a steady stream of one kind ...
@ DROP_REASON_MALFORMED_DATA
@ DROP_REASON_FORMAT_VERSION
@ DROP_REASON_MALFORMED_DICTIONARY
uint32_t remote_timeout_ms_
uint32_t update_interval_ms_
bool flush_(size_t length, size_t first, size_t last)
size_t write_header_(uint8_t type) const
void request_dictionary_(uint32_t dictionary_id)
std::array< uint32_t, DROP_REASON_COUNT > last_warning_ms_
void on_session_(bool connected)
StaticVector< RemoteEntity< binary_sensor::BinarySensor >, ENTITY_TRANSPORT_REMOTE_BINARY_SENSOR_COUNT > remote_binary_sensors_
uint8_t binary_sensor_count_
packet_interface::PacketInterface * interface_
bool dictionary_seen_(uint32_t dictionary_id) const
void add_binary_sensor(const char *id, binary_sensor::BinarySensor *sensor)
void receive_(const packet_interface::PacketBuffer &data)
bool warning_due_(DropReason reason)
void set_remote_timeout(uint32_t timeout_ms)
Remote entities lose their state when none arrives for this long; 0 keeps the last state.
uint32_t refused_since_ms_
size_t write_record_(const LocalEntity &entity, uint8_t *record) const
void mark_updated_(LocalEntity &entity)
void set_update_interval(uint32_t interval_ms)
0 chooses the default for the interface's layers; SCHEDULER_DONT_RUN never resends.
uint32_t rx_dictionary_id_
void dump_config() override
A buffer class that efficiently represents a composite buffer with three sections:
A class that will transport data to and from an abstract channel.
Base-class for all sensors.