Update bluetooth proxy limit as soon as connection requested (#3935)

This commit is contained in:
Jesse Hills 2022-10-25 12:54:10 +13:00
parent ccbfa20bb9
commit e96d7483b3
No known key found for this signature in database
GPG key ID: BEAAE804EFD8E83A
2 changed files with 5 additions and 0 deletions

View file

@ -209,6 +209,9 @@ void BluetoothProxy::bluetooth_device_request(const api::BluetoothDeviceRequest
switch (msg.request_type) {
case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT: {
this->address_ = msg.address;
this->set_state(espbt::ClientState::SEARCHING);
api::global_api_server->send_bluetooth_connections_free(this->get_bluetooth_connections_free(),
this->get_bluetooth_connections_limit());
break;
}
case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT: {

View file

@ -145,6 +145,8 @@ class ESPBTDeviceListener {
enum class ClientState {
// Connection is idle, no device detected.
IDLE,
// Searching for device.
SEARCHING,
// Device advertisement found.
DISCOVERED,
// Connection in progress.