From 23df1033a9dc1024f5b523f3512bfa9a30d0e885 Mon Sep 17 00:00:00 2001 From: EmileSpecialProducts <130773873+EmileSpecialProducts@users.noreply.github.com> Date: Sun, 29 Sep 2024 22:48:40 +0200 Subject: [PATCH] Resume advertising after the disconnect #73 needed to add the .c_str() in the BleMouse.cpp #57 Resume advertising after the disconnect --- BleConnectionStatus.cpp | 2 ++ BleMouse.cpp | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/BleConnectionStatus.cpp b/BleConnectionStatus.cpp index f01183b..1b9f691 100644 --- a/BleConnectionStatus.cpp +++ b/BleConnectionStatus.cpp @@ -15,4 +15,6 @@ void BleConnectionStatus::onDisconnect(BLEServer* pServer) this->connected = false; BLE2902* desc = (BLE2902*)this->inputMouse->getDescriptorByUUID(BLEUUID((uint16_t)0x2902)); desc->setNotifications(false); + BLEAdvertising *pAdvertising = pServer->getAdvertising(); + pAdvertising->start(); } diff --git a/BleMouse.cpp b/BleMouse.cpp index 2bcdd4c..35d6398 100644 --- a/BleMouse.cpp +++ b/BleMouse.cpp @@ -140,7 +140,7 @@ void BleMouse::setBatteryLevel(uint8_t level) { void BleMouse::taskServer(void* pvParameter) { BleMouse* bleMouseInstance = (BleMouse *) pvParameter; //static_cast(pvParameter); - BLEDevice::init(bleMouseInstance->deviceName); + BLEDevice::init(bleMouseInstance->deviceName.c_str()); BLEServer *pServer = BLEDevice::createServer(); pServer->setCallbacks(bleMouseInstance->connectionStatus); @@ -148,7 +148,7 @@ void BleMouse::taskServer(void* pvParameter) { bleMouseInstance->inputMouse = bleMouseInstance->hid->inputReport(0); // <-- input REPORTID from report map bleMouseInstance->connectionStatus->inputMouse = bleMouseInstance->inputMouse; - bleMouseInstance->hid->manufacturer()->setValue(bleMouseInstance->deviceManufacturer); + bleMouseInstance->hid->manufacturer()->setValue(bleMouseInstance->deviceManufacturer.c_str()); bleMouseInstance->hid->pnp(0x02, 0xe502, 0xa111, 0x0210); bleMouseInstance->hid->hidInfo(0x00,0x02);