fix nrf52 build

1.2-legacy v1.2.30.80e4bc6
Kevin Hester 2021-05-03 15:58:35 +08:00
rodzic 19ee911022
commit 80e4bc6289
1 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -21,6 +21,8 @@ static BLEDfu bledfu; // DFU software update helper service
static uint8_t fromRadioBytes[FromRadio_size]; static uint8_t fromRadioBytes[FromRadio_size];
static uint8_t toRadioBytes[ToRadio_size]; static uint8_t toRadioBytes[ToRadio_size];
static bool bleConnected;
class BluetoothPhoneAPI : public PhoneAPI class BluetoothPhoneAPI : public PhoneAPI
{ {
/** /**
@ -33,6 +35,11 @@ class BluetoothPhoneAPI : public PhoneAPI
DEBUG_MSG("BLE notify fromNum\n"); DEBUG_MSG("BLE notify fromNum\n");
fromNum.notify32(fromRadioNum); 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; static BluetoothPhoneAPI *bluetoothPhoneAPI;
@ -46,6 +53,7 @@ void connect_callback(uint16_t conn_handle)
connection->getPeerName(central_name, sizeof(central_name)); connection->getPeerName(central_name, sizeof(central_name));
DEBUG_MSG("BLE Connected to %s\n", 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 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); DEBUG_MSG("BLE Disconnected, reason = 0x%x\n", reason);
} }