|
ESPHome 2026.8.0b4
|
#include <bluetooth_connection_rp2.h>
Data Structures | |
| struct | ServiceArena |
Public Member Functions | |
| void | setup () override |
| void | loop () override |
| void | dump_config () override |
| float | get_setup_priority () const override |
| void | set_listener (ble_device_base::GattClientListener *listener) |
| int | connect (uint64_t address, uint8_t addr_type) |
| int | gatt_disconnect () |
| bool | cancel_gatt_disconnect () |
| int | discover_services () |
| int | read_characteristic (uint16_t handle) |
| int | write_characteristic (uint16_t handle, const uint8_t *data, uint16_t len, bool response) |
| int | read_descriptor (uint16_t handle) |
| int | write_descriptor (uint16_t handle, const uint8_t *data, uint16_t len) |
| int | notify_characteristic (uint16_t handle, bool enable) |
| int | pair () |
| int | update_connection_params (uint16_t min_interval, uint16_t max_interval, uint16_t latency, uint16_t timeout) |
| ble_device_base::GattServiceTable | get_service_table () |
| void | set_connection_type (ble_device_base::ConnectionType ct) |
| void | release_services () |
| void | on_ota_global_state (ota::OTAState state, float progress, uint8_t error, ota::OTAComponent *comp) override |
Public Member Functions inherited from esphome::Component | |
| float | get_actual_setup_priority () const |
| void | set_setup_priority (float priority) |
| void | call () |
| virtual void | on_shutdown () |
| virtual void | on_safe_shutdown () |
| virtual bool | teardown () |
| Called during teardown to allow component to gracefully finish operations. | |
| virtual void | on_powerdown () |
| Called after teardown is complete to power down hardware. | |
| uint8_t | get_component_state () const |
| void | reset_to_construction_state () |
| Reset this component back to the construction state to allow setup to run again. | |
| bool | is_in_loop_state () const |
| Check if this component has completed setup and is in the loop state. | |
| bool | is_idle () const |
| Check if this component is idle. | |
| void | mark_failed () |
| Mark this component as failed. | |
| void | mark_failed (const LogString *message) |
| void | disable_loop () |
| Disable this component's loop. | |
| void | enable_loop () |
| Enable this component's loop. | |
| void | enable_loop_soon_any_context () |
| Thread and ISR-safe version of enable_loop() that can be called from any context. | |
| bool | is_failed () const |
| bool | is_ready () const |
| virtual bool | can_proceed () |
| bool | status_has_warning () const |
| bool | status_has_error () const |
| void | status_set_warning () |
| void | status_set_warning (const char *message) |
| void | status_set_warning (const LogString *message) |
| void | status_set_error () |
| void | status_set_error (const LogString *message) |
| void | status_clear_warning () |
| void | status_clear_error () |
| void | status_momentary_warning (const char *name, uint32_t length=5000) |
| Set warning status flag and automatically clear it after a timeout. | |
| void | status_momentary_error (const char *name, uint32_t length=5000) |
| Set error status flag and automatically clear it after a timeout. | |
| bool | has_overridden_loop () const |
| const LogString * | get_component_log_str () const ESPHOME_ALWAYS_INLINE |
| Get the integration where this component was declared as a LogString for logging. | |
| bool | should_warn_of_blocking (uint32_t blocking_time, uint32_t &threshold_ms_out) |
Public Member Functions inherited from esphome::Parented< rp2040_ble::RP2040BLE > | |
| Parented () | |
| Parented (rp2040_ble::RP2040BLE *parent) | |
| rp2040_ble::RP2040BLE * | get_parent () const |
| Get the parent of this object. | |
| void | set_parent (rp2040_ble::RP2040BLE *parent) |
| Set the parent of this object. | |
Public Member Functions inherited from esphome::ota::OTAGlobalStateListener | |
| virtual | ~OTAGlobalStateListener ()=default |
Protected Types | |
| enum class | EngineState : uint8_t { IDLE , CONNECT_PENDING , CONNECTING , MTU_EXCHANGE , READY , DISCONNECTING } |
| enum class | DiscoveryPhase : uint8_t { NONE , SERVICES , CHARACTERISTICS , DESCRIPTORS } |
| enum class | OpType : uint8_t { NONE , READ_CHAR , WRITE_CHAR , WRITE_CHAR_NO_RSP , READ_DESC , WRITE_DESC } |
Protected Member Functions | |
| void | handle_gatt_event_irq_ (uint8_t event_type, const uint8_t *packet) |
| void | enqueue_event_irq_ (RP2GattEvent::Type type, uint8_t status, uint16_t value) |
| void | enqueue_notify_irq_ (uint16_t handle, const uint8_t *data, uint16_t len) |
| void | assemble_blob_irq_ (uint16_t offset, const uint8_t *data, uint16_t len) |
| void | handle_event_ (const RP2GattEvent &event) |
| void | handle_connected_ (uint8_t status, uint16_t con_handle) |
| void | handle_disconnected_ (uint8_t reason) |
| void | handle_query_complete_ (uint8_t att_status) |
| void | advance_discovery_ (uint8_t att_status) |
| int | issue_characteristic_query_ (uint16_t service_index) |
| int | issue_descriptor_query_ (uint16_t char_index) |
| void | finish_discovery_ (int error) |
| void | fail_connection_ (uint8_t reason) |
| int | try_gap_connect_ () |
| void | cleanup_link_state_ () |
| bool | notify_subscribed_ (uint16_t handle) const |
| void | finish_write_no_rsp_ (uint8_t status) |
| void | release_scan_inhibit_ () |
| bool | op_in_flight_ () const |
Protected Member Functions inherited from esphome::Component | |
| friend | void::setup () |
| friend | void::original_setup () |
| void | set_component_source_ (uint8_t index) |
| Set where this component was loaded from for some debug messages. | |
| virtual void | call_setup () |
| void | call_dump_config_ () |
| void | enable_loop_slow_path_ () |
| void | set_component_state_ (uint8_t state) |
| Helper to set component state (clears state bits and sets new state) | |
| bool | set_status_flag_ (uint8_t flag) |
| Helper to set a status LED flag on both this component and the app. | |
| void | set_interval (const char *name, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a const char* name. | |
| void | set_interval (uint32_t id, uint32_t interval, std::function< void()> &&f) |
| Set an interval function with a numeric ID (zero heap allocation). | |
| void | set_interval (InternalSchedulerID id, uint32_t interval, std::function< void()> &&f) |
| void | set_interval (uint32_t interval, std::function< void()> &&f) |
| bool | cancel_interval (const char *name) |
| Cancel an interval function. | |
| bool | cancel_interval (uint32_t id) |
| bool | cancel_interval (InternalSchedulerID id) |
| void | set_timeout (const char *name, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a const char* name. | |
| void | set_timeout (uint32_t id, uint32_t timeout, std::function< void()> &&f) |
| Set a timeout function with a numeric ID (zero heap allocation). | |
| void | set_timeout (InternalSchedulerID id, uint32_t timeout, std::function< void()> &&f) |
| void | set_timeout (uint32_t timeout, std::function< void()> &&f) |
| bool | cancel_timeout (const char *name) |
| Cancel a timeout function. | |
| bool | cancel_timeout (uint32_t id) |
| bool | cancel_timeout (InternalSchedulerID id) |
| void | defer (const char *name, std::function< void()> &&f) |
| Defer a callback to the next loop() call with a const char* name. | |
| void | defer (std::function< void()> &&f) |
| Defer a callback to the next loop() call. | |
| void | defer (uint32_t id, std::function< void()> &&f) |
| Defer a callback with a numeric ID (zero heap allocation) | |
| bool | cancel_defer (const char *name) |
| Cancel a defer callback using the specified name, name must not be empty. | |
| bool | cancel_defer (uint32_t id) |
| void | status_clear_warning_slow_path_ () |
| void | status_clear_error_slow_path_ () |
Static Protected Member Functions | |
| static void | hci_packet_handler (uint8_t type, uint16_t channel, uint8_t *packet, uint16_t size) |
| static void | gatt_packet_handler (uint8_t type, uint16_t channel, uint8_t *packet, uint16_t size) |
| static void | sm_packet_handler (uint8_t type, uint16_t channel, uint8_t *packet, uint16_t size) |
| static RP2GattClient * | instance_for_con_handle (hci_con_handle_t con_handle) |
| static void | can_write_no_rsp_trampoline (void *context) |
Protected Attributes | |
| ble_device_base::GattClientListener * | listener_ {nullptr} |
| ServiceArena * | arena_ {nullptr} |
| esphome::LockFreeQueue< RP2GattEvent, RP2_GATT_EVENT_QUEUE_SIZE > | event_queue_ |
| esphome::EventPool< RP2GattEvent, RP2_GATT_EVENT_QUEUE_SIZE - 1 > | event_pool_ |
| esphome::LockFreeQueue< RP2GattNotifyEvent, RP2_GATT_NOTIFY_QUEUE_SIZE > | notify_queue_ |
| esphome::EventPool< RP2GattNotifyEvent, RP2_GATT_NOTIFY_QUEUE_SIZE - 1 > | notify_pool_ |
| uint8_t | op_buffer_ [RP2_GATT_MAX_ATTR_LEN] |
| gatt_client_notification_t | notification_registration_ {} |
| btstack_context_callback_registration_t | can_write_registration_ {} |
| uint32_t | connect_started_ {0} |
| uint32_t | connect_retry_ms_ {0} |
| uint32_t | disconnecting_started_ {0} |
| uint32_t | write_no_rsp_started_ {0} |
| bd_addr_type_t | peer_addr_type_ {BD_ADDR_TYPE_LE_PUBLIC} |
| hci_con_handle_t | con_handle_ {HCI_CON_HANDLE_INVALID} |
| uint16_t | mtu_ {ble_device_base::DEFAULT_ATT_MTU} |
| uint16_t | op_handle_ {0} |
| uint16_t | op_len_ {0} |
| uint16_t | service_count_ {0} |
| uint16_t | char_count_ {0} |
| uint16_t | desc_count_ {0} |
| uint16_t | disc_service_cursor_ {0} |
| uint16_t | disc_char_cursor_ {0} |
| std::array< uint16_t, RP2_GATT_MAX_NOTIFY_SUBSCRIPTIONS > | notify_subscriptions_ {} |
| uint8_t | notify_subscription_count_ {0} |
| uint8_t | engine_index_ {0} |
| bd_addr_t | peer_addr_ {} |
| ble_device_base::ConnectionType | connection_type_ {ble_device_base::ConnectionType::V3_WITHOUT_CACHE} |
| EngineState | state_ {EngineState::IDLE} |
| DiscoveryPhase | discovery_phase_ {DiscoveryPhase::NONE} |
| OpType | op_type_ {OpType::NONE} |
| bool | truncated_ {false} |
| bool | connect_cancel_attempted_ {false} |
| bool | cancel_requested_ {false} |
| bool | holds_scan_inhibit_ {false} |
Protected Attributes inherited from esphome::Component | |
| uint8_t | component_source_index_ {0} |
| Index into component source PROGMEM lookup table (0 = not set) | |
| uint8_t | warn_if_blocking_over_ {WARN_IF_BLOCKING_OVER_CS} |
| Warn threshold in centiseconds (max 2550ms) | |
| uint8_t | component_state_ {0x00} |
| State of this component - each bit has a purpose: Bits 0-2: Component state (0x00=CONSTRUCTION, 0x01=SETUP, 0x02=LOOP, 0x03=FAILED, 0x04=LOOP_DONE) Bit 3: STATUS_LED_WARNING Bit 4: STATUS_LED_ERROR Bit 5: Has overridden loop() (set at registration time) Bits 6-7: Unused - reserved for future expansion. | |
| volatile bool | pending_enable_loop_ {false} |
| ISR-safe flag for enable_loop_soon_any_context. | |
| ComponentRuntimeStats | runtime_stats_ |
Protected Attributes inherited from esphome::Parented< rp2040_ble::RP2040BLE > | |
| rp2040_ble::RP2040BLE * | parent_ |
Static Protected Attributes | |
| static RP2GattClient * | instances [ESPHOME_BLE_GATT_CLIENT_COUNT] = {} |
| static uint8_t | instance_count = 0 |
| static btstack_packet_callback_registration_t | hci_event_registration = {} |
| static btstack_packet_callback_registration_t | sm_event_registration = {} |
| static RP2GattClient * | connect_owner = nullptr |
Definition at line 78 of file bluetooth_connection_rp2.h.
|
strongprotected |
| Enumerator | |
|---|---|
| NONE | |
| SERVICES | |
| CHARACTERISTICS | |
| DESCRIPTORS | |
Definition at line 131 of file bluetooth_connection_rp2.h.
|
strongprotected |
| Enumerator | |
|---|---|
| IDLE | |
| CONNECT_PENDING | |
| CONNECTING | |
| MTU_EXCHANGE | |
| READY | |
| DISCONNECTING | |
Definition at line 122 of file bluetooth_connection_rp2.h.
|
strongprotected |
| Enumerator | |
|---|---|
| NONE | |
| READ_CHAR | |
| WRITE_CHAR | |
| WRITE_CHAR_NO_RSP | |
| READ_DESC | |
| WRITE_DESC | |
Definition at line 133 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 797 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 378 of file bluetooth_connection_rp2.cpp.
|
staticprotected |
Definition at line 564 of file bluetooth_connection_rp2.cpp.
|
inline |
Definition at line 98 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 666 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::connect | ( | uint64_t | address, |
| uint8_t | addr_type ) |
Definition at line 917 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::discover_services | ( | ) |
Definition at line 740 of file bluetooth_connection_rp2.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 128 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 391 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 405 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 641 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 859 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 580 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::gatt_disconnect | ( | ) |
Definition at line 1004 of file bluetooth_connection_rp2.cpp.
|
staticprotected |
Definition at line 243 of file bluetooth_connection_rp2.cpp.
| ble_device_base::GattServiceTable esphome::bluetooth_connection::RP2GattClient::get_service_table | ( | ) |
Definition at line 886 of file bluetooth_connection_rp2.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 126 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 588 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 693 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 534 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 288 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 701 of file bluetooth_connection_rp2.cpp.
|
staticprotected |
Definition at line 141 of file bluetooth_connection_rp2.cpp.
|
staticprotected |
Definition at line 132 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 775 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 786 of file bluetooth_connection_rp2.cpp.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 422 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::notify_characteristic | ( | uint16_t | handle, |
| bool | enable ) |
Definition at line 1218 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 1243 of file bluetooth_connection_rp2.cpp.
|
overridevirtual |
Implements esphome::ota::OTAGlobalStateListener.
Definition at line 116 of file bluetooth_connection_rp2.cpp.
|
inlineprotected |
Definition at line 170 of file bluetooth_connection_rp2.h.
| int esphome::bluetooth_connection::RP2GattClient::pair | ( | ) |
Definition at line 1209 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::read_characteristic | ( | uint16_t | handle | ) |
Definition at line 1069 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::read_descriptor | ( | uint16_t | handle | ) |
Definition at line 1166 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 634 of file bluetooth_connection_rp2.cpp.
| void esphome::bluetooth_connection::RP2GattClient::release_services | ( | ) |
Definition at line 899 of file bluetooth_connection_rp2.cpp.
|
inline |
Definition at line 110 of file bluetooth_connection_rp2.h.
|
inline |
Definition at line 91 of file bluetooth_connection_rp2.h.
|
overridevirtual |
Reimplemented from esphome::Component.
Definition at line 75 of file bluetooth_connection_rp2.cpp.
|
staticprotected |
Definition at line 211 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 955 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::update_connection_params | ( | uint16_t | min_interval, |
| uint16_t | max_interval, | ||
| uint16_t | latency, | ||
| uint16_t | timeout ) |
Definition at line 1252 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::write_characteristic | ( | uint16_t | handle, |
| const uint8_t * | data, | ||
| uint16_t | len, | ||
| bool | response ) |
Definition at line 1090 of file bluetooth_connection_rp2.cpp.
| int esphome::bluetooth_connection::RP2GattClient::write_descriptor | ( | uint16_t | handle, |
| const uint8_t * | data, | ||
| uint16_t | len ) |
Definition at line 1186 of file bluetooth_connection_rp2.cpp.
|
protected |
Definition at line 176 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 189 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 227 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 207 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 202 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 225 of file bluetooth_connection_rp2.h.
|
staticprotected |
Definition at line 246 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 193 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 192 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 219 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 208 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 210 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 209 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 194 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 221 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 217 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 178 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 177 of file bluetooth_connection_rp2.h.
|
staticprotected |
Definition at line 238 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 230 of file bluetooth_connection_rp2.h.
|
staticprotected |
Definition at line 236 of file bluetooth_connection_rp2.h.
|
staticprotected |
Definition at line 234 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 175 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 203 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 188 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 180 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 179 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 216 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 215 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 185 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 204 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 205 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 222 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 218 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 198 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 206 of file bluetooth_connection_rp2.h.
|
staticprotected |
Definition at line 240 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 220 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 223 of file bluetooth_connection_rp2.h.
|
protected |
Definition at line 195 of file bluetooth_connection_rp2.h.