|
Home IO Control
ESPHome add-on for IO-Homecontrol devices
|
The main IO-Homecontrol component. More...
#include <hub_core.h>
Classes | |
| struct | PendingOperation |
| A single queued operation to be processed in loop(). More... | |
| struct | ExchangeDebugInfo |
| Debug snapshot of the last exchange attempt. More... | |
Public Member Functions | |
| void | setup () override |
| Initialize hardware (radio and device registry). | |
| void | loop () override |
| Main loop: process pending operations and drive radio state machine. | |
| void | dump_config () override |
| Dump configuration and radio debug info to the log. | |
| float | get_setup_priority () const override |
| Get setup priority (HARDWARE to initialize early). | |
| void | spi_enable () override |
| Enable the SPI bus. | |
| void | spi_disable () override |
| Disable the SPI bus. | |
| uint8_t | spi_transfer (uint8_t data) override |
| Transfer one byte full‑duplex. | |
| void | spi_write (uint8_t data) override |
| Write one byte (MOSI only). | |
| uint8_t | spi_read () override |
| Read one byte (MISO only). | |
| void | set_rst_pin (InternalGPIOPin *pin) |
| Set the radio reset pin. | |
| void | set_dio0_pin (InternalGPIOPin *pin) |
| Set the DIO0 interrupt pin (SX1276). | |
| void | set_dio4_pin (InternalGPIOPin *pin) |
| Set the DIO4 preamble‑detect pin (SX1276, optional). | |
| void | set_dio1_pin (InternalGPIOPin *pin) |
| Set the DIO1 interrupt pin (SX1262). | |
| void | set_busy_pin (InternalGPIOPin *pin) |
| Set the BUSY pin (SX1262). | |
| void | set_fem_en_pin (InternalGPIOPin *pin) |
| Set the front‑end module enable pin. | |
| void | set_vfem_pin (InternalGPIOPin *pin) |
| Set the VFEM power pin. | |
| void | set_fem_pa_pin (InternalGPIOPin *pin) |
| Set the FEM PA switch pin. | |
| void | set_node_id (const std::string &id) |
| Set the controller's node ID (hex string). | |
| void | set_system_key (const std::string &key) |
| Set the system key (hex string). | |
| void | set_tx_power (uint8_t power) |
| Set transmit power (dBm). | |
| void | set_pa_pin (uint8_t pa_pin) |
| Set PA boost pin configuration. | |
| void | set_radio_type (const std::string &type) |
| Set radio type ("sx1276" or "sx1262"); empty string means auto‑detect. | |
| void | set_tcxo_voltage (uint8_t voltage) |
| Set TCXO voltage for SX1262 (1.8V / 3.3V). | |
| void | add_linked_remote (const std::string &remote_id, const std::string &device_id) |
| Declare that a remote (identified by its node ID) controls a registered device. | |
| virtual void | add_device (const std::string &device_id) |
| Add a device to the registry by device ID only (legacy/delegating overload). | |
| virtual void | add_device (const std::string &device_id, DeviceType type, uint8_t subtype, bool inverted) |
| Add a device to the registry with full metadata from YAML. | |
| virtual IoDevice * | get_device (const std::string &device_id) |
| Retrieve a device by ID; returns nullptr if not found. | |
| virtual void | register_device_callback (DeviceUpdateCallback cb) |
| Register a callback invoked when any device updates. | |
| virtual void | set_device_status_poll_interval (const std::string &device_id, uint32_t poll_interval_ms) |
| Configure the optional follow-up polling interval for a registered device. | |
| virtual bool | set_device_position (const std::string &device_id, uint8_t position) |
| Send a position command to a device. | |
| virtual bool | set_device_tilt (const std::string &device_id, uint8_t tilt_percent) |
| Send a tilt command to a tilt‑capable cover. | |
| virtual bool | request_device_status (const std::string &device_id) |
| Request current status from a device. | |
| virtual bool | discover_and_pair () |
| Discover and pair a device that is in pairing mode. | |
| virtual bool | set_light_state (const std::string &device_id, bool on) |
| Semantic binary helper for light entities. | |
| virtual bool | set_switch_state (const std::string &device_id, bool on) |
| Semantic binary helper for switch entities. | |
| virtual void | queue_set_device_position (const std::string &device_id, uint8_t position) |
| Queue an async position update; returns immediately, executed in loop(). | |
| virtual void | queue_set_device_tilt (const std::string &device_id, uint8_t tilt_percent) |
| Queue an async tilt update; returns immediately, executed in loop(). | |
| virtual void | queue_request_device_status (const std::string &device_id) |
| Queue an async status request; returns immediately, executed in loop(). | |
| virtual void | queue_discover_and_pair () |
| Queue a pairing operation; executed in loop() when radio idle. | |
| virtual void | queue_set_light_state (const std::string &device_id, bool on) |
| Async form of set_light_state() that keeps radio work serialized on the main loop. | |
| virtual void | queue_set_switch_state (const std::string &device_id, bool on) |
| Async form of set_switch_state() that keeps radio work serialized on the main loop. | |
| Public Member Functions inherited from esphome::home_io_control::SpiAccess | |
| virtual | ~SpiAccess ()=default |
Protected Types | |
| enum class | PendingOperationType : uint8_t { SET_POSITION , SET_TILT , SET_LIGHT_STATE , SET_SWITCH_STATE , REQUEST_STATUS , DISCOVER_AND_PAIR } |
| Type of queued pending operation for the main loop. More... | |
Protected Member Functions | |
| bool | transmit_frame_ (const IoFrame &frame, uint32_t freq, uint16_t preamble) |
| Transmit a raw IoFrame on the current frequency with given preamble length. | |
| bool | send_and_receive_ (const IoFrame &request, IoFrame &response, uint32_t freq) |
| Main request/response exchange with retry and automatic authentication. | |
| bool | authenticate_request_ (const IoFrame &request, uint32_t freq) |
| Handle an inbound authenticated command from a device (status updates, etc.). | |
| void | process_received_packet_ (const RadioRxPacket &packet) |
| Parse received packet, update device state if it's a status frame, and notify covers. | |
| void | update_device_status_ (const IoFrame &frame) |
| Extract position/status info from a status or status-update frame and merge into device record. | |
| void | schedule_status_poll_ (const std::string &device_id, uint32_t delay_ms) |
| Schedule a delayed status poll for a registered device using the Component timeout API. | |
| void | begin_status_poll_tracking_ (const std::string &device_id, uint32_t initial_delay_ms) |
| Begin bounded follow-up polling for a device after a command or overheard remote activity. | |
| bool | execute_request_and_update_ (const std::string &device_id, const IoFrame &request, bool warn_on_no_response, uint32_t retry_after_fail_ms=0) |
| Shared request/response helper for high-level operations. | |
| void | notify_device_update_ (const std::string &id) |
| Fire all registered device update callbacks for the given device ID. | |
| void | process_pending_operation_ () |
| Pop next pending operation from the queue and execute it (set position, request status, discover). | |
| bool | transmit_request_ (const IoFrame &request, uint32_t freq, uint16_t preamble, exchange::OutboundExchangeContext &ctx) |
| Wrap transmit_frame_ and mark context failed on error. | |
| decisions::ExchangeFirstResponseDisposition | wait_for_first_response_ (const IoFrame &request, exchange::OutboundExchangeContext &ctx) |
| Wait loop for the first response packet; classifies via decisions::classify_exchange_first_response. | |
| bool | handle_authentication_ (const IoFrame &request, uint32_t freq, exchange::OutboundExchangeContext &ctx) |
| Perform challenge-response (TX auth response) after a 0x3C is received. | |
| decisions::ExchangeFinalResponseDisposition | wait_for_final_response_ (const IoFrame &request, exchange::OutboundExchangeContext &ctx) |
| Wait loop for the final authenticated response; uses is_valid_final_response(). | |
| decisions::PairingDiscoveryDisposition | wait_for_discovery_response_ (uint32_t timeout_ms, RadioRxPacket &packet, IoFrame &response_frame) |
| Wait for a discovery response (0x29) during pairing. | |
| bool | wait_for_key_challenge_ (uint32_t timeout_ms, RadioRxPacket &packet, IoFrame &challenge_frame, const uint8_t device_node_id[NODE_ID_SIZE]) |
| Wait for a key-challenge (0x3C) from target device during pairing key exchange. | |
| decisions::PairingDiscoveryDisposition | run_discovery_phase_ (pairing::PairingContext &context) |
| Phase 1: broadcast discovery (0x28) and wait for a device response (0x29). | |
| bool | run_key_exchange_phase_ (pairing::PairingContext &context) |
| Phase 2: authenticated key exchange (0x31 → 0x3C → 0x32 → 0x33). | |
| bool | finalize_pairing_configuration_ (pairing::PairingContext &context) |
| Phase 3: send SetConfig1 (0x6F) to finalize device configuration. | |
| void | reset_exchange_debug_ (uint8_t request_cmd) |
| void | record_exchange_debug_ (const char *stage, uint8_t tries, bool saw_challenge) |
| void | log_exchange_debug_ (const char *device_id) const |
| void | hop_frequency_ () |
| Hop to the next channel in the 3‑channel sequence: CH1 → CH2 → CH3 → CH1. | |
Static Protected Member Functions | |
| static void | parse_device_from_discovery (const IoFrame &frame, IoDevice &device, std::string &device_id) |
| Parse a discovery response frame into device metadata and ID. | |
Protected Attributes | |
| RadioDriver * | radio_ {nullptr} |
| InternalGPIOPin * | rst_pin_ {nullptr} |
| InternalGPIOPin * | dio0_pin_ {nullptr} |
| SX1276 DIO0 interrupt. | |
| InternalGPIOPin * | dio4_pin_ {nullptr} |
| SX1276 DIO4 preamble detect (optional). | |
| InternalGPIOPin * | dio1_pin_ {nullptr} |
| SX1262 DIO1 interrupt. | |
| InternalGPIOPin * | busy_pin_ {nullptr} |
| SX1262 BUSY pin. | |
| InternalGPIOPin * | fem_en_pin_ {nullptr} |
| Front-end module enable. | |
| InternalGPIOPin * | vfem_pin_ {nullptr} |
| Front-end module power. | |
| InternalGPIOPin * | fem_pa_pin_ {nullptr} |
| Front-end module PA switch. | |
| std::string | node_id_str_ |
| std::string | system_key_str_ |
| std::string | radio_type_ |
| "sx1276", "sx1262", or "" (auto-detect) | |
| uint8_t | node_id_ [NODE_ID_SIZE] {} |
| uint8_t | system_key_ [AES_KEY_SIZE] {} |
| uint8_t | tx_power_ {DEFAULT_TX_POWER_DBM} |
| uint8_t | pa_pin_ {DEFAULT_PA_PIN_PA_BOOST} |
| uint8_t | tcxo_voltage_ {DEFAULT_TCXO_VOLTAGE_SETTING_1P8V} |
| SX1262 TCXO voltage setting (default 1.8 V). | |
| bool | initialized_ {false} |
| bool | busy_ {false} |
| uint32_t | last_hop_us_ {0} |
| ExchangeDebugInfo | last_exchange_debug_ {} |
| std::map< std::string, IoDevice > | devices_ |
| std::vector< DeviceUpdateCallback > | callbacks_ |
| std::deque< PendingOperation > | pending_operations_ |
| std::map< std::string, std::vector< std::string > > | linked_remotes_ |
| Maps remote node IDs to lists of device IDs they control. | |
The main IO-Homecontrol component.
Manages the protocol layer and delegates radio operations to a RadioDriver instance.
Inherits SPIDevice so that ESPHome's Python codegen can configure SPI pins. Implements SpiAccess to provide the radio driver with SPI bus access.
Definition at line 57 of file hub_core.h.
|
strongprotected |
Type of queued pending operation for the main loop.
Definition at line 315 of file hub_core.h.
|
virtual |
Add a device to the registry by device ID only (legacy/delegating overload).
Type, subtype, and inverted default to UNKNOWN / 0 / false; use the 4-arg overload when type/subtype/inverted come from YAML declarations.
| device_id | Hexadecimal node ID string. |
Definition at line 237 of file hub_core.cpp.
|
virtual |
Add a device to the registry with full metadata from YAML.
| device_id | Hexadecimal node ID string. |
| type | Device type from YAML declaration (UNKNOWN if not specified). |
| subtype | Device subtype from YAML declaration. |
| inverted | Position inversion flag from YAML declaration. |
Definition at line 241 of file hub_core.cpp.
|
inline |
Declare that a remote (identified by its node ID) controls a registered device.
When activity from this remote is overheard, a status poll is scheduled for the device. This is needed for 1W remotes whose destination address differs from the device's 2W ID.
| remote_id | Node ID of the remote control. |
| device_id | Node ID of the device it controls. |
Definition at line 123 of file hub_core.h.
|
protected |
Handle an inbound authenticated command from a device (status updates, etc.).
| request | Inbound authenticated request (e.g., CMD_STATUS_UPDATE). |
| freq | RF frequency the packet arrived on. |
Definition at line 331 of file hub_exchange.cpp.
|
protected |
Begin bounded follow-up polling for a device after a command or overheard remote activity.
| device_id | ID of the device to poll. |
| initial_delay_ms | Delay before the first follow-up poll. |
Definition at line 153 of file hub_status.cpp.
|
virtual |
Discover and pair a device that is in pairing mode.
Pairing orchestrator — high‑level three‑phase flow.
Phase 1: Discovery (run_discovery_phase_) finds a device in pairing mode. Phase 2: Key exchange (run_key_exchange_phase_) performs authenticated key establishment using the challenge‑response protocol. Phase 3: Finalization (finalize_pairing_configuration_) sends SetConfig1.
On success the device is added to the current runtime registry and either a valid YAML snippet or a follow-up guidance message is printed in the logs. Any phase failure aborts early, logging an appropriate warning.
Definition at line 346 of file hub_pairing.cpp.
|
override |
Dump configuration and radio debug info to the log.
Definition at line 305 of file hub_core.cpp.
|
protected |
Shared request/response helper for high-level operations.
| device_id | Target device ID. |
| request | Outbound request frame. |
| warn_on_no_response | If true, logs a warning when no response is received. |
| retry_after_fail_ms | If non-zero, schedules next status poll after this delay on failure. |
Definition at line 58 of file hub_operations.cpp.
|
protected |
Phase 3: send SetConfig1 (0x6F) to finalize device configuration.
Execute Phase 3: finalize pairing configuration on the device.
| context | Pairing context with device information. |
Sends a SetConfig1 command (0x6F) using the authenticated exchange path. This step is optional in the sense that the command may be skipped if create_set_config1() returns false, but the pairing itself is already complete at this point. The function always returns true to avoid aborting a successfully paired device.
Definition at line 328 of file hub_pairing.cpp.
|
virtual |
Retrieve a device by ID; returns nullptr if not found.
| device_id | Hexadecimal node ID. |
Definition at line 256 of file hub_core.cpp.
|
inlinenodiscardoverride |
Get setup priority (HARDWARE to initialize early).
Definition at line 70 of file hub_core.h.
|
protected |
Perform challenge-response (TX auth response) after a 0x3C is received.
Handle device authentication challenge (0x3C → 0x3D exchange).
| request | Original request frame (needed for HMAC derivation). |
| freq | RF channel frequency (same channel used for the request). |
| ctx | Exchange context holding the challenge frame and state. |
When the first response is a challenge request (0x3C), this helper builds the HMAC challenge response using create_challenge_resp() and transmits it with the SX1262‑specific longer preamble. The exchange context is updated with the BUILD_AUTH_RESPONSE and TX_AUTH_RESPONSE states.
Definition at line 268 of file hub_exchange.cpp.
|
protected |
Hop to the next channel in the 3‑channel sequence: CH1 → CH2 → CH3 → CH1.
Called periodically by the main loop when idle to maintain synchronization with the protocol's ~2.7 ms hopping schedule. Devices also hop, so the controller must hop even while waiting for a response; the next transmit will use whatever channel is current.
Definition at line 169 of file hub_core.cpp.
|
protected |
Definition at line 58 of file hub_core.cpp.
|
override |
Main loop: process pending operations and drive radio state machine.
Definition at line 263 of file hub_core.cpp.
|
protected |
Fire all registered device update callbacks for the given device ID.
| id | Device ID that updated. |
Definition at line 220 of file hub_core.cpp.
|
staticprotected |
Parse a discovery response frame into device metadata and ID.
| frame | Parsed discovery response. |
| device | Output: populated IoDevice (node_id, type, subtype, inverted, position/target/stopped). |
| device_id | Output: hex string representation of node ID. |
Extracts node ID, device type, and subtype from a CMD_DISCOVER_RESP frame. The two-byte payload uses the shared packed device metadata layout defined in proto_frame.h. The inversion flag is derived from the type via default_inverted_for_type().
Definition at line 236 of file hub_pairing.cpp.
|
protected |
Pop next pending operation from the queue and execute it (set position, request status, discover).
Definition at line 302 of file hub_operations.cpp.
|
protected |
Parse received packet, update device state if it's a status frame, and notify covers.
| packet | Raw radio packet containing a parsed IoFrame. |
Definition at line 231 of file hub_status.cpp.
|
virtual |
Queue a pairing operation; executed in loop() when radio idle.
Definition at line 266 of file hub_operations.cpp.
|
virtual |
Queue an async status request; returns immediately, executed in loop().
| device_id | Target device ID. |
Definition at line 249 of file hub_operations.cpp.
|
virtual |
Queue an async position update; returns immediately, executed in loop().
| device_id | Target device ID. |
| position | Desired position. |
Definition at line 231 of file hub_operations.cpp.
|
virtual |
Queue an async tilt update; returns immediately, executed in loop().
| device_id | Target device ID. |
| tilt_percent | Desired tilt. |
Definition at line 240 of file hub_operations.cpp.
|
virtual |
Async form of set_light_state() that keeps radio work serialized on the main loop.
| device_id | Target device ID. |
| on | Desired on/off state. |
Definition at line 276 of file hub_operations.cpp.
|
virtual |
Async form of set_switch_state() that keeps radio work serialized on the main loop.
| device_id | Target device ID. |
| on | Desired on/off state. |
Definition at line 289 of file hub_operations.cpp.
|
protected |
Definition at line 41 of file hub_core.cpp.
|
inlinevirtual |
Register a callback invoked when any device updates.
| cb | Callable with signature void(const std::string&, const IoDevice&). |
Definition at line 145 of file hub_core.h.
|
virtual |
Request current status from a device.
| device_id | Target device ID. |
Definition at line 177 of file hub_operations.cpp.
|
protected |
Definition at line 36 of file hub_core.cpp.
|
protected |
Phase 1: broadcast discovery (0x28) and wait for a device response (0x29).
Execute Phase 1: discover a pairable device on channel 2.
| context | Pairing context modified on success. |
Transmits a discovery broadcast (0x28) and waits up to the configured discovery timeout for a valid discovery response (0x29). On success the response is parsed into context.device and context.device_id and the function returns ACCEPT. On failure returns NO_RESPONSE (no packets) or INVALID (packets seen but none were valid discovery frames).
Definition at line 261 of file hub_pairing.cpp.
|
protected |
Phase 2: authenticated key exchange (0x31 → 0x3C → 0x32 → 0x33).
Execute Phase 2: perform authenticated key exchange with the discovered device.
| context | Pairing context populated by run_discovery_phase_(). |
Performs the full four‑step key exchange:
Each step updates the pairing state for observability. Any failure returns false immediately; the orchestrator will clean up and abort pairing.
Definition at line 290 of file hub_pairing.cpp.
|
protected |
Schedule a delayed status poll for a registered device using the Component timeout API.
| device_id | ID of the device to poll. |
| delay_ms | Delay in milliseconds before polling. |
Definition at line 165 of file hub_status.cpp.
|
protected |
Main request/response exchange with retry and automatic authentication.
| request | Outbound request IoFrame. |
| response | Output: received response IoFrame. |
| freq | RF frequency in Hz. |
Definition at line 143 of file hub_exchange.cpp.
|
inline |
Set the BUSY pin (SX1262).
Definition at line 98 of file hub_core.h.
|
virtual |
Send a position command to a device.
| device_id | Target device ID. |
| position | Desired position (0–100, or POS_STOP/POS_FAVORITE). |
Definition at line 95 of file hub_operations.cpp.
|
virtual |
Configure the optional follow-up polling interval for a registered device.
| device_id | Target device ID. |
| poll_interval_ms | Poll interval in milliseconds; zero keeps the legacy one-shot settle poll only. |
Definition at line 230 of file hub_core.cpp.
|
virtual |
Send a tilt command to a tilt‑capable cover.
| device_id | Target device ID. |
| tilt_percent | Desired tilt (0–100). |
Definition at line 146 of file hub_operations.cpp.
|
inline |
Set the DIO0 interrupt pin (SX1276).
Definition at line 92 of file hub_core.h.
|
inline |
Set the DIO1 interrupt pin (SX1262).
Definition at line 96 of file hub_core.h.
|
inline |
Set the DIO4 preamble‑detect pin (SX1276, optional).
Definition at line 94 of file hub_core.h.
|
inline |
Set the front‑end module enable pin.
Definition at line 100 of file hub_core.h.
|
inline |
Set the FEM PA switch pin.
Definition at line 104 of file hub_core.h.
|
virtual |
Semantic binary helper for light entities.
Internally mapped to the shared execute path.
| device_id | Target device ID. |
| on | Desired on/off state. |
Definition at line 200 of file hub_operations.cpp.
|
inline |
Set the controller's node ID (hex string).
Definition at line 106 of file hub_core.h.
|
inline |
Set PA boost pin configuration.
Definition at line 112 of file hub_core.h.
|
inline |
Set radio type ("sx1276" or "sx1262"); empty string means auto‑detect.
Definition at line 114 of file hub_core.h.
|
inline |
Set the radio reset pin.
Definition at line 90 of file hub_core.h.
|
virtual |
Semantic binary helper for switch entities.
Internally mapped to the shared execute path.
| device_id | Target device ID. |
| on | Desired on/off state. |
Definition at line 216 of file hub_operations.cpp.
|
inline |
Set the system key (hex string).
Definition at line 108 of file hub_core.h.
|
inline |
Set TCXO voltage for SX1262 (1.8V / 3.3V).
Definition at line 116 of file hub_core.h.
|
inline |
Set transmit power (dBm).
Definition at line 110 of file hub_core.h.
|
inline |
Set the VFEM power pin.
Definition at line 102 of file hub_core.h.
|
override |
Initialize hardware (radio and device registry).
Initialize the IO‑Homecontrol component and radio hardware.
This is the main setup entry point called by ESPHome during startup. The sequence:
Definition at line 87 of file hub_core.cpp.
|
inlineoverridevirtual |
Disable the SPI bus.
Implements esphome::home_io_control::SpiAccess.
Definition at line 76 of file hub_core.h.
|
inlineoverridevirtual |
Enable the SPI bus.
Implements esphome::home_io_control::SpiAccess.
Definition at line 74 of file hub_core.h.
|
inlineoverridevirtual |
Read one byte (MISO only).
Implements esphome::home_io_control::SpiAccess.
Definition at line 86 of file hub_core.h.
|
inlineoverridevirtual |
Transfer one byte full‑duplex.
| data | Byte to send. |
Implements esphome::home_io_control::SpiAccess.
Definition at line 80 of file hub_core.h.
|
inlineoverridevirtual |
Write one byte (MOSI only).
| data | Byte to send. |
Implements esphome::home_io_control::SpiAccess.
Definition at line 83 of file hub_core.h.
|
protected |
Transmit a raw IoFrame on the current frequency with given preamble length.
| frame | IoFrame to transmit. |
| freq | RF frequency in Hz. |
| preamble | Preamble length in bytes (LONG_PREAMBLE or SHORT_PREAMBLE). |
Definition at line 194 of file hub_core.cpp.
|
protected |
Wrap transmit_frame_ and mark context failed on error.
Transmit the initial request frame and update exchange context on failure.
| request | Outbound IoFrame to transmit. |
| freq | RF frequency in Hz. |
| preamble | Preamble length in bytes. |
| ctx | Exchange context (state updated on failure). |
This helper isolates the one-shot TX operation from the retry loop. It does NOT implement retries itself — the orchestrator (send_and_receive_) calls this repeatedly until success or retry exhaustion. On failure we mark the context state as FAILED and record debug info; success returns true.
Definition at line 213 of file hub_exchange.cpp.
|
protected |
Extract position/status info from a status or status-update frame and merge into device record.
| frame | IoFrame containing a status-bearing command (CMD_PRIVATE_RESP or CMD_STATUS_UPDATE). |
Definition at line 173 of file hub_status.cpp.
|
protected |
Wait for a discovery response (0x29) during pairing.
Wait for a valid discovery response (0x29) within the timeout.
| timeout_ms | Maximum time to wait in milliseconds. |
| packet | Output: raw RadioRxPacket of the accepted frame. |
| response_frame | Output: parsed IoFrame of the accepted frame. |
Listens for incoming packets and parses them. Frames that parse successfully are passed to decisions::classify_pairing_discovery_response(). Only a frame classified as ACCEPT (CMD_DISCOVER_RESP) returns true. All other frames are ignored until the deadline expires.
The function distinguishes between NO_RESPONSE (no packets seen at all) and INVALID (some packets seen but none were valid discovery responses).
Definition at line 181 of file hub_pairing.cpp.
|
protected |
Wait loop for the final authenticated response; uses is_valid_final_response().
Wait for the final (authenticated) response after challenge has been answered.
| request | Original request frame (used for endpoint matching). |
| ctx | Exchange context (receives final rx frame on accept). |
After sending the 0x3D challenge response, the device will reply with the actual command response (e.g. 0x04 status) signed using the shared system key. This helper loops within RESPONSE_AUTH_WAIT_MS, hopping channels on each slice, parsing and validating that the frame matches the original request endpoints. Non‑matching frames are logged and ignored.
Definition at line 302 of file hub_exchange.cpp.
|
protected |
Wait loop for the first response packet; classifies via decisions::classify_exchange_first_response.
Wait for the first response packet within the configured timeout window.
| request | Original request frame (used for endpoint matching). |
| ctx | Exchange context (provides deadline and receives rx frame on accept). |
Listens on the current RF channel, hopping to the next channel after each slice if no packet arrives. Parses incoming frames and classifies them via decisions::classify_exchange_first_response():
Definition at line 231 of file hub_exchange.cpp.
|
protected |
Wait for a key-challenge (0x3C) from target device during pairing key exchange.
Wait for a valid key‑challenge frame (0x3C from the target device).
| timeout_ms | Maximum time to wait in milliseconds. |
| packet | Output: raw RadioRxPacket of the challenge frame. |
| challenge_frame | Output: parsed IoFrame containing the challenge. |
| device_node_id | Node ID of the device we are pairing (expected sender). |
During key exchange the device responds to our key‑init with a random 6‑byte challenge. This helper loops until such a frame is received and validated by decisions::classify_pairing_key_challenge() — it must be a 0x3C command, 6 bytes long, and come from the discovered device node ID.
Definition at line 209 of file hub_pairing.cpp.
|
protected |
Definition at line 380 of file hub_core.h.
|
protected |
SX1262 BUSY pin.
Definition at line 363 of file hub_core.h.
|
protected |
Definition at line 384 of file hub_core.h.
|
protected |
Definition at line 383 of file hub_core.h.
|
protected |
SX1276 DIO0 interrupt.
Definition at line 360 of file hub_core.h.
|
protected |
SX1262 DIO1 interrupt.
Definition at line 362 of file hub_core.h.
|
protected |
SX1276 DIO4 preamble detect (optional).
Definition at line 361 of file hub_core.h.
|
protected |
Front-end module enable.
Definition at line 364 of file hub_core.h.
|
protected |
Front-end module PA switch.
Definition at line 366 of file hub_core.h.
|
protected |
Definition at line 379 of file hub_core.h.
|
protected |
Definition at line 382 of file hub_core.h.
|
protected |
Definition at line 381 of file hub_core.h.
|
protected |
Maps remote node IDs to lists of device IDs they control.
Used to trigger status polls when 1W remote activity is overheard.
Definition at line 388 of file hub_core.h.
|
protected |
Definition at line 372 of file hub_core.h.
|
protected |
Definition at line 369 of file hub_core.h.
|
protected |
Definition at line 375 of file hub_core.h.
|
protected |
Definition at line 385 of file hub_core.h.
|
protected |
Definition at line 356 of file hub_core.h.
|
protected |
"sx1276", "sx1262", or "" (auto-detect)
Definition at line 371 of file hub_core.h.
|
protected |
Definition at line 359 of file hub_core.h.
|
protected |
Definition at line 373 of file hub_core.h.
|
protected |
Definition at line 370 of file hub_core.h.
|
protected |
SX1262 TCXO voltage setting (default 1.8 V).
Definition at line 376 of file hub_core.h.
|
protected |
Definition at line 374 of file hub_core.h.
|
protected |
Front-end module power.
Definition at line 365 of file hub_core.h.