SmartSnippets DA1459x SDK
Files | Data Structures | Enumerations | Functions

HID service sample implementation API. More...

Files

file  hids.h
 HID Service implementation.
 

Data Structures

struct  hids_callbacks_t
 
struct  hids_report_t
 
struct  hids_config_t
 

Enumerations

enum  hids_protocol_mode_t { HIDS_PROTOCOL_MODE_BOOT = 0x00, HIDS_PROTOCOL_MODE_REPORT = 0x01 }
 
enum  hids_cp_command_t { HIDS_CONTROL_POINT_SUSPEND = 0x00, HIDS_CONTROL_POINT_EXIT_SUSPEND = 0x01 }
 
enum  hids_report_type_t { HIDS_REPORT_TYPE_INPUT = 0x01, HIDS_REPORT_TYPE_OUTPUT = 0x02, HIDS_REPORT_TYPE_FEATURE = 0x03 }
 
enum  hids_boot_device_t { HIDS_BOOT_DEVICE_KEYBOARD = 0x01, HIDS_BOOT_DEVICE_MOUSE = 0x02, HIDS_BOOT_DEVICE_COMBO = HIDS_BOOT_DEVICE_KEYBOARD | HIDS_BOOT_DEVICE_MOUSE }
 

Functions

ble_service_thids_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...
 

Detailed Description

HID service sample implementation API.

Enumeration Type Documentation

◆ 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

Function Documentation

◆ 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]svcservice instance
[in]conn_idxconnection index
Returns
true if new connection is attached, false if there is already other connection attached

◆ 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.

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_configgeneral service config
[in]configHID Service specific config
[in]callbacksapplication 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]svcservice instance
[in]lengthlength of data
[in]datanew value
[out]ble_errBLE 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]svcservice instance
[in]lengthlength of data
[in]datanew value
[out]ble_errBLE 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]svcservice instance
[in]report_idinput report ID
[in]lengthlength of data
[in]datanew value
[out]ble_errBLE 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]svcservice instance
[in]lengthlength of data
[in]datanew 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]svcservice instance
[in]lengthlength of data
[in]datanew 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]svcservice instance
[in]lengthlength of data
[in]datanew 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]svcservice instance
[in]lengthlength of data
[in]datanew 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()

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.

Function sets value of specified Report Characteristic.

Parameters
[in]svcservice instance
[in]typereport type
[in]report_idreport ID
[in]lengthlength of data
[in]datanew value
Returns
true if value has been set successfully.

◆ 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 
)

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]svcservice instance
[in]typereport type
[in]report_idreport ID
[in]lengthlength of data
[in]datanew 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.