Home IO Control
ESPHome add-on for IO-Homecontrol devices
Toggle main menu visibility
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
12
namespace
esphome
{
13
namespace
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().
20
bool
IOHomeControlComponent::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.
28
if
(this->
pairing_result_callback_
)
29
this->
pairing_result_callback_
();
30
return
ok;
31
}
32
33
}
// namespace home_io_control
34
}
// namespace esphome
esphome::home_io_control::IOHomeControlComponent::initialized_
bool initialized_
Definition
hub_core.h:1104
esphome::home_io_control::IOHomeControlComponent::discover_and_pair
virtual bool discover_and_pair()
Discover and pair a device that is in pairing mode.
Definition
hub_pairing.cpp:20
esphome::home_io_control::IOHomeControlComponent::pairing_engine_
PairingEngine pairing_engine_
Owns the three-phase device pairing flow.
Definition
hub_core.h:1130
esphome::home_io_control::IOHomeControlComponent::pairing_result_callback_
std::function< void()> pairing_result_callback_
Invoked once after every pairing attempt completes; see set_pairing_result_callback().
Definition
hub_core.h:1113
esphome::home_io_control::IOHomeControlComponent::busy_
bool busy_
Definition
hub_core.h:1105
esphome::home_io_control::PairingEngine::discover_and_pair
bool discover_and_pair()
Discover and pair a device currently in pairing mode (three-phase orchestrator).
Definition
pairing_engine.cpp:649
hub_internal.h
Helpers shared only by the hub's own implementation files (hub_*.cpp).
hub_pairing.h
Internal pairing-state model for hub‑owned discovery and key‑exchange flows.
esphome::home_io_control
Definition
device_registry.cpp:13
esphome
Definition
device_registry.cpp:12
components
home_io_control
hub_pairing.cpp
Generated by
1.18.0