45
45
BLEHidGeneric::BLEHidGeneric (uint8_t num_input, uint8_t num_output, uint8_t num_feature)
46
46
: BLEService(UUID16_SVC_HUMAN_INTERFACE_DEVICE), _chr_control(UUID16_CHR_HID_CONTROL_POINT)
47
47
{
48
- _boot_keyboard = _boot_mouse = false ;
48
+ _has_keyboard = _has_mouse = false ;
49
49
_report_map = NULL ;
50
50
_report_map_len = 0 ;
51
51
@@ -88,12 +88,17 @@ BLEHidGeneric::BLEHidGeneric(uint8_t num_input, uint8_t num_output, uint8_t num_
88
88
}
89
89
}
90
90
91
- void BLEHidGeneric::enableBootProtocol (bool bootKeyboard, bool bootMouse )
91
+ void BLEHidGeneric::enableKeyboard (bool enable )
92
92
{
93
- _boot_keyboard = bootKeyboard;
94
- _boot_mouse = bootMouse;
93
+ _has_keyboard = enable;
95
94
}
96
95
96
+ void BLEHidGeneric::enableMouse (bool enable)
97
+ {
98
+ _has_mouse = enable;
99
+ }
100
+
101
+
97
102
void BLEHidGeneric::setHidInfo (uint16_t bcd, uint8_t country, uint8_t flags)
98
103
{
99
104
memcpy (_hid_info, &bcd, 2 );
@@ -137,7 +142,7 @@ err_t BLEHidGeneric::begin(void)
137
142
VERIFY_STATUS ( BLEService::begin () );
138
143
139
144
// Protocol Mode
140
- if ( _boot_keyboard || _boot_mouse )
145
+ if ( _has_keyboard || _has_mouse )
141
146
{
142
147
_chr_protocol = new BLECharacteristic (UUID16_CHR_PROTOCOL_MODE);
143
148
VERIFY (_chr_protocol, NRF_ERROR_NO_MEM);
@@ -192,7 +197,7 @@ err_t BLEHidGeneric::begin(void)
192
197
report_map.write (_report_map, _report_map_len);
193
198
194
199
// Boot Keyboard Input & Output Report
195
- if ( _boot_keyboard )
200
+ if ( _has_keyboard )
196
201
{
197
202
_chr_boot_keyboard_input = new BLECharacteristic (UUID16_CHR_BOOT_KEYBOARD_INPUT_REPORT);
198
203
_chr_boot_keyboard_input->setProperties (CHR_PROPS_READ | CHR_PROPS_NOTIFY);
@@ -209,7 +214,7 @@ err_t BLEHidGeneric::begin(void)
209
214
}
210
215
211
216
// Boot Mouse Input Report
212
- if ( _boot_mouse )
217
+ if ( _has_mouse )
213
218
{
214
219
_chr_boot_mouse_input = new BLECharacteristic (UUID16_CHR_BOOT_MOUSE_INPUT_REPORT);
215
220
_chr_boot_mouse_input->setProperties (CHR_PROPS_READ | CHR_PROPS_NOTIFY);
0 commit comments