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

Feature Request / RFI / how do i do this??? #345

Open
RabByte-0 opened this issue Jan 16, 2025 · 0 comments
Open

Feature Request / RFI / how do i do this??? #345

RabByte-0 opened this issue Jan 16, 2025 · 0 comments

Comments

@RabByte-0
Copy link

RabByte-0 commented Jan 16, 2025

I'm working to interface with an AppleTV and would like to send KeyReports as uint16 or 32bit arrays for some of apples proprietary commands.

Adding/replacing keys 0x02A0 and 0x029F to the MediaKeyReport does not work:

BleKeyboard.h

const MediaKeyReport KEY_MEDIA_NEXT_TRACK = {1, 0};
const MediaKeyReport KEY_MEDIA_PREVIOUS_TRACK = {2, 0};
const MediaKeyReport KEY_MEDIA_STOP = {4, 0};
const MediaKeyReport KEY_MEDIA_PLAY_PAUSE = {8, 0};
const MediaKeyReport KEY_MEDIA_MUTE = {16, 0};
const MediaKeyReport KEY_MEDIA_VOLUME_UP = {32, 0};
const MediaKeyReport KEY_MEDIA_VOLUME_DOWN = {64, 0};
const MediaKeyReport KEY_MEDIA_WWW_HOME = {128, 0};
const MediaKeyReport KEY_MEDIA_LOCAL_MACHINE_BROWSER = {0, 1}; // Opens "My Computer" on Windows
const MediaKeyReport KEY_MEDIA_CALCULATOR = {0, 2};
const MediaKeyReport KEY_MEDIA_WWW_BOOKMARKS = {0, 4};
const MediaKeyReport KEY_MEDIA_WWW_SEARCH = {0, 8};
const MediaKeyReport KEY_MEDIA_WWW_STOP = {0, 16};
const MediaKeyReport KEY_MEDIA_WWW_BACK = {0, 32};
const MediaKeyReport KEY_MEDIA_LAUNCHPAD = {0, 64};
const MediaKeyReport KEY_MEDIA_MISSION_CONTROL = {0, 128};

BleKeyboard.ccp

  USAGE(1),           0xB5,          //   USAGE (Scan Next Track)     ; bit 0: 1
  USAGE(1),           0xB6,          //   USAGE (Scan Previous Track) ; bit 1: 2
  USAGE(1),           0xB7,          //   USAGE (Stop)                ; bit 2: 4
  USAGE(1),           0xCD,          //   USAGE (Play/Pause)          ; bit 3: 8
  USAGE(1),           0xE2,          //   USAGE (Mute)                ; bit 4: 16
  USAGE(1),           0xE9,          //   USAGE (Volume Increment)    ; bit 5: 32
  USAGE(1),           0xEA,          //   USAGE (Volume Decrement)    ; bit 6: 64
  USAGE(2),           0x23, 0x02,    //   Usage (WWW Home)            ; bit 7: 128
  USAGE(2),           0x94, 0x01,    //   Usage (My Computer) ; bit 0: 1
  USAGE(2),           0x92, 0x01,    //   Usage (Calculator)  ; bit 1: 2
  USAGE(2),           0x2A, 0x02,    //   Usage (WWW fav)     ; bit 2: 4
  USAGE(2),           0x21, 0x02,    //   Usage (WWW search)  ; bit 3: 8
  USAGE(2),           0x26, 0x02,    //   Usage (WWW stop)    ; bit 4: 16
  USAGE(2),           0x24, 0x02,    //   Usage (WWW back)    ; bit 5: 32
  USAGE(2),           0xA0, 0x02,    //   Usage (Launchpad)    ; bit 6: 64
  USAGE(2),           0x9F, 0x02,   //   Usage (Mission Control)	; bit 7: 128

Even modifying the code to send a raw key report array is limited to 8bit sections:

BleKeyboard.h
void sendReport(uint8_t* data, size_t length);

BleKeyBoard.ccp

void BleKeyboard::sendReport(uint8_t* data, size_t length) 
{
  if (this->inputKeyboard != nullptr && length <= 8) {                                    
     this->inputKeyboard->setValue(data, length);                                      
     this->inputKeyboard->notify();                                                     
  } 
}

but doing the same with uint16_t or uint32_t throws errors.
Anyone have any advice? I'm very new to all this.

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

1 participant