Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
transmit_observer.h
Go to the documentation of this file.
1#pragma once
2
3/// @file transmit_observer.h
4/// @brief Observer interface for every frame the exchange engine puts on air.
5/// @ingroup hioc_hub
6///
7/// ExchangeEngine::transmit_frame() is the single TX choke point of the hub: 2W exchanges,
8/// pairing, and 1W bursts all transmit through it. A TransmitObserver attached to the engine sees
9/// each listen-before-talk deferral and each frame the radio accepted, without the engine knowing
10/// who is listening or why. PairingTelemetry is the observer during a pairing attempt.
11
12#include "proto_frame.h"
13#include "radio_interface.h"
14
15#include <cstdint>
16
17namespace esphome {
18namespace home_io_control {
19
20/// @brief Receives transmit events from ExchangeEngine::transmit_frame().
21///
22/// Both callbacks default to no-ops, so an observer overrides only what it records. They run
23/// synchronously inside transmit_frame(), on the main loop: keep them cheap and never transmit
24/// from one.
26 public:
27 virtual ~TransmitObserver() = default;
28
29 /// The channel was busy, so transmit_frame() backs off once before trying again.
30 /// @param rssi_dbm The RSSI reading that deferred the transmit.
31 virtual void on_lbt_defer(int16_t rssi_dbm) {}
32
33 /// The radio accepted a frame for transmission (send_packet() returned true). Not called when
34 /// serialization or send_packet() fails.
35 /// @param frame The logical frame that was sent.
36 /// @param config The TX shape it was sent with (frequency, preamble length).
37 /// @param wire_len Serialized length in bytes as handed to the radio.
38 virtual void on_transmit(const IoFrame &frame, const RadioTxConfig &config, uint8_t wire_len) {}
39};
40
41} // namespace home_io_control
42} // namespace esphome
Receives transmit events from ExchangeEngine::transmit_frame().
virtual void on_lbt_defer(int16_t rssi_dbm)
The channel was busy, so transmit_frame() backs off once before trying again.
virtual void on_transmit(const IoFrame &frame, const RadioTxConfig &config, uint8_t wire_len)
The radio accepted a frame for transmission (send_packet() returned true).
IO-Homecontrol 2W frame container: control bytes, IoFrame and (de)serialization.
Radio abstraction layer for IO-Homecontrol.
Parsed IO‑Homecontrol frame (CTRL0/1 + addresses + command + data).
Definition proto_frame.h:93
Configuration for transmitting a packet: carrier frequency and preamble length.