|
Home IO Control
ESPHome add-on for IO-Homecontrol devices
|
Serialized pending-operation queue with coalescing, deduplication, and two-band ordering. More...
#include <operation_queue.h>
Public Member Functions | |
| bool | enqueue_set_position (const std::string &device_id, uint8_t position) |
| Enqueue SET_POSITION, or coalesce with a pending SET_TILT into SET_POSITION_AND_TILT. | |
| bool | enqueue_set_tilt (const std::string &device_id, uint8_t tilt_percent) |
| Enqueue SET_TILT, or coalesce with a pending SET_POSITION into SET_POSITION_AND_TILT. | |
| void | enqueue_set_position_and_tilt (const std::string &device_id, uint8_t position, uint8_t tilt_percent) |
| Enqueue SET_POSITION_AND_TILT directly (no coalescing needed). | |
| void | enqueue_device_command (const std::string &device_id, CoverCommand cmd) |
| void | enqueue_set_light_position (const std::string &device_id, uint8_t position) |
| Enqueue SET_LIGHT_STATE with an arbitrary IO position (0-100), for dimmable lights. | |
| void | enqueue_set_light_state (const std::string &device_id, bool on) |
| void | enqueue_set_lock_state (const std::string &device_id, bool locked) |
| void | enqueue_set_switch_state (const std::string &device_id, bool on) |
| bool | enqueue_request_status (const std::string &device_id) |
| Enqueue REQUEST_STATUS, suppressing duplicates. | |
| bool | enqueue_request_name (const std::string &device_id) |
| Enqueue REQUEST_NAME, suppressing duplicates. | |
| bool | enqueue_discover_and_pair () |
| Enqueue DISCOVER_AND_PAIR with elevated priority. | |
| std::optional< PendingOperation > | pop () |
| bool | empty () const |
| std::size_t | size () const |
| const PendingOperation & | front () const |
| const PendingOperation & | back () const |
| const PendingOperation & | operator[] (std::size_t index) const |
| std::deque< PendingOperation >::const_iterator | begin () const |
| std::deque< PendingOperation >::const_iterator | end () const |
Static Public Member Functions | |
| static bool | is_background_op (PendingOperationType t) |
| True for background poll types (REQUEST_STATUS, REQUEST_NAME) that yield to control operations. | |
Serialized pending-operation queue with coalescing, deduplication, and two-band ordering.
Ordering: DISCOVER_AND_PAIR > control operations > background polls. Control operations (SET_*, DEVICE_COMMAND) are inserted before any queued REQUEST_STATUS / REQUEST_NAME entries so user-visible commands execute with minimum queue latency. DISCOVER_AND_PAIR always front-inserts ahead of all other entries.
Stale-poll drop: enqueueing a control operation for device X drops any queued REQUEST_STATUS for X, since the command reply supersedes it and re-arms tracking.
Coalescing rules (both directions):
Deduplication rules:
All coalescing and deduplication log messages are suppressed here — callers are responsible for emitting them because OperationQueue must remain free of ESPHome logging dependencies.
Definition at line 71 of file operation_queue.h.
|
nodiscard |
Definition at line 134 of file operation_queue.cpp.
|
nodiscard |
Definition at line 138 of file operation_queue.cpp.
|
nodiscard |
Definition at line 128 of file operation_queue.cpp.
|
nodiscard |
Definition at line 140 of file operation_queue.cpp.
| void esphome::home_io_control::OperationQueue::enqueue_device_command | ( | const std::string & | device_id, |
| CoverCommand | cmd ) |
Definition at line 61 of file operation_queue.cpp.
| bool esphome::home_io_control::OperationQueue::enqueue_discover_and_pair | ( | ) |
Enqueue DISCOVER_AND_PAIR with elevated priority.
Flushes pending REQUEST_STATUS / REQUEST_NAME entries and pushes to front.
Definition at line 105 of file operation_queue.cpp.
| bool esphome::home_io_control::OperationQueue::enqueue_request_name | ( | const std::string & | device_id | ) |
Enqueue REQUEST_NAME, suppressing duplicates.
Definition at line 96 of file operation_queue.cpp.
| bool esphome::home_io_control::OperationQueue::enqueue_request_status | ( | const std::string & | device_id | ) |
Enqueue REQUEST_STATUS, suppressing duplicates.
Definition at line 87 of file operation_queue.cpp.
| void esphome::home_io_control::OperationQueue::enqueue_set_light_position | ( | const std::string & | device_id, |
| uint8_t | position ) |
Enqueue SET_LIGHT_STATE with an arbitrary IO position (0-100), for dimmable lights.
enqueue_set_light_state() is a thin binary-position wrapper around this.
Definition at line 69 of file operation_queue.cpp.
| void esphome::home_io_control::OperationQueue::enqueue_set_light_state | ( | const std::string & | device_id, |
| bool | on ) |
| void esphome::home_io_control::OperationQueue::enqueue_set_lock_state | ( | const std::string & | device_id, |
| bool | locked ) |
Definition at line 77 of file operation_queue.cpp.
| bool esphome::home_io_control::OperationQueue::enqueue_set_position | ( | const std::string & | device_id, |
| uint8_t | position ) |
Enqueue SET_POSITION, or coalesce with a pending SET_TILT into SET_POSITION_AND_TILT.
Definition at line 28 of file operation_queue.cpp.
| void esphome::home_io_control::OperationQueue::enqueue_set_position_and_tilt | ( | const std::string & | device_id, |
| uint8_t | position, | ||
| uint8_t | tilt_percent ) |
Enqueue SET_POSITION_AND_TILT directly (no coalescing needed).
Definition at line 56 of file operation_queue.cpp.
| void esphome::home_io_control::OperationQueue::enqueue_set_switch_state | ( | const std::string & | device_id, |
| bool | on ) |
Definition at line 82 of file operation_queue.cpp.
| bool esphome::home_io_control::OperationQueue::enqueue_set_tilt | ( | const std::string & | device_id, |
| uint8_t | tilt_percent ) |
Enqueue SET_TILT, or coalesce with a pending SET_POSITION into SET_POSITION_AND_TILT.
Definition at line 43 of file operation_queue.cpp.
|
nodiscard |
Definition at line 132 of file operation_queue.cpp.
|
staticnodiscard |
True for background poll types (REQUEST_STATUS, REQUEST_NAME) that yield to control operations.
Public because the dispatch gate in loop() defers only background work when a 1W remote is transmitting; a user command must never be held back for it.
Definition at line 12 of file operation_queue.cpp.
|
nodiscard |
Definition at line 136 of file operation_queue.cpp.
|
nodiscard |
Definition at line 120 of file operation_queue.cpp.
|
nodiscard |
Definition at line 130 of file operation_queue.cpp.