diff --git a/src/nimble/NimbleBluetooth.cpp b/src/nimble/NimbleBluetooth.cpp index 65515ff07..6d02d1ce8 100644 --- a/src/nimble/NimbleBluetooth.cpp +++ b/src/nimble/NimbleBluetooth.cpp @@ -22,7 +22,7 @@ class BluetoothPhoneAPI : public PhoneAPI /** * Subclasses can use this as a hook to provide custom notifications for their transport (i.e. bluetooth notifies) */ - virtual void onNowHasData(uint32_t fromRadioNum) + void onNowHasData(uint32_t fromRadioNum) override { PhoneAPI::onNowHasData(fromRadioNum); @@ -36,7 +36,7 @@ class BluetoothPhoneAPI : public PhoneAPI } /// Check the current underlying physical link to see if the client is currently connected - virtual bool checkIsConnected() { return bleServer && bleServer->getConnectedCount() > 0; } + bool checkIsConnected() override { return bleServer && bleServer->getConnectedCount() > 0; } }; static BluetoothPhoneAPI *bluetoothPhoneAPI; @@ -79,7 +79,7 @@ class NimbleBluetoothFromRadioCallback : public NimBLECharacteristicCallbacks class NimbleBluetoothServerCallback : public NimBLEServerCallbacks { - virtual uint32_t onPassKeyRequest() + uint32_t onPassKeyDisplay() override { uint32_t passkey = config.bluetooth.fixed_pin; @@ -148,6 +148,8 @@ class NimbleBluetoothServerCallback : public NimBLEServerCallbacks if (bluetoothPhoneAPI) { bluetoothPhoneAPI->close(); } + + NimBLEDevice::startAdvertising(); } }; @@ -259,7 +261,7 @@ void NimbleBluetooth::setupService() BatteryCharacteristic = batteryService->createCharacteristic( // 0x2A19 is the Battery Level characteristic) (uint16_t)0x2a19, NIMBLE_PROPERTY::READ | NIMBLE_PROPERTY::NOTIFY, 1); - NimBLE2904 *batteryLevelDescriptor = (NimBLE2904 *)BatteryCharacteristic->createDescriptor((uint16_t)0x2904); + NimBLE2904 *batteryLevelDescriptor = BatteryCharacteristic->create2904(); batteryLevelDescriptor->setFormat(NimBLE2904::FORMAT_UINT8); batteryLevelDescriptor->setNamespace(1); batteryLevelDescriptor->setUnit(0x27ad); @@ -273,7 +275,7 @@ void NimbleBluetooth::startAdvertising() pAdvertising->reset(); pAdvertising->addServiceUUID(MESH_SERVICE_UUID); pAdvertising->addServiceUUID(NimBLEUUID((uint16_t)0x180f)); // 0x180F is the Battery Service - pAdvertising->start(0); + pAdvertising->start(); } /// Given a level between 0-100, update the BLE attribute