Commit Graph
41 Commits
Author SHA1 Message Date
J. Nick Koston d3cbe21fa3 preen 2025-08-01 10:29:24 -10:00
J. Nick Koston aa0b80b004 Eliminate heap allocations in bluetooth_proxy connection state reporting 2025-08-01 09:50:11 -10:00
J. Nick Koston ec2e0c50f1 [bluetooth_proxy] [esp32_ble_tracker] [esp32_ble] Use C++17 nested namespace syntax (#9825) 2025-07-24 15:23:45 +12:00
J. Nick Koston 2540e7edb2 [api] Remove deprecated protobuf fields to reduce flash usage (#9679) 2025-07-21 10:35:53 +12:00
J. Nick Koston 335110d71f [bluetooth_proxy] Fix service discovery on disconnect and refactor connection handling (#9697) 2025-07-21 10:15:34 +12:00
J. Nick Koston ec5a517a76 Fix bluetooth_proxy heap allocations during BLE scanning (#9633) 2025-07-18 16:24:29 +12:00
J. Nick Koston f5afe1145e Refactor API send_message from template to non-template implementation (#9561) 2025-07-18 10:28:14 +12:00
J. Nick Koston 30c4b91697 Remove parsed advertisement support from bluetooth_proxy to save memory (#9489) 2025-07-16 13:19:03 +12:00
J. Nick Koston 42a1f6922f Eliminate bluetooth_proxy guard variable to save 8 bytes RAM (#9343) 2025-07-08 09:16:48 +12:00
J. Nick Koston 138ff749f3 Optimize Bluetooth proxy batching and increase scan buffer capacity (#9328) 2025-07-08 07:34:12 +12:00
J. Nick Koston a303f93236 Fix bluetooth proxy busy loop when disconnecting pending BLE connections (#9332) 2025-07-07 14:50:36 +12:00
J. Nick Koston 07cf6e723b Fix unbound BLE event queue growth and reduce memory usage (#9052) 2025-06-15 04:45:41 +00:00
J. Nick Koston 2ed5611a08 Replace API deferred queue with efficient message batching system (#9012) 2025-06-11 11:49:15 +12:00
J. Nick Koston c0b05ada1a Reduce ESP_LOGCONFIG calls (#9026) 2025-06-09 00:02:30 +00:00
J. Nick Koston 574aabdede Reduce number of calls to fetch time in the main loop (#8804) 2025-05-19 07:48:57 +12:00
J. Nick Koston ddb986b4fa Improve batching of BLE advertisements for better airtime efficiency (#8778) 2025-05-14 04:34:33 +00:00
J. Nick Koston 00f20c1e55 Optimize bluetooth_proxy memory copy and reduce reallocs (#8723) 2025-05-09 12:49:50 +12:00
Jesse Hills ecb91b0101 [bluetooth_proxy] Allow changing active/passive via api (#8649) 2025-04-29 12:43:55 +00:00
J. Nick Koston fbf00f0af4 Fix BLE connection loop caused by timeout and pending disconnect race (#8597) 2025-04-22 21:17:09 +12:00
J. Nick Koston dd18a219db Include Bluetooth connection slot allocations in connections free message (#8148) 2025-01-28 06:57:52 +04:00
tomaszduda23 ca2f25e73b update logs for bluetooth proxy (#7382) 2024-09-01 21:20:31 +10:00
J. Nick Koston e6834f25ed Fix bulk and single Bluetooth parser coexistence (#5073) 2023-07-10 09:08:46 +12:00
Jesse Hills ce13979690 Bluetooth Proxy: Raw bundled advertisements (#4924) 2023-06-09 07:41:09 +12:00
J. Nick Koston 9ee661c1e4 Add ability to clear the gatt cache (#4621)
* Add ability to clear the gatt cache

With BlueZ we can fully clear the cache when something goes wrong with the services, however since this is also a cache on the ESP32 we need to be able to clear the on device cache as well for the proxies since if something goes wrong with the service resolution it can cache the bad resolution on NVS forever.

Our current client implementation is limited to clearing the memory cache in Home Assistant https://github.com/home-assistant/core/blob/89355e087952417a6824507fd3b197f9d0520e19/homeassistant/components/esphome/bluetooth/client.py#L512

related issue https://github.com/esphome/issues/issues/4156

https://github.com/esphome/aioesphomeapi/pull/410

* naming

* lint

* lint

* naming

* naming

* naming

* 88 now that 87 is taken

* make const

* Update esphome/components/api/api_frame_helper.cpp
2023-03-26 21:48:56 +00:00
Fredrik GustafssonandJesse Hills 29571a1acd implement pairing for bluetooth proxy (#4475)
* default to just-works encryption

This patch will turn on encryption when making active connections in order to comply with just-works BLE encryption.

* Revert "default to just-works encryption"

This reverts commit 05bc9e9f1c.

* implement pair method

* adhere to clang formatter

* fix oopsie

* bump bluetooth_proxy_version

* add auth callback

* generate new protos

* fix another oopsie

* add pairing status to connection

* clear paired on connect()

* lint

* add unpair ("forget") ble method

* compile protos

* fix oopsie

* add missing unpairing method

* add unpairing

* fix get_paired return type

* remove unused memcpy

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>

* change to is_paired

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>

* Update bluetooth_proxy.cpp

* actually add missing method

* send auth cb on set_encryption failure

* cleanup from havin the worst test setup

* lint

* match auth events to bd_addr

* add second addr check to auth cb

* add addr check to third auth cb

---------

Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2023-03-06 18:04:35 +00:00
J. Nick Koston 027284c29c Speed up uuid parsing when fetching the service list (#4121) 2022-11-30 10:11:48 +13:00
a59ce7bfa2 Avoid parsing services with v3 connections without cache (#4117)
Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
Co-authored-by: Maurice Makaay <account+github@makaay.nl>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-11-30 09:40:31 +13:00
8414bb9a7a Active BLE connection v3 (#4113)
Co-authored-by: Daniel Cousens <413395+dcousens@users.noreply.github.com>
Co-authored-by: Maurice Makaay <account+github@makaay.nl>
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-11-30 07:53:32 +13:00
Jesse Hills 120327866f Send device address type alongside ble advertisements (#4115) 2022-11-29 17:24:21 +13:00
J. Nick Koston d5ff8f6117 Reduce memory needed to send the services list (#4110) 2022-11-29 17:14:29 +13:00
J. Nick Koston 873de13b3d Fix bluetooth_gatt_write_descriptor never getting a response (#4112) 2022-11-29 17:10:02 +13:00
J. Nick KostonandJesse Hills 73c82862cf Improve reliability of bluetooth active connections (#4049)
Co-authored-by: Jesse Hills <3060199+jesserockz@users.noreply.github.com>
2022-11-29 08:15:40 +13:00
J. Nick Koston 75573a3ed1 Fix descriptors not being deleted (#4104) 2022-11-29 07:49:41 +13:00
J. Nick Koston ac112a32c9 Add logging for BLE connection slots (#4098) 2022-11-28 13:39:35 +13:00
J. Nick Koston 53e0af18fb Make parse_characteristics and parse_descriptors lazy to reduce memory pressure (#4063) 2022-11-28 13:28:02 +13:00
Jesse Hills 0e66c899ce Allow multiple bluetooth proxy connections (#3971) 2022-11-02 23:02:33 +13:00
Jesse Hills 22e0a944c8 Update bluetooth proxy limit as soon as connection requested (#3935) 2022-10-25 12:54:10 +13:00
Jesse Hills 8bb670521d Remove address type map from bluetooth proxy (#3905) 2022-10-15 08:35:35 +13:00
Jesse Hills b34d24735a Send GATT error events to HA (#3884) 2022-10-12 22:22:07 +13:00
Jesse Hills ed443c6153 Bluetooth Proxy active connections (#3817) 2022-10-04 10:45:06 +13:00
Jesse Hills b854e17995 Initial bluetooth_proxy support (#3736) 2022-08-25 07:13:44 +12:00