SmartSnippets DA1459x SDK
hids.h
Go to the documentation of this file.
1 
43 #ifndef HIDS_H_
44 #define HIDS_H_
45 
46 #include "ble_gap.h"
47 #include "ble_service.h"
48 
52 typedef enum {
56 
60 typedef enum {
64 
68 typedef enum {
73 
74 typedef void (* hids_set_protocol_mode_cb_t) (ble_service_t *svc, hids_protocol_mode_t mode);
75 typedef void (* hids_control_point_cb_t) (ble_service_t *svc, hids_cp_command_t command);
76 typedef void (* hids_boot_keyboard_output_write_cb_t) (ble_service_t *svc, uint16_t length,
77  const uint8_t *data);
78 typedef void (* hids_report_write_cb_t) (ble_service_t *svc, hids_report_type_t report_type,
79  uint8_t report_id, uint16_t length, const uint8_t *data);
80 typedef void (* hids_report_sent_t) (ble_service_t *svc);
81 typedef void (* hids_notify_boot_mouse_input_report_completed_cb_t) (ble_service_t *svc,
82  bool success);
83 typedef void (* hids_notify_boot_keyboard_input_report_completed_cb_t) (ble_service_t *svc,
84  bool success);
85 typedef void (* hids_notify_input_report_completed_cb_t) (ble_service_t *svc, uint8_t report_id,
86  bool success);
87 
88 
92 typedef struct {
94  hids_set_protocol_mode_cb_t set_protocol_mode;
96  hids_control_point_cb_t control_point;
98  hids_boot_keyboard_output_write_cb_t boot_keyboard_write;
100  hids_report_write_cb_t report_write;
101  /* Indicates that report notification has been sent */
102  hids_report_sent_t report_sent;
104  hids_notify_boot_mouse_input_report_completed_cb_t
107  hids_notify_boot_keyboard_input_report_completed_cb_t
110  hids_notify_input_report_completed_cb_t notify_input_report_completed;
112 
116 typedef struct {
118  uint8_t report_id;
119  uint16_t length;
120 } hids_report_t;
121 
122 typedef enum {
123  HIDS_INFO_FLAG_REMOTE_WAKE = 0x01,
124  HID_INFO_FLAG_NORMALLY_CONNECTABLE = 0x02,
125 } hids_info_flag_t;
126 
127 typedef struct {
128  uint16_t bcd_hid;
129  uint8_t country_code;
130  uint8_t flags;
131 } hids_hid_info_t;
132 
136 typedef enum {
144 
148 typedef struct {
150  uint8_t num_reports;
154  const uint8_t *report_map;
158  hids_hid_info_t hids_info;
161 } hids_config_t;
162 
183 ble_service_t *hids_init(const ble_service_config_t *service_config, const hids_config_t *config,
184  const hids_callbacks_t *callbacks);
185 
198 bool hids_attach_connection(ble_service_t *svc, uint16_t conn_idx);
199 
215 bool hids_set_boot_mouse_input_value(ble_service_t *svc, uint16_t length, const uint8_t *data)
216  __attribute__((deprecated));
217 
230 bool hids_set_boot_mouse_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data);
231 
247 bool hids_notify_boot_mouse_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data, ble_error_t *ble_err);
248 
264 bool hids_set_boot_keyboard_input_value(ble_service_t *svc, uint16_t length, const uint8_t *data)
265  __attribute__((deprecated));
266 
278 bool hids_set_boot_keyboard_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data);
279 
295 bool hids_notify_boot_keyboard_input_report(ble_service_t *svc, uint16_t length,
296  const uint8_t *data, ble_error_t *ble_err);
297 
316 bool hids_set_report_value(ble_service_t *svc, hids_report_type_t type, uint8_t report_id,
317  uint16_t length, const uint8_t *data) __attribute__((deprecated));
318 
333 bool hids_set_report(ble_service_t *svc, hids_report_type_t type, uint8_t report_id,
334  uint16_t length, const uint8_t *data);
335 
351 bool hids_notify_input_report(ble_service_t *svc, uint8_t report_id,
352  uint16_t length, const uint8_t *data, ble_error_t *ble_err);
353 
354 #endif /* HIDS_H_ */
355 
hids_report_t::type
hids_report_type_t type
Definition: hids.h:117
hids_protocol_mode_t
hids_protocol_mode_t
Definition: hids.h:52
HIDS_BOOT_DEVICE_MOUSE
Definition: hids.h:140
HIDS_PROTOCOL_MODE_BOOT
Definition: hids.h:53
HIDS_PROTOCOL_MODE_REPORT
Definition: hids.h:54
HIDS_BOOT_DEVICE_COMBO
Definition: hids.h:142
hids_notify_boot_mouse_input_report
bool hids_notify_boot_mouse_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data, ble_error_t *ble_err)
Notify Boot Mouse Input Report.
hids_set_boot_mouse_input_value
bool hids_set_boot_mouse_input_value(ble_service_t *svc, uint16_t length, const uint8_t *data) __attribute__((deprecated))
Set Boot Mouse Input value.
hids_config_t::report_map
const uint8_t * report_map
Definition: hids.h:154
hids_cp_command_t
hids_cp_command_t
Definition: hids.h:60
hids_config_t::num_reports
uint8_t num_reports
Definition: hids.h:150
hids_boot_device_t
hids_boot_device_t
Definition: hids.h:136
HIDS_BOOT_DEVICE_KEYBOARD
Definition: hids.h:138
hids_report_type_t
hids_report_type_t
Definition: hids.h:68
HIDS_REPORT_TYPE_FEATURE
Definition: hids.h:71
hids_notify_boot_keyboard_input_report
bool hids_notify_boot_keyboard_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data, ble_error_t *ble_err)
Notify Boot Keyboard Input Report.
hids_callbacks_t::notify_boot_mouse_input_report_completed
hids_notify_boot_mouse_input_report_completed_cb_t notify_boot_mouse_input_report_completed
Definition: hids.h:105
hids_callbacks_t
Definition: hids.h:92
hids_init
ble_service_t * hids_init(const ble_service_config_t *service_config, const hids_config_t *config, const hids_callbacks_t *callbacks)
Register HID Service instance.
hids_set_boot_mouse_input_report
bool hids_set_boot_mouse_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data)
Set Boot Mouse Input Report.
hids_config_t::report_map_length
uint16_t report_map_length
Definition: hids.h:156
HIDS_CONTROL_POINT_EXIT_SUSPEND
Definition: hids.h:62
hids_callbacks_t::notify_boot_keyboard_input_report_completed
hids_notify_boot_keyboard_input_report_completed_cb_t notify_boot_keyboard_input_report_completed
Definition: hids.h:108
ble_service.h
Services handling routines API.
HIDS_REPORT_TYPE_INPUT
Definition: hids.h:69
hids_report_t::length
uint16_t length
Definition: hids.h:119
__attribute__
__attribute__
Definition: suota_security_ext.h:98
HIDS_CONTROL_POINT_SUSPEND
Definition: hids.h:61
mode
HW_GPIO_MODE mode
Definition: hw_gpio.h:211
hids_notify_input_report
bool hids_notify_input_report(ble_service_t *svc, uint8_t report_id, uint16_t length, const uint8_t *data, ble_error_t *ble_err)
Notify Input Report.
hids_config_t::hids_info
hids_hid_info_t hids_info
Definition: hids.h:158
hids_attach_connection
bool hids_attach_connection(ble_service_t *svc, uint16_t conn_idx)
Attach connection to HID Service instance.
HIDS_REPORT_TYPE_OUTPUT
Definition: hids.h:70
hids_config_t
Definition: hids.h:148
hids_config_t::boot_device
hids_boot_device_t boot_device
Definition: hids.h:160
hids_config_t::reports
const hids_report_t * reports
Definition: hids.h:152
ble_error_t
ble_error_t
Definition: ble_common.h:53
ble_gap.h
BLE GAP API.
hids_set_boot_keyboard_input_value
bool hids_set_boot_keyboard_input_value(ble_service_t *svc, uint16_t length, const uint8_t *data) __attribute__((deprecated))
Set Boot Keyboard Input value.
ble_service_config_t
Definition: ble_service.h:150
hids_report_t::report_id
uint8_t report_id
Definition: hids.h:118
ble_service
Definition: ble_service.h:132
hids_set_report_value
bool hids_set_report_value(ble_service_t *svc, hids_report_type_t type, uint8_t report_id, uint16_t length, const uint8_t *data) __attribute__((deprecated))
Set Report value.
hids_set_boot_keyboard_input_report
bool hids_set_boot_keyboard_input_report(ble_service_t *svc, uint16_t length, const uint8_t *data)
Set Boot Keyboard Input Report.
hids_set_report
bool hids_set_report(ble_service_t *svc, hids_report_type_t type, uint8_t report_id, uint16_t length, const uint8_t *data)
Set Report.
hids_report_t
Definition: hids.h:116