58 void add(
const std::string &device_id);
73 void put(
const std::string &device_id,
IoDevice device);
77 [[nodiscard]]
IoDevice *
get(
const std::string &device_id);
105 void notify(
const std::string &device_id);
111 void add_linked_remote(
const std::string &remote_id,
const std::string &device_id);
115 [[nodiscard]]
const std::vector<std::string> *
linked_devices(
const std::string &remote_id)
const;
200 [[nodiscard]]
size_t size()
const {
return devices_.size(); }
208 const std::function<
void(
const std::string &,
const std::vector<std::string> &)> &fn)
const;
211 std::map<std::string, IoDevice>::iterator
begin() {
return devices_.begin(); }
213 std::map<std::string, IoDevice>::iterator
end() {
return devices_.end(); }
216 std::map<std::string, IoDevice> devices_;
217 std::vector<DeviceUpdateCallback> callbacks_;
218 std::map<std::string, std::vector<std::string>> linked_remotes_;
219 std::map<DeviceType, std::vector<std::string>> linked_remote_classes_;
Owns the per-hub device table, update callbacks, and linked-remote associations.
const std::vector< std::string > * linked_devices(const std::string &remote_id) const
Retrieve the list of device IDs linked to a remote.
std::map< std::string, IoDevice >::iterator end()
Mutable end iterator over (device_id, IoDevice) pairs.
bool rollback_optimistic(const std::string &device_id, bool failed_stop=false)
Withdraw every prediction for a device after the command that produced them failed,...
bool apply_optimistic_tilt(const std::string &device_id, float tilt_percent)
Set an optimistic slat angle ahead of a confirming poll, and notify.
IoDevice * get_declared(const std::string &device_id)
Retrieve a device the YAML declares, ignoring one a pairing added in this boot.
const std::vector< std::string > * linked_devices_for_class(DeviceType type) const
Retrieve the list of device IDs linked to a device class.
bool remove_registered_by_pairing(const std::string &device_id)
Remove a device a pairing added in this boot.
void add_linked_remote_class(DeviceType type, const std::string &device_id)
Record that a remote's typed-broadcast presses (e.g.
size_t linked_remote_count() const
void put(const std::string &device_id, IoDevice device)
Insert or overwrite a device entry without deduplication or hex-validation checks.
std::map< std::string, IoDevice >::iterator begin()
Mutable begin iterator over (device_id, IoDevice) pairs (supports range-for in the poll loop).
bool apply_optimistic_target(const std::string &device_id, float target_io_position)
Set an optimistic target position ahead of a confirming poll/response, and notify.
std::vector< std::string > all_linked_devices() const
Every device with a linked_remotes entry, by remote id or by class:, once each, sorted.
void notify(const std::string &device_id)
Invoke all registered callbacks for device_id.
bool apply_optimistic_stop(const std::string &device_id, bool restorable=false)
Predict that a device has stopped (e.g.
void add_linked_remote(const std::string &remote_id, const std::string &device_id)
Record that a remote node controls a registered device.
void subscribe(DeviceUpdateCallback cb)
Register a callback that fires whenever a device's state changes.
IoDevice * get(const std::string &device_id)
Retrieve a registered device by ID.
void confirm_optimistic_stop(const std::string &device_id)
Mark a device's STOP as delivered: a later rollback must not restore the movement it replaced.
void for_each_linked_remote(const std::function< void(const std::string &, const std::vector< std::string > &)> &fn) const
Invoke fn(remote_id, device_id_list) for every linked-remote entry.
void add(const std::string &device_id)
Register a device by ID with default metadata (UNKNOWN type, subtype 0, no overrides).
void set_travel_speed(const std::string &device_id, TravelSpeed speed)
Select a device's travel speed.
std::function< void(const std::string &device_id, const IoDevice &device)> DeviceUpdateCallback
Callback type invoked when a device's state changes.
DeviceModel
A product model below a (node type, subtype): for products that report the same wire type but need di...
@ NONE
No model: the (type, subtype) row.
DeviceType
IO-Homecontrol node types.
@ UNKNOWN
Unknown/unspecified device.
DeviceCapabilityClass
High‑level capability class derived from DeviceType.
@ UNKNOWN
Unknown capability.
TravelSpeed
The speed a cover's position moves ask the motor for (ADR 0065).
@ FAST
Profile 0x06, what the hub sends unless a cover says otherwise.
IO-Homecontrol device-type model, capabilities and runtime device state.
YAML-declared device metadata for registration; defaults match an undeclared device.
bool optimistic_state
Whether apply_optimistic_target/apply_optimistic_stop may fire.
bool has_system_key
system_key: declared: the device keeps a key of its own.
DeviceModel model
YAML io_model:; NONE when not declared.
DeviceCapabilityClass entity_class
Class of the declaring entity; decides the features of a kind the type table does not know.
bool low_power
Target is a low-power / duty-cycled receiver: directed frames set CTRL1_LOW_POWER and use the long wa...
bool dimmable
YAML dimmable: true of a light.
uint8_t system_key[AES_KEY_SIZE]
That key; meaningful only when has_system_key. Never logged.
std::optional< bool > invert_override
YAML invert_position: when declared; the kind's default otherwise.
bool battery_entities
battery: true declared: the battery entities exist for this device.
uint8_t subtype
Device subtype byte.
TravelSpeed travel_speed
Speed profile of position moves.
DeviceType type
Device type from YAML declaration.
Runtime state of a paired IO‑Homecontrol device.