Home IO Control
ESPHome add-on for IO-Homecontrol devices
Loading...
Searching...
No Matches
hub_pairing.cpp
Go to the documentation of this file.
1/// @file hub_pairing.cpp
2/// @brief Thin hub wrapper delegating all pairing logic to PairingEngine.
3/// @ingroup hioc_hub
4///
5/// All pairing implementation lives in pairing_engine.cpp. This file provides
6/// only the IOHomeControlComponent::discover_and_pair() implementation which
7/// manages the hub's busy_ flag and delegates to pairing_engine_.
8
9#include "hub_pairing.h"
10#include "hub_internal.h"
11
12namespace esphome {
13namespace home_io_control {
14
15/// Discover and pair a device in pairing mode.
16///
17/// The hub wrapper manages the busy_ flag so loop() stops hopping and polling
18/// while the blocking pairing exchange is in progress. All protocol logic is
19/// in PairingEngine::discover_and_pair().
21 if (!this->initialized_)
22 return false;
23 this->busy_ = true;
24 bool const ok = this->pairing_engine_.discover_and_pair();
25 this->busy_ = false;
26 // Only fire once an attempt actually ran (telemetry was populated) — not on the early-return
27 // guard above, which would otherwise republish stale telemetry from a previous attempt.
30 return ok;
31}
32
33} // namespace home_io_control
34} // namespace esphome
virtual bool discover_and_pair()
Discover and pair a device that is in pairing mode.
PairingEngine pairing_engine_
Owns the three-phase device pairing flow.
Definition hub_core.h:764
std::function< void()> pairing_result_callback_
Invoked once after every pairing attempt completes; see set_pairing_result_callback().
Definition hub_core.h:754
Internal helpers shared by the hub implementation .cpp files.
Internal pairing-state model for hub‑owned discovery and key‑exchange flows.