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) { switch (msg.request_type) {
case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT: { case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_CONNECT: {
this->address_ = msg.address; 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; break;
} }
case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT: { case api::enums::BLUETOOTH_DEVICE_REQUEST_TYPE_DISCONNECT: {

View file

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