@@ -18,6 +18,7 @@ uint16_t ble_hid_characteristic_information_handle;
1818
1919uint16_t ble_hid_characteristic_report_value_handle ;
2020uint16_t ble_hid_characteristic_report_cccd_handle ;
21+ uint16_t ble_hid_characteristic_control_point_value_handle ;
2122
2223bool ble_hid_report_notification_enabled = false;
2324
@@ -181,19 +182,19 @@ void ble_hid_handle_input_change(uint32_t index, gpio_config_input_digital_t *co
181182 APP_ERROR_CHECK (err_code );
182183}
183184
184- void ble_hid_on_connect (ble_evt_t * p_ble_evt )
185+ void ble_hid_on_connect (const ble_evt_t * p_ble_evt )
185186{
186187 ble_hid_connection_handle = p_ble_evt -> evt .gap_evt .conn_handle ;
187188}
188189
189- void ble_hid_on_disconnect (ble_evt_t * p_ble_evt )
190+ void ble_hid_on_disconnect (const ble_evt_t * p_ble_evt )
190191{
191192 UNUSED_PARAMETER (p_ble_evt );
192193 ble_hid_connection_handle = BLE_CONN_HANDLE_INVALID ;
193194 ble_hid_report_notification_enabled = false;
194195}
195196
196- void handle_hid_report_cccd_write (ble_gatts_evt_write_t * write_evt )
197+ void handle_hid_report_cccd_write (const ble_gatts_evt_write_t * write_evt )
197198{
198199 if (write_evt -> len == 2 )
199200 {
@@ -202,9 +203,9 @@ void handle_hid_report_cccd_write(ble_gatts_evt_write_t *write_evt)
202203 }
203204}
204205
205- void ble_hid_on_write (ble_evt_t * p_ble_evt )
206+ void ble_hid_on_write (const ble_evt_t * p_ble_evt )
206207{
207- ble_gatts_evt_write_t * write_evt = & p_ble_evt
208+ const ble_gatts_evt_write_t * write_evt = & p_ble_evt
208209 -> evt
209210 .gatts_evt
210211 .params
@@ -214,12 +215,21 @@ void ble_hid_on_write(ble_evt_t *p_ble_evt)
214215
215216 if (handle == ble_hid_characteristic_report_cccd_handle )
216217 {
218+ NRF_LOG_DEBUG ("writing cccd" );
217219 handle_hid_report_cccd_write (write_evt );
218220 return ;
219221 }
222+
223+ if (handle == ble_hid_characteristic_control_point_value_handle )
224+ {
225+ NRF_LOG_DEBUG ("writing control point" );
226+ return ;
227+ }
228+
229+ NRF_LOG_DEBUG ("writing unknown thingathing %d %d %d %d %d" , handle , ble_hid_characteristic_information_handle , ble_hid_characteristic_report_cccd_handle , ble_hid_characteristic_report_value_handle , ble_hid_characteristic_control_point_value_handle );
220230}
221231
222- void ble_hid_on_ble_evt (ble_evt_t * p_ble_evt )
232+ void ble_hid_on_ble_evt (const ble_evt_t * p_ble_evt )
223233{
224234 switch (p_ble_evt -> header .evt_id )
225235 {
@@ -264,7 +274,8 @@ ret_code_t ble_hid_characteristic_report_map_add()
264274 .is_readable = true,
265275 .max_length = sizeof (descriptor_value ),
266276 .initial_value_length = sizeof (descriptor_value ),
267- .initial_value = descriptor_value
277+ .initial_value = descriptor_value ,
278+ .value_handle = & ble_hid_characteristic_information_handle
268279 };
269280
270281 return ble_helper_characteristic_add (& init );
@@ -276,6 +287,7 @@ ret_code_t ble_hid_characteristic_control_point_add()
276287 .service_handle = ble_hid_service_handle ,
277288 .uuid = BLE_UUID_HID_CHARACTERISTIC_CONTROL_POINT ,
278289 .is_writable = true,
290+ .value_handle = & ble_hid_characteristic_control_point_value_handle ,
279291 .max_length = 1
280292 };
281293
0 commit comments