From 80e4bc6289e2f87e91a04aa4a2c6151737ac79c5 Mon Sep 17 00:00:00 2001 From: Kevin Hester Date: Mon, 3 May 2021 15:58:35 +0800 Subject: [PATCH] fix nrf52 build --- src/nrf52/NRF52Bluetooth.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/nrf52/NRF52Bluetooth.cpp b/src/nrf52/NRF52Bluetooth.cpp index e67607c94..b9f0acb57 100644 --- a/src/nrf52/NRF52Bluetooth.cpp +++ b/src/nrf52/NRF52Bluetooth.cpp @@ -21,6 +21,8 @@ static BLEDfu bledfu; // DFU software update helper service static uint8_t fromRadioBytes[FromRadio_size]; static uint8_t toRadioBytes[ToRadio_size]; +static bool bleConnected; + class BluetoothPhoneAPI : public PhoneAPI { /** @@ -33,6 +35,11 @@ class BluetoothPhoneAPI : public PhoneAPI DEBUG_MSG("BLE notify fromNum\n"); fromNum.notify32(fromRadioNum); } + + /// Check the current underlying physical link to see if the client is currently connected + virtual bool checkIsConnected() { + return bleConnected; + } }; static BluetoothPhoneAPI *bluetoothPhoneAPI; @@ -46,6 +53,7 @@ void connect_callback(uint16_t conn_handle) connection->getPeerName(central_name, sizeof(central_name)); DEBUG_MSG("BLE Connected to %s\n", central_name); + bleConnected = true; } /** @@ -55,7 +63,8 @@ void connect_callback(uint16_t conn_handle) */ void disconnect_callback(uint16_t conn_handle, uint8_t reason) { - (void)conn_handle; + // FIXME - we currently assume only one active connection + bleConnected = false; DEBUG_MSG("BLE Disconnected, reason = 0x%x\n", reason); }