SmartSnippets DA1459x SDK
hids_client.h
Go to the documentation of this file.
1 
43 #ifndef HIDS_CLIENT_H
44 #define HIDS_CLIENT_H
45 
46 #include <string.h>
47 #include "ble_gattc.h"
48 #include "ble_client.h"
49 
55 typedef enum {
59 
65 typedef enum {
70 
76 typedef enum {
81 
87 typedef enum {
91 
97 typedef enum {
113 
119 typedef struct {
120  uint16_t bcd_hid;
121  uint8_t country_code;
122  uint8_t flags;
124 
125 typedef struct {
127 } hids_client_config_t;
128 
129 typedef void (* hids_client_boot_report_cb_t) (ble_client_t *hids_client,
131  att_error_t status, uint16_t length,
132  const uint8_t *data);
133 typedef void (* hids_client_report_cb_t) (ble_client_t *hids_client, hids_client_report_type_t type,
134  uint8_t report_id, att_error_t status,
135  uint16_t length, const uint8_t *data);
136 typedef void (* hids_client_read_report_map_cb_t) (ble_client_t *hids_client, att_error_t status,
137  uint16_t length, const uint8_t *data);
138 typedef void (* hids_client_read_hid_info_cb_t) (ble_client_t *hids_client,
139  const hids_client_hid_info_t *info);
140 typedef void (* hids_client_input_report_get_notif_state_cb_t) (ble_client_t *hids_client,
141  uint8_t report_id,
142  att_error_t status, bool enabled);
143 typedef void (* hids_client_input_report_set_notif_state_cb_t) (ble_client_t *hids_client,
144  uint8_t report_id,
145  att_error_t status);
146 typedef void (* hids_client_boot_report_get_notif_state_cb_t) (ble_client_t *hids_client,
148  att_error_t status, bool enabled);
149 typedef void (* hids_client_boot_report_set_notif_state_cb_t) (ble_client_t *hids_client,
151  att_error_t status);
152 typedef void (* hids_client_get_protocol_mode_cb_t) (ble_client_t *hids_client, att_error_t status,
154 typedef void (* hids_client_set_protocol_mode_cb_t) (ble_client_t *hids_client,
155  att_error_t status);
156 typedef void (* hids_client_external_report_found_cb_t) (ble_client_t *hids_client,
157  att_error_t status, const att_uuid_t *uuid);
158 typedef void (* hids_client_discover_external_reports_completed_cb_t) (ble_client_t *hids_client);
159 typedef void (* hids_client_report_found_cb_t) (ble_client_t *hids_client, att_error_t status,
160  hids_client_report_type_t type, uint8_t report_id);
161 typedef void (* hids_client_discover_reports_completed_cb_t) (ble_client_t *hids_client);
162 typedef void (* hids_client_report_write_completed_cb_t) (ble_client_t *hids_client,
164  uint8_t report_id,
165  att_error_t status);
166 typedef void (* hids_client_dump_service_data_cb_t) (ble_client_t *hids_client,
167  const char *fmt, ...);
168 
169 typedef struct {
171  hids_client_boot_report_cb_t boot_report;
173  hids_client_report_cb_t report;
175  hids_client_read_report_map_cb_t report_map;
177  hids_client_read_hid_info_cb_t hid_info;
179  hids_client_input_report_get_notif_state_cb_t input_report_get_notif_state;
181  hids_client_input_report_set_notif_state_cb_t input_report_set_notif_state;
183  hids_client_boot_report_get_notif_state_cb_t boot_report_get_notif_state;
185  hids_client_boot_report_set_notif_state_cb_t boot_report_set_notif_state;
187  hids_client_get_protocol_mode_cb_t get_protocol_mode;
189  hids_client_set_protocol_mode_cb_t set_protocol_mode;
191  hids_client_external_report_found_cb_t external_report_found;
193  hids_client_discover_external_reports_completed_cb_t discover_external_reports_complete;
195  hids_client_report_found_cb_t report_found;
197  hids_client_discover_reports_completed_cb_t discover_reports_complete;
199  hids_client_report_write_completed_cb_t report_write_complete;
200 } hids_client_callbacks_t;
201 
214 ble_client_t *hids_client_init(const hids_client_config_t *config, const hids_client_callbacks_t *cb,
215  const ble_evt_gattc_browse_svc_t *evt);
216 
230 ble_client_t *hids_client_init_from_data(uint16_t conn_idx, const hids_client_config_t *config,
231  const hids_client_callbacks_t *cb,const void *data, size_t length);
232 
245 
261 
280  bool response, uint16_t length, const uint8_t *data);
281 
301  uint8_t report_id, bool response, uint16_t length,
302  const uint8_t *data);
303 
320  uint8_t report_id);
321 
336 
352 bool hids_client_input_report_set_notif_state(ble_client_t *client, uint8_t report_id,
353  bool enable);
354 
369 bool hids_client_input_report_get_notif_state(ble_client_t *client, uint8_t report_id);
370 
388  hids_client_boot_report_type type, bool enable);
389 
406 
418 
431 
443 
458 
472 
484 
493 void hids_client_dump_dervice_data(ble_client_t *client, hids_client_dump_service_data_cb_t cb);
494 
495 #endif /* HIDS_CLIENT_H */
496 
ble_evt_gattc_browse_svc_t
Definition: ble_gattc.h:118
HIDS_CLIENT_BOOT_KEYBOARD_OUTPUT
Definition: hids_client.h:79
hids_client_get_protocol_mode
bool hids_client_get_protocol_mode(ble_client_t *client)
Get protocol mode.
hids_client_dump_dervice_data
void hids_client_dump_dervice_data(ble_client_t *client, hids_client_dump_service_data_cb_t cb)
Dump HID Service data.
hids_client_init_from_data
ble_client_t * hids_client_init_from_data(uint16_t conn_idx, const hids_client_config_t *config, const hids_client_callbacks_t *cb, const void *data, size_t length)
Initialize and register HID Client instance from data buffer.
hids_client_get_capabilities
hids_client_cap_t hids_client_get_capabilities(ble_client_t *client)
Get capabilities.
HIDS_CLIENT_CAP_BOOT_KEYBOARD_OUTPUT
Definition: hids_client.h:105
hids_client_boot_report_type
hids_client_boot_report_type
HID Service Client boot report type.
Definition: hids_client.h:76
att_error_t
att_error_t
Definition: ble_att.h:64
hids_client_boot_report_write
bool hids_client_boot_report_write(ble_client_t *client, hids_client_boot_report_type type, bool response, uint16_t length, const uint8_t *data)
Write Boot Report.
HIDS_CLIENT_CONTROL_POINT_SUSPEND
Definition: hids_client.h:88
HIDS_CLIENT_BOOT_MOUSE_INPUT
Definition: hids_client.h:77
HIDS_CLIENT_REPORT_TYPE_INPUT
Definition: hids_client.h:66
HIDS_CLIENT_CAP_REPORT_MAP
Definition: hids_client.h:111
hids_client_discover_reports
bool hids_client_discover_reports(ble_client_t *client)
Read Report Reference descriptors.
hids_client_boot_report_set_notif_state
bool hids_client_boot_report_set_notif_state(ble_client_t *client, hids_client_boot_report_type type, bool enable)
Enable/disable notifications for Boot Input reports.
HIDS_CLIENT_REPORT_TYPE_OUTPUT
Definition: hids_client.h:67
hids_client_cp_command
bool hids_client_cp_command(ble_client_t *client, hids_client_cp_command_t command)
Write command to control point.
HIDS_CLIENT_CAP_PROTOCOL_MODE
Definition: hids_client.h:99
hids_client_read_report_map
bool hids_client_read_report_map(ble_client_t *client)
Read Report Map characteristic.
HIDS_CLIENT_CONTROL_POINT_EXIT_SUSPEND
Definition: hids_client.h:89
HIDS_CLIENT_CAP_BOOT_MOUSE_INPUT
Definition: hids_client.h:101
hids_client_input_report_set_notif_state
bool hids_client_input_report_set_notif_state(ble_client_t *client, uint8_t report_id, bool enable)
Enable/disable notifications for Input Report.
hids_client_protocol_mode_t
hids_client_protocol_mode_t
HID Service Client protocol mode.
Definition: hids_client.h:55
ble_client
Definition: ble_client.h:154
HIDS_CLIENT_BOOT_KEYBOARD_INPUT
Definition: hids_client.h:78
mode
HW_GPIO_MODE mode
Definition: hw_gpio.h:211
hids_client_read_hid_info
bool hids_client_read_hid_info(ble_client_t *client)
Get HID Info characteristic.
HIDS_CLIENT_CAP_HID_CONTROL_POINT
Definition: hids_client.h:109
HIDS_CLIENT_CAP_HID_INFO
Definition: hids_client.h:107
hids_client_hid_info_t
HID Service Client info data.
Definition: hids_client.h:119
hids_client_cp_command_t
hids_client_cp_command_t
HID Service Client control point command.
Definition: hids_client.h:87
HIDS_CLIENT_PROTOCOL_MODE_REPORT
Definition: hids_client.h:57
HIDS_CLIENT_REPORT_TYPE_FEATURE
Definition: hids_client.h:68
hids_client_report_write
bool hids_client_report_write(ble_client_t *client, hids_client_report_type_t type, uint8_t report_id, bool response, uint16_t length, const uint8_t *data)
Write Report.
hids_client_input_report_get_notif_state
bool hids_client_input_report_get_notif_state(ble_client_t *client, uint8_t report_id)
Check if notifications are enabled for Input Report.
hids_client_boot_report_read
bool hids_client_boot_report_read(ble_client_t *client, hids_client_boot_report_type type)
Read Boot Report.
hids_client_report_read
bool hids_client_report_read(ble_client_t *client, hids_client_report_type_t type, uint8_t report_id)
Read Report.
hids_client_set_protocol_mode
bool hids_client_set_protocol_mode(ble_client_t *client)
Set protocol mode.
hids_client_init
ble_client_t * hids_client_init(const hids_client_config_t *config, const hids_client_callbacks_t *cb, const ble_evt_gattc_browse_svc_t *evt)
Register HID Client instance.
HIDS_CLIENT_CAP_BOOT_KEYBOARD_INPUT
Definition: hids_client.h:103
ble_gattc.h
BLE GATT Client API.
hids_client_discover_external_reports
bool hids_client_discover_external_reports(ble_client_t *client)
Read External Reports descriptors.
hids_client_report_type_t
hids_client_report_type_t
HID Service Client report type.
Definition: hids_client.h:65
hids_client_boot_report_get_notif_state
bool hids_client_boot_report_get_notif_state(ble_client_t *client, hids_client_boot_report_type type)
Check if notifications are enabled for Boot Input Report.
HIDS_CLIENT_PROTOCOL_MODE_BOOT
Definition: hids_client.h:56
ble_client.h
GATT Client handling routines API.
hids_client_cap_t
hids_client_cap_t
HIDS Client capabilities.
Definition: hids_client.h:97