mirror of
https://github.com/T-vK/ESP32-BLE-Keyboard.git
synced 2026-02-20 01:41:32 +01:00
Fixes to media keys connect and disconnect.
This commit is contained in:
@@ -8,6 +8,9 @@ void BleConnectionStatus::onConnect(BLEServer* pServer)
|
||||
this->connected = true;
|
||||
BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
|
||||
desc->setNotifications(true);
|
||||
|
||||
desc = (BLE2902*)this->inputMediaKeys->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
|
||||
desc->setNotifications(true);
|
||||
}
|
||||
|
||||
void BleConnectionStatus::onDisconnect(BLEServer* pServer)
|
||||
@@ -15,4 +18,8 @@ void BleConnectionStatus::onDisconnect(BLEServer* pServer)
|
||||
this->connected = false;
|
||||
BLE2902* desc = (BLE2902*)this->inputKeyboard->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
|
||||
desc->setNotifications(false);
|
||||
|
||||
desc = (BLE2902*)this->inputMediaKeys->getDescriptorByUUID(BLEUUID((uint16_t)0x2902));
|
||||
desc->setNotifications(false);
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ public:
|
||||
void onDisconnect(BLEServer* pServer);
|
||||
BLECharacteristic* inputKeyboard;
|
||||
BLECharacteristic* outputKeyboard;
|
||||
BLECharacteristic* inputMediaKeys;
|
||||
};
|
||||
|
||||
#endif // CONFIG_BT_ENABLED
|
||||
|
||||
@@ -128,6 +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->outputKeyboard->setCallbacks(new KeyboardOutputCallbacks());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user