Smart Remote 3 nRF52 v1.2
m_coms_ble_hid.h
1 /*$$$LICENCE_NORDIC_STANDARD<2016>$$$*/
2 
19 #ifndef __M_COMS_BLE_HID__
20 #define __M_COMS_BLE_HID__
21 
22 #include <stdbool.h>
23 #include <stdint.h>
24 #include "ble_hids.h"
25 #include "m_coms_ble.h"
26 
28 typedef struct
29 {
30  ble_hids_evt_t * hids_evt;
31  uint8_t interface_idx;
32  uint8_t report_type;
33  uint8_t report_idx;
34  uint8_t len;
35  uint8_t * data;
37 
38 
39 typedef void (*m_coms_hid_evt_handler_t) (m_coms_ble_hid_evt_t * p_evt);
40 
42 typedef struct
43 {
44  ble_hids_t * const interface;
45  uint8_t * report_map;
46  uint16_t report_map_len;
47  uint8_t boot_type;
49 
51 typedef struct
52 {
53  uint8_t interface_idx;
55  bool read_resp;
56  uint8_t report_id;
57  uint8_t report_len;
59 
61 typedef struct
62 {
63  uint8_t interface_idx;
64  uint16_t external_char_uuid;
66 
68 typedef struct ble_hid_db_s
69 {
71  size_t reports_in_size;
74  size_t ext_maps_size;
81 } ble_hid_db_t;
82 
83 typedef struct
84 {
85  m_coms_hid_evt_handler_t evt_handler;
86  ble_srv_error_handler_t error_handler;
87  ble_hid_db_t const * db_loc;
88  uint16_t base_hid_version;
89  uint8_t b_country_code;
90  uint8_t flags;
91  uint8_t io_capabilities;
92 } m_coms_ble_hid_init_t;
93 
97 #define BLE_HID_REPORT_MAP_CONF(_interface, \
98  _report_map, \
99  _report_map_len, \
100  _boot_type) \
101  { \
102  .interface = _interface, \
103  .report_map = _report_map, \
104  .report_map_len = _report_map_len, \
105  .boot_type = _boot_type, \
106  }
107 
111 #define BLE_HID_REPORT_CONF(_interface_idx, \
112  _report_type, \
113  _read_resp, \
114  _report_id, \
115  _report_len) \
116  { \
117  .interface_idx = _interface_idx, \
118  .report_type = _report_type, \
119  .read_resp = _read_resp, \
120  .report_id = _report_id, \
121  .report_len = _report_len, \
122  }
123 
127 #define BLE_HID_EXT_MAP_CONF(_interface_idx, \
128  _external_char_uuid) \
129  { \
130  .interface_idx = _interface_idx, \
131  .external_char_uuid = _external_char_uuid, \
132  }
133 
143 uint32_t m_coms_ble_hid_init(const m_coms_ble_hid_init_t * p_params,
144  uint16_t *p_last_input_report_cccd_handle);
145 
156 uint32_t m_coms_ble_hid_input_report_send(uint8_t p_interface_idx,
157  uint8_t p_report_idx,
158  uint8_t * p_data,
159  uint8_t p_len);
160 
172 
184 
195 uint32_t m_coms_ble_hid_feature_report_set(uint8_t p_interface_idx,
196  uint8_t p_report_idx,
197  uint8_t * p_data,
198  uint16_t p_len);
199 #endif /* __M_COMS_BLE_HID__*/
200 

Documentation feedback | Developer Zone | Subscribe | Updated