Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
Loading...
Searching...
No Matches
hub_hooks.h
Go to the documentation of this file.
1
#pragma once
2
3
/// @file hub_hooks.h
4
/// @brief Injected-capability callback aliases shared by the hub's collaborator objects.
5
/// @ingroup hioc_hub
6
///
7
/// Several hub collaborators need a *protected* hub capability — `Component::set_timeout()`
8
/// (protected in real ESPHome, only public in the host test stub),
9
/// `IOHomeControlComponent::transmit_frame_()`, `Component::warn_if_blocking_over_`. Rather than
10
/// granting `friend`, the hub injects a `std::function` for each, constructed as a lambda in its
11
/// own member-initializer list, which has the access. This header holds only those aliases so the
12
/// collaborator headers do not each redefine them. Dependency-light on purpose: it never includes
13
/// hub_core.h.
14
15
#include "
proto_frame.h
"
16
17
#include <cstdint>
18
#include <functional>
19
20
namespace
esphome
{
21
namespace
home_io_control
{
22
23
/// @brief Schedules a named, replace-on-same-name timeout on the hub's ESPHome scheduler.
24
/// @param name Timer name; a later call with the same name replaces the pending callback.
25
/// @param delay_ms Delay before the callback runs.
26
/// @param callback Work to run in loop() context after the delay.
27
using
NamedTimeoutFn
= std::function<void(
const
char
*name, uint32_t delay_ms, std::function<
void
()> callback)>;
28
29
/// @brief Puts a frame on air on a given channel via the hub's protected transmit_frame_().
30
/// @param frame Frame to serialize and transmit.
31
/// @param freq_hz RF channel frequency in Hz.
32
/// @param preamble Preamble length in bytes.
33
/// @return true if the frame reached the radio.
34
using
TransmitFrameFn
= std::function<bool(
const
IoFrame
&frame, uint32_t freq_hz, uint16_t preamble)>;
35
36
/// @brief Raises the hub's "operation took a long time" warning threshold for a blocking radio
37
/// excursion — writes `Component::warn_if_blocking_over_`, which is protected on ESPHome's
38
/// `Component`. Wired to a lambda in the hub's initializer list, which has protected access.
39
using
BeginBlockingExcursionFn
= std::function<void()>;
40
41
}
// namespace home_io_control
42
}
// namespace esphome
esphome::home_io_control
Definition
device_registry.cpp:13
esphome::home_io_control::TransmitFrameFn
std::function< bool(const IoFrame &frame, uint32_t freq_hz, uint16_t preamble)> TransmitFrameFn
Puts a frame on air on a given channel via the hub's protected transmit_frame_().
Definition
hub_hooks.h:34
esphome::home_io_control::NamedTimeoutFn
std::function< void(const char *name, uint32_t delay_ms, std::function< void()> callback)> NamedTimeoutFn
Schedules a named, replace-on-same-name timeout on the hub's ESPHome scheduler.
Definition
hub_hooks.h:27
esphome::home_io_control::BeginBlockingExcursionFn
std::function< void()> BeginBlockingExcursionFn
Raises the hub's "operation took a long time" warning threshold for a blocking radio excursion — writ...
Definition
hub_hooks.h:39
esphome
Definition
device_registry.cpp:12
proto_frame.h
IO-Homecontrol 2W frame container: control bytes, IoFrame and (de)serialization.
esphome::home_io_control::IoFrame
Parsed IO‑Homecontrol frame (CTRL0/1 + addresses + command + data).
Definition
proto_frame.h:93
components
home_io_control
hub_hooks.h
Generated by
1.18.0