4545BLEHidGeneric::BLEHidGeneric (uint8_t num_input, uint8_t num_output, uint8_t num_feature)
4646 : BLEService(UUID16_SVC_HUMAN_INTERFACE_DEVICE), _chr_control(UUID16_CHR_HID_CONTROL_POINT)
4747{
48- _boot_keyboard = _boot_mouse = false ;
48+ _has_keyboard = _has_mouse = false ;
4949 _report_map = NULL ;
5050 _report_map_len = 0 ;
5151
@@ -88,12 +88,17 @@ BLEHidGeneric::BLEHidGeneric(uint8_t num_input, uint8_t num_output, uint8_t num_
8888 }
8989}
9090
91- void BLEHidGeneric::enableBootProtocol (bool bootKeyboard, bool bootMouse )
91+ void BLEHidGeneric::enableKeyboard (bool enable )
9292{
93- _boot_keyboard = bootKeyboard;
94- _boot_mouse = bootMouse;
93+ _has_keyboard = enable;
9594}
9695
96+ void BLEHidGeneric::enableMouse (bool enable)
97+ {
98+ _has_mouse = enable;
99+ }
100+
101+
97102void BLEHidGeneric::setHidInfo (uint16_t bcd, uint8_t country, uint8_t flags)
98103{
99104 memcpy (_hid_info, &bcd, 2 );
@@ -137,7 +142,7 @@ err_t BLEHidGeneric::begin(void)
137142 VERIFY_STATUS ( BLEService::begin () );
138143
139144 // Protocol Mode
140- if ( _boot_keyboard || _boot_mouse )
145+ if ( _has_keyboard || _has_mouse )
141146 {
142147 _chr_protocol = new BLECharacteristic (UUID16_CHR_PROTOCOL_MODE);
143148 VERIFY (_chr_protocol, NRF_ERROR_NO_MEM);
@@ -192,7 +197,7 @@ err_t BLEHidGeneric::begin(void)
192197 report_map.write (_report_map, _report_map_len);
193198
194199 // Boot Keyboard Input & Output Report
195- if ( _boot_keyboard )
200+ if ( _has_keyboard )
196201 {
197202 _chr_boot_keyboard_input = new BLECharacteristic (UUID16_CHR_BOOT_KEYBOARD_INPUT_REPORT);
198203 _chr_boot_keyboard_input->setProperties (CHR_PROPS_READ | CHR_PROPS_NOTIFY);
@@ -209,7 +214,7 @@ err_t BLEHidGeneric::begin(void)
209214 }
210215
211216 // Boot Mouse Input Report
212- if ( _boot_mouse )
217+ if ( _has_mouse )
213218 {
214219 _chr_boot_mouse_input = new BLECharacteristic (UUID16_CHR_BOOT_MOUSE_INPUT_REPORT);
215220 _chr_boot_mouse_input->setProperties (CHR_PROPS_READ | CHR_PROPS_NOTIFY);
0 commit comments