HID service sample implementation API.
More...
|
| file | hids.h |
| | HID Service implementation.
|
| |
|
| 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. More...
|
| |
| bool | hids_attach_connection (ble_service_t *svc, uint16_t conn_idx) |
| | Attach connection to HID Service instance. More...
|
| |
| 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. More...
|
| |
| bool | hids_set_boot_mouse_input_report (ble_service_t *svc, uint16_t length, const uint8_t *data) |
| | Set Boot Mouse Input Report. More...
|
| |
| 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. More...
|
| |
| 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. More...
|
| |
| bool | hids_set_boot_keyboard_input_report (ble_service_t *svc, uint16_t length, const uint8_t *data) |
| | Set Boot Keyboard Input Report. More...
|
| |
| 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. More...
|
| |
| 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. More...
|
| |
| 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. More...
|
| |
| 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. More...
|
| |
HID service sample implementation API.
◆ hids_boot_device_t
HID Service boot device flags
| Enumerator |
|---|
| HIDS_BOOT_DEVICE_KEYBOARD | Boot Device Keyboard
|
| HIDS_BOOT_DEVICE_MOUSE | Boot Device Mouse
|
| HIDS_BOOT_DEVICE_COMBO | Boot Device Mouse and Boot Device Keyboard
|
◆ hids_cp_command_t
HID Service control point values
| Enumerator |
|---|
| HIDS_CONTROL_POINT_SUSPEND | Control Point Suspend
|
| HIDS_CONTROL_POINT_EXIT_SUSPEND | Control Point Exit Suspend
|
◆ hids_protocol_mode_t
HID Service protocol modes
| Enumerator |
|---|
| HIDS_PROTOCOL_MODE_BOOT | Protocol Mode Boot
|
| HIDS_PROTOCOL_MODE_REPORT | Protocol Mode Report
|
◆ hids_report_type_t
HID Service report types
| Enumerator |
|---|
| HIDS_REPORT_TYPE_INPUT | Report Type Input
|
| HIDS_REPORT_TYPE_OUTPUT | Report Type Output
|
| HIDS_REPORT_TYPE_FEATURE | Report Type Feature
|
◆ hids_attach_connection()
| bool hids_attach_connection |
( |
ble_service_t * |
svc, |
|
|
uint16_t |
conn_idx |
|
) |
| |
Attach connection to HID Service instance.
Function attaches connection to be used by HID Service instance. Only one connection can have access to HIDS instance. Connection is automatically detached upon disconnection.
- Parameters
-
| [in] | svc | service instance |
| [in] | conn_idx | connection index |
- Returns
- true if new connection is attached, false if there is already other connection attached
◆ hids_init()
Register HID Service instance.
Function registers HID Service
- Note
- HID Service can handle only one connected host at any time. For this reason application has to attach particular connection to HIDS before it can use HIDS - see hids_attach_connection(). It's up to application on how connection is selected but generally it's recommended that only one connection with other device is allowed when running HIDS.
- Parameters
-
| [in] | service_config | general service config |
| [in] | config | HID Service specific config |
| [in] | callbacks | application callbacks |
- Returns
- service instance
- See also
- hids_attach_connection
◆ 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.
Function sets value of Boot Keyboard Input characteristic and notifies clients if protocol is set to HIDS_PROTOCOL_MODE_BOOT
- Parameters
-
| [in] | svc | service instance |
| [in] | length | length of data |
| [in] | data | new value |
| [out] | ble_err | BLE operation error code |
- Returns
- false if there is no attached connection or if protocol mode is not HIDS_PROTOCOL_MODE_BOOT or if notifications are not enabled by remote device. True if notification has been sent successfully.
◆ 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.
Function sends Boot Mouse Input characteristic notification.
- Parameters
-
| [in] | svc | service instance |
| [in] | length | length of data |
| [in] | data | new value |
| [out] | ble_err | BLE operation error code |
- Returns
- false if there is no attached connection or if protocol mode is not HIDS_PROTOCOL_MODE_BOOT or if notifications are not enabledd by remote device. True if notification has been sent successfully.
◆ 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.
Function sends notification of specified Input Report Characteristic value.
- Parameters
-
| [in] | svc | service instance |
| [in] | report_id | input report ID |
| [in] | length | length of data |
| [in] | data | new value |
| [out] | ble_err | BLE operation error code |
- Returns
- true if notification has been sent successfully, otherwise false (if CCC descriptor is not configured properly it will return false). Callback notify_input_report_completed() will be called once completed.
◆ 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.
Function sets value of Boot Keyboard Input characteristic.
- Parameters
-
| [in] | svc | service instance |
| [in] | length | length of data |
| [in] | data | new value |
- Returns
- true if value has been set successfully, otherwise false.
◆ hids_set_boot_keyboard_input_value()
| bool hids_set_boot_keyboard_input_value |
( |
ble_service_t * |
svc, |
|
|
uint16_t |
length, |
|
|
const uint8_t * |
data |
|
) |
| |
Set Boot Keyboard Input value.
Function sets value of Boot Keyboard Input characteristic and notifies clients if protocol is set to HIDS_PROTOCOL_MODE_BOOT
- Parameters
-
| [in] | svc | service instance |
| [in] | length | length of data |
| [in] | data | new value |
- Returns
- true if value has been set successfully and notification sent, otherwise false.
◆ 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.
Function sets value of Boot Mouse Input characteristic.
- Parameters
-
| [in] | svc | service instance |
| [in] | length | length of data |
| [in] | data | new value |
- Returns
- true if value has been set successfully, otherwise false.
◆ hids_set_boot_mouse_input_value()
| bool hids_set_boot_mouse_input_value |
( |
ble_service_t * |
svc, |
|
|
uint16_t |
length, |
|
|
const uint8_t * |
data |
|
) |
| |
Set Boot Mouse Input value.
Function sets value of Boot Mouse Input characteristic and notifies clients if protocol is set to HIDS_PROTOCOL_MODE_BOOT
- Parameters
-
| [in] | svc | service instance |
| [in] | length | length of data |
| [in] | data | new value |
- Returns
- true if value has been set successfully and notification sent, otherwise false.
- Deprecated:
- This function is deprecated. User shall call hids_set_boot_mouse_input_value() and hids_set_boot_mouse_input_report instead.
◆ hids_set_report()
Set Report.
Function sets value of specified Report Characteristic.
- Parameters
-
| [in] | svc | service instance |
| [in] | type | report type |
| [in] | report_id | report ID |
| [in] | length | length of data |
| [in] | data | new value |
- Returns
- true if value has been set successfully.
◆ hids_set_report_value()
Set Report value.
Function sets value of Report Characteristic and optionally notifies client if HIDS_PROTOCOL_MODE_REPORT is enabled and if report's type is HIDS_REPORT_TYPE_INPUT.
- Parameters
-
| [in] | svc | service instance |
| [in] | type | report type |
| [in] | report_id | report ID |
| [in] | length | length of data |
| [in] | data | new value |
- Returns
- true if value has been set successfully and notification sent, otherwise false.
- Deprecated:
- This function is deprecated. User shall call hids_set_report() and hids_notify_input_report() instead.