From e26cec54f41cc2935a1b23d7259f1f0e8ff8c20f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beke=20=C3=81kos?= Date: Sun, 23 Aug 2020 12:06:42 +0200 Subject: [PATCH] Added a new onAdvertising hook --- BleKeyboard.cpp | 3 +++ BleKeyboard.h | 1 + 2 files changed, 4 insertions(+) diff --git a/BleKeyboard.cpp b/BleKeyboard.cpp index 5b6ccb9..3598040 100644 --- a/BleKeyboard.cpp +++ b/BleKeyboard.cpp @@ -149,6 +149,9 @@ void BleKeyboard::taskServer(void* pvParameter) { BLEAdvertising *pAdvertising = pServer->getAdvertising(); pAdvertising->setAppearance(HID_KEYBOARD); pAdvertising->addServiceUUID(bleKeyboardInstance->hid->hidService()->getUUID()); + + bleKeyboardInstance->onAdvertising(pAdvertising); + pAdvertising->start(); bleKeyboardInstance->hid->setBatteryLevel(bleKeyboardInstance->batteryLevel); diff --git a/BleKeyboard.h b/BleKeyboard.h index b9dff8b..28628bb 100644 --- a/BleKeyboard.h +++ b/BleKeyboard.h @@ -118,6 +118,7 @@ class BleKeyboard : public Print std::string deviceName; protected: virtual void onStarted(BLEServer *pServer) { }; + virtual void onAdvertising(BLEAdvertising *pAdvertising) { }; }; #endif // CONFIG_BT_ENABLED