mirror of
https://github.com/esphome/esphome.git
synced 2025-10-23 12:13:49 +01:00
Merge branch 'get_connection_single_loop' into integration
This commit is contained in:
@@ -155,16 +155,12 @@ esp32_ble_tracker::AdvertisementParserType BluetoothProxy::get_advertisement_par
|
|||||||
BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool reserve) {
|
BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool reserve) {
|
||||||
for (uint8_t i = 0; i < this->connection_count_; i++) {
|
for (uint8_t i = 0; i < this->connection_count_; i++) {
|
||||||
auto *connection = this->connections_[i];
|
auto *connection = this->connections_[i];
|
||||||
if (connection->get_address() == address)
|
uint64_t conn_addr = connection->get_address();
|
||||||
|
|
||||||
|
if (conn_addr == address)
|
||||||
return connection;
|
return connection;
|
||||||
}
|
|
||||||
|
|
||||||
if (!reserve)
|
if (reserve && conn_addr == 0) {
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < this->connection_count_; i++) {
|
|
||||||
auto *connection = this->connections_[i];
|
|
||||||
if (connection->get_address() == 0) {
|
|
||||||
connection->send_service_ = INIT_SENDING_SERVICES;
|
connection->send_service_ = INIT_SENDING_SERVICES;
|
||||||
connection->set_address(address);
|
connection->set_address(address);
|
||||||
// All connections must start at INIT
|
// All connections must start at INIT
|
||||||
@@ -175,7 +171,6 @@ BluetoothConnection *BluetoothProxy::get_connection_(uint64_t address, bool rese
|
|||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user