ESPHome 2026.8.0b4
Loading...
Searching...
No Matches
bdk_scan.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_BK72XX_BLE
6
7#include <cstdint>
8
9namespace esphome::bk72xx_ble {
10
13inline constexpr uint8_t INVALID_ACTIVITY_IDX = 0xFF;
14
16enum class BdkActivityState : uint8_t {
17 IDLE,
18 CREATED,
19 STARTED,
20 OTHER,
21};
22
24enum class BdkOpResult : uint8_t {
25 OK,
26 BUSY,
27 FAILED,
28};
29
31bool bdk_scan_ready();
33BdkActivityState bdk_scan_state(uint8_t activity_idx);
37BdkOpResult bdk_scan_create(uint8_t activity_idx);
42BdkOpResult bdk_scan_start(uint8_t activity_idx, uint16_t interval, uint16_t window, bool active);
47BdkOpResult bdk_scan_release(uint8_t activity_idx, bool created, int *err_out);
48
49} // namespace esphome::bk72xx_ble
50
51#endif // USE_BK72XX_BLE
BdkOpResult bdk_scan_create(uint8_t activity_idx)
Create the scan activity (asynchronous); started once CREATED is observed.
Definition bdk_scan.cpp:70
BdkOpResult bdk_scan_release(uint8_t activity_idx, bool created, int *err_out)
Release the activity: delete when never started (a stop would be rejected), stop otherwise.
Definition bdk_scan.cpp:105
constexpr uint8_t INVALID_ACTIVITY_IDX
Activity index value marking "no scan activity", the BDK's own convention (asserted against its symbo...
Definition bdk_scan.h:13
uint8_t bdk_scan_acquire_activity()
Claim an idle activity slot; INVALID_ACTIVITY_IDX when none is free.
Definition bdk_scan.cpp:63
BdkOpResult bdk_scan_start(uint8_t activity_idx, uint16_t interval, uint16_t window, bool active)
Start a created activity: the packed GAPM start, taking the scan mode the BDK's own start path hardco...
Definition bdk_scan.cpp:80
BdkOpResult
Outcome of a BDK scan operation request.
Definition bdk_scan.h:24
@ BUSY
Another controller operation is in flight; retry later.
@ OK
Accepted; completion is asynchronous.
BdkActivityState
Scan-relevant controller activity states, read live from the SDK.
Definition bdk_scan.h:16
@ OTHER
A non-scan or transitional state; settles on a later read.
@ CREATED
Created but not started.
@ IDLE
No activity (or one whose create failed).
BdkActivityState bdk_scan_state(uint8_t activity_idx)
Live state of the given activity; INVALID_ACTIVITY_IDX reads as IDLE.
Definition bdk_scan.cpp:48
bool bdk_scan_ready()
True when no controller operation is in flight (APP_BLE_READY).
Definition bdk_scan.cpp:46