rename hid client setProtocolMode() to setBootMode()
This commit is contained in:
6 files changed
+11
-19
No files matched your search
@@ -111,9 +111,9 @@ void connect_callback(uint16_t conn_handle)
|
||||
Serial.print("Country code: "); Serial.println(hidInfo[2]);
|
||||
Serial.printf("HID Flags : 0x%02X\n", hidInfo[3]);
|
||||
|
||||
// BLEClientHidAdafruit currently only suports Boot Protocol Mode
|
||||
// BLEClientHidAdafruit currently only supports Boot Protocol Mode
|
||||
// for Keyboard and Mouse. Let's set the protocol mode on prph to Boot Mode
|
||||
hid.setProtocolMode(HID_PROTOCOL_MODE_BOOT);
|
||||
hid.setBootMode(true);
|
||||
|
||||
// Enable Keyboard report notification if present on prph
|
||||
if ( hid.keyboardPresent() ) hid.enableKeyboard();
|
||||
|
||||
@@ -471,9 +471,6 @@ SECMODE_SIGNED_WITH_MITM LITERAL1
|
||||
# HID Constants
|
||||
#######################################
|
||||
|
||||
HID_PROTOCOL_MODE_BOOT LITERAL1
|
||||
HID_PROTOCOL_MODE_REPORT LITERAL1
|
||||
|
||||
MOUSE_BUTTON_LEFT LITERAL1
|
||||
MOUSE_BUTTON_RIGHT LITERAL1
|
||||
MOUSE_BUTTON_MIDDLE LITERAL1
|
||||
|
||||
@@ -127,9 +127,10 @@ uint8_t BLEClientHidAdafruit::getCountryCode(void)
|
||||
return info[2];
|
||||
}
|
||||
|
||||
bool BLEClientHidAdafruit::setProtocolMode(uint8_t mode)
|
||||
bool BLEClientHidAdafruit::setBootMode(bool boot)
|
||||
{
|
||||
return _protcol_mode.write8(mode);
|
||||
// 0 is boot, 1 is protocol
|
||||
return _protcol_mode.write8(1-boot);
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------*/
|
||||
|
||||
@@ -58,7 +58,7 @@ class BLEClientHidAdafruit : public BLEClientService
|
||||
bool getHidInfo(uint8_t info[4]);
|
||||
uint8_t getCountryCode(void);
|
||||
|
||||
bool setProtocolMode(uint8_t mode);
|
||||
bool setBootMode(bool boot);
|
||||
|
||||
// Keyboard API
|
||||
bool keyboardPresent(void);
|
||||
|
||||
@@ -46,7 +46,7 @@ BLEHidGeneric::BLEHidGeneric(uint8_t num_input, uint8_t num_output, uint8_t num_
|
||||
: BLEService(UUID16_SVC_HUMAN_INTERFACE_DEVICE), _chr_control(UUID16_CHR_HID_CONTROL_POINT)
|
||||
{
|
||||
_has_keyboard = _has_mouse = false;
|
||||
_protocol_mode = HID_PROTOCOL_MODE_REPORT;
|
||||
_report_mode = true; // default is report mode
|
||||
|
||||
_report_map = NULL;
|
||||
_report_map_len = 0;
|
||||
@@ -135,7 +135,7 @@ void BLEHidGeneric::blehid_generic_protocol_mode_cb(uint16_t conn_hdl, BLECharac
|
||||
(void) conn_hdl;
|
||||
|
||||
BLEHidGeneric& svc = (BLEHidGeneric&) chr->parentService();
|
||||
svc._protocol_mode = *data;
|
||||
svc._report_mode = (*data); // 0 is boot, 1 Report
|
||||
|
||||
LOG_LV2("HID", "Protocol Mode : %d (0 Boot, 1 Report)", *data);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ err_t BLEHidGeneric::begin(void)
|
||||
_chr_protocol->setFixedLen(1);
|
||||
_chr_protocol->setWriteCallback(BLEHidGeneric::blehid_generic_protocol_mode_cb);
|
||||
VERIFY_STATUS( _chr_protocol->begin() );
|
||||
_chr_protocol->write8(_protocol_mode);
|
||||
_chr_protocol->write8(_report_mode);
|
||||
}
|
||||
|
||||
// Input reports
|
||||
|
||||
@@ -44,12 +44,6 @@
|
||||
// include usb hid definitions
|
||||
#include "tinyusb/src/class/hid/hid.h"
|
||||
|
||||
enum
|
||||
{
|
||||
HID_PROTOCOL_MODE_BOOT = 0,
|
||||
HID_PROTOCOL_MODE_REPORT = 1
|
||||
};
|
||||
|
||||
extern const uint8_t hid_ascii_to_keycode[128][2];
|
||||
extern const uint8_t hid_keycode_to_ascii[128][2];
|
||||
|
||||
@@ -90,7 +84,7 @@ class BLEHidGeneric : public BLEService
|
||||
|
||||
virtual err_t begin(void);
|
||||
|
||||
bool isBootMode(void) { return _protocol_mode == HID_PROTOCOL_MODE_BOOT; }
|
||||
bool isBootMode(void) { return !_report_mode; }
|
||||
|
||||
// Send Report to default connection
|
||||
bool inputReport(uint8_t reportID, void const* data, int len);
|
||||
@@ -109,7 +103,7 @@ class BLEHidGeneric : public BLEService
|
||||
|
||||
bool _has_keyboard;
|
||||
bool _has_mouse;
|
||||
bool _protocol_mode;
|
||||
bool _report_mode;
|
||||
|
||||
uint8_t _hid_info[4];
|
||||
const uint8_t* _report_map;
|
||||
|
||||
Reference in new issue
Block a user