mirror of
https://github.com/esphome/esphome.git
synced 2025-09-12 08:12:22 +01:00
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>
This commit is contained in:
committed by
GitHub
parent
b8538c2c12
commit
29571a1acd
@@ -33,6 +33,7 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
|
||||
esp_ble_gattc_cb_param_t *param) override;
|
||||
void gap_event_handler(esp_gap_ble_cb_event_t event, esp_ble_gap_cb_param_t *param) override;
|
||||
void connect() override;
|
||||
esp_err_t pair();
|
||||
void disconnect();
|
||||
void release_services();
|
||||
|
||||
@@ -71,6 +72,7 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
|
||||
void set_remote_addr_type(esp_ble_addr_type_t address_type) { this->remote_addr_type_ = address_type; }
|
||||
uint16_t get_conn_id() const { return this->conn_id_; }
|
||||
uint64_t get_address() const { return this->address_; }
|
||||
bool is_paired() const { return this->paired_; }
|
||||
|
||||
uint8_t get_connection_index() const { return this->connection_index_; }
|
||||
|
||||
@@ -86,6 +88,7 @@ class BLEClientBase : public espbt::ESPBTClient, public Component {
|
||||
uint8_t connection_index_;
|
||||
int16_t service_count_{0};
|
||||
uint16_t mtu_{23};
|
||||
bool paired_{false};
|
||||
espbt::ConnectionType connection_type_{espbt::ConnectionType::V1};
|
||||
|
||||
std::vector<BLEService *> services_;
|
||||
|
Reference in New Issue
Block a user