Skip to content

Commit

Permalink
Fix reconnection issue #84 (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
aovestdipaperino authored Apr 21, 2021
1 parent 928c093 commit 361806a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion BleConnectionStatus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ void BleConnectionStatus::onDisconnect(BLEServer* pServer)

desc = (BLE2902*)this->inputMediaKeys->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
desc->setNotifications(false);

pAdvertising->start();
}
1 change: 1 addition & 0 deletions BleConnectionStatus.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class BleConnectionStatus : public BLEServerCallbacks
BLECharacteristic* inputKeyboard;
BLECharacteristic* outputKeyboard;
BLECharacteristic* inputMediaKeys;
BLEAdvertising *pAdvertising;
};

#endif // CONFIG_BT_ENABLED
Expand Down
12 changes: 6 additions & 6 deletions BleKeyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void BleKeyboard::taskServer(void* pvParameter) {
bleKeyboardInstance->inputMediaKeys = bleKeyboardInstance->hid->inputReport(MEDIA_KEYS_ID);
bleKeyboardInstance->connectionStatus->inputKeyboard = bleKeyboardInstance->inputKeyboard;
bleKeyboardInstance->connectionStatus->outputKeyboard = bleKeyboardInstance->outputKeyboard;
bleKeyboardInstance->connectionStatus->inputMediaKeys = bleKeyboardInstance->inputMediaKeys;
bleKeyboardInstance->connectionStatus->inputMediaKeys = bleKeyboardInstance->inputMediaKeys;

bleKeyboardInstance->outputKeyboard->setCallbacks(new KeyboardOutputCallbacks());

Expand All @@ -146,11 +146,11 @@ void BleKeyboard::taskServer(void* pvParameter) {

bleKeyboardInstance->onStarted(pServer);

BLEAdvertising *pAdvertising = pServer->getAdvertising();
pAdvertising->setAppearance(HID_KEYBOARD);
pAdvertising->addServiceUUID(bleKeyboardInstance->hid->hidService()->getUUID());
pAdvertising->setScanResponse(false);
pAdvertising->start();
bleKeyboardInstance->connectionStatus->pAdvertising = pServer->getAdvertising();
bleKeyboardInstance->connectionStatus->pAdvertising->setAppearance(HID_KEYBOARD);
bleKeyboardInstance->connectionStatus->pAdvertising->addServiceUUID(bleKeyboardInstance->hid->hidService()->getUUID());
bleKeyboardInstance->connectionStatus->pAdvertising->setScanResponse(false);
bleKeyboardInstance->connectionStatus->pAdvertising->start();
bleKeyboardInstance->hid->setBatteryLevel(bleKeyboardInstance->batteryLevel);

ESP_LOGD(LOG_TAG, "Advertising started!");
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=ESP32 BLE Keyboard
version=0.2.2
version=0.2.3
author=T-vK
maintainer=T-vK
sentence=Bluetooth LE Keyboard library for the ESP32.
Expand Down

0 comments on commit 361806a

Please sign in to comment.