Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Combine Media Key support (jakern) and Fix mouse reconnection (blackketter) #4

Open
Hard-n-Soft opened this issue Apr 6, 2021 · 1 comment

Comments

@Hard-n-Soft
Copy link

There are two similar librarys from jakern and you, blackketter.
First support mouse reconnection but no Media Key, the other one from you
supports Media Key, but this library has problems with the mouse reconnection?

I tried to combine the functionallity by comparing source code.

I added in BleComboKeyboard.cpp

bleKeyboardInstance->connectionStatus->inputMediaKeys = bleKeyboardInstance->inputMediaKeys;

and in BleConnectionStatus.h

BLECharacteristic* inputMediaKeys;

and changed BleConnectionStatus.cpp

#include "BleConnectionStatus.h"

BleConnectionStatus::BleConnectionStatus(void) {
}

void BleConnectionStatus::onConnect(BLEServer* pServer)
{
  this->connected = true;

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

  desc = (BLE2902*)this->inputMouse->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)
{
  this->connected = false;

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

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

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

The function KEY_MEDIA_MUTE, KEY_MEDIA_PLAY_PAUSE, KEY_MEDIA_NEXT_TRACK are working as wanted. But when sending
Keyboard.write( KEY_MEDIA_VOLUME_UP ); or Keyboard.write( KEY_MEDIA_VOLUME_DOWN );
lead to blocking PC. I'm not able to switch from window to window by ALT+TAB after sending this commands. It takes a while for the PC to react normally again. Strange.

Is there an common solution possible, Best regards.

@WaGi-Coding
Copy link

Very late, but i can't get writing media keys after restarting the esp. At least with KEY_MEDIA_MUTE

I guess this library unfortunately is not longer really maintained at all :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants