Skip to content

Commit

Permalink
Resume advertising after the disconnect
Browse files Browse the repository at this point in the history
T-vK#73 needed to add the .c_str() in the BleMouse.cpp
T-vK#57 Resume advertising after the disconnect
  • Loading branch information
EmileSpecialProducts committed Sep 29, 2024
1 parent ba38caa commit 23df103
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions BleConnectionStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
4 changes: 2 additions & 2 deletions BleMouse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,15 +140,15 @@ void BleMouse::setBatteryLevel(uint8_t level) {

void BleMouse::taskServer(void* pvParameter) {
BleMouse* bleMouseInstance = (BleMouse *) pvParameter; //static_cast<BleMouse *>(pvParameter);
BLEDevice::init(bleMouseInstance->deviceName);
BLEDevice::init(bleMouseInstance->deviceName.c_str());
BLEServer *pServer = BLEDevice::createServer();
pServer->setCallbacks(bleMouseInstance->connectionStatus);

bleMouseInstance->hid = new BLEHIDDevice(pServer);
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);
Expand Down

0 comments on commit 23df103

Please sign in to comment.