SmartSnippets DA1459x SDK
Files | Data Structures | Enumerations | Functions

Human Interface Device Service Client. More...

Files

file  hids_client.h
 HID Service Client header file.
 

Data Structures

struct  hids_client_hid_info_t
 HID Service Client info data. More...
 

Enumerations

enum  hids_client_protocol_mode_t { HIDS_CLIENT_PROTOCOL_MODE_BOOT = 0x00, HIDS_CLIENT_PROTOCOL_MODE_REPORT = 0x01 }
 HID Service Client protocol mode. More...
 
enum  hids_client_report_type_t { HIDS_CLIENT_REPORT_TYPE_INPUT = 0x01, HIDS_CLIENT_REPORT_TYPE_OUTPUT = 0x02, HIDS_CLIENT_REPORT_TYPE_FEATURE = 0x03 }
 HID Service Client report type. More...
 
enum  hids_client_boot_report_type { HIDS_CLIENT_BOOT_MOUSE_INPUT, HIDS_CLIENT_BOOT_KEYBOARD_INPUT, HIDS_CLIENT_BOOT_KEYBOARD_OUTPUT }
 HID Service Client boot report type. More...
 
enum  hids_client_cp_command_t { HIDS_CLIENT_CONTROL_POINT_SUSPEND = 0x00, HIDS_CLIENT_CONTROL_POINT_EXIT_SUSPEND = 0x01 }
 HID Service Client control point command. More...
 
enum  hids_client_cap_t {
  HIDS_CLIENT_CAP_PROTOCOL_MODE = 0x01, HIDS_CLIENT_CAP_BOOT_MOUSE_INPUT = 0x02, HIDS_CLIENT_CAP_BOOT_KEYBOARD_INPUT = 0x04, HIDS_CLIENT_CAP_BOOT_KEYBOARD_OUTPUT = 0x08,
  HIDS_CLIENT_CAP_HID_INFO = 0x10, HIDS_CLIENT_CAP_HID_CONTROL_POINT = 0x20, HIDS_CLIENT_CAP_REPORT_MAP = 0x40
}
 HIDS Client capabilities. More...
 

Functions

ble_client_thids_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. More...
 
ble_client_thids_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. More...
 
bool hids_client_set_protocol_mode (ble_client_t *client)
 Set protocol mode. More...
 
bool hids_client_boot_report_read (ble_client_t *client, hids_client_boot_report_type type)
 Read Boot Report. More...
 
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. More...
 
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. More...
 
bool hids_client_report_read (ble_client_t *client, hids_client_report_type_t type, uint8_t report_id)
 Read Report. More...
 
bool hids_client_cp_command (ble_client_t *client, hids_client_cp_command_t command)
 Write command to control point. More...
 
bool hids_client_input_report_set_notif_state (ble_client_t *client, uint8_t report_id, bool enable)
 Enable/disable notifications for Input Report. More...
 
bool hids_client_input_report_get_notif_state (ble_client_t *client, uint8_t report_id)
 Check if notifications are enabled for Input Report. More...
 
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. More...
 
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. More...
 
bool hids_client_get_protocol_mode (ble_client_t *client)
 Get protocol mode. More...
 
bool hids_client_read_hid_info (ble_client_t *client)
 Get HID Info characteristic. More...
 
bool hids_client_read_report_map (ble_client_t *client)
 Read Report Map characteristic. More...
 
bool hids_client_discover_external_reports (ble_client_t *client)
 Read External Reports descriptors. More...
 
bool hids_client_discover_reports (ble_client_t *client)
 Read Report Reference descriptors. More...
 
hids_client_cap_t hids_client_get_capabilities (ble_client_t *client)
 Get capabilities. More...
 
void hids_client_dump_dervice_data (ble_client_t *client, hids_client_dump_service_data_cb_t cb)
 Dump HID Service data. More...
 

Detailed Description

Human Interface Device Service Client.

Enumeration Type Documentation

◆ hids_client_boot_report_type

HID Service Client boot report type.

Enumerator
HIDS_CLIENT_BOOT_MOUSE_INPUT 

Boot Mouse Input

HIDS_CLIENT_BOOT_KEYBOARD_INPUT 

Boot Keyboard Input

HIDS_CLIENT_BOOT_KEYBOARD_OUTPUT 

Boot Keyboard Output

◆ hids_client_cap_t

HIDS Client capabilities.

Enumerator
HIDS_CLIENT_CAP_PROTOCOL_MODE 

Protocol Mode characteristic

HIDS_CLIENT_CAP_BOOT_MOUSE_INPUT 

Boot Mouse Input characteristic

HIDS_CLIENT_CAP_BOOT_KEYBOARD_INPUT 

Boot Keyboard Input characteristic

HIDS_CLIENT_CAP_BOOT_KEYBOARD_OUTPUT 

Boot Keyboard Output characteristic

HIDS_CLIENT_CAP_HID_INFO 

HID Info characteristic

HIDS_CLIENT_CAP_HID_CONTROL_POINT 

HID Control Point characteristic

HIDS_CLIENT_CAP_REPORT_MAP 

Report Map characteristic

◆ hids_client_cp_command_t

HID Service Client control point command.

Enumerator
HIDS_CLIENT_CONTROL_POINT_SUSPEND 

Control Point Suspend

HIDS_CLIENT_CONTROL_POINT_EXIT_SUSPEND 

Control Point Exit Suspend

◆ hids_client_protocol_mode_t

HID Service Client protocol mode.

Enumerator
HIDS_CLIENT_PROTOCOL_MODE_BOOT 

Host Mode Boot

HIDS_CLIENT_PROTOCOL_MODE_REPORT 

Host Mode Report

◆ hids_client_report_type_t

HID Service Client report type.

Enumerator
HIDS_CLIENT_REPORT_TYPE_INPUT 

Report Type Input

HIDS_CLIENT_REPORT_TYPE_OUTPUT 

Report Type Output

HIDS_CLIENT_REPORT_TYPE_FEATURE 

Report Type Feature

Function Documentation

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

Function triggers read request to CCC descriptor of given report.

Parameters
[in]clienthids_client instance
[in]typeboot report type
Returns
true if read request has been sent correctly, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_BOOT and type HIDS_CLIENT_BOOT_MOUSE_INPUT or HIDS_CLIENT_BOOT_KEYBOARD_INPUT

◆ hids_client_boot_report_read()

bool hids_client_boot_report_read ( ble_client_t client,
hids_client_boot_report_type  type 
)

Read Boot Report.

Function triggers read operation of Boot Report Characteristic. Read response will be returned in boot_report callback.

Parameters
[in]clientclient
[in]typeType of boot report
Returns
true if read request sent, otherwise false
Note
This should be called when mode is == HIDS_CLIENT_PROTOCOL_MODE_BOOT

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

Function triggers write request to CCC descriptor of given report and registers or unregisters for notifications.

Parameters
[in]clienthids_client instance
[in]typeboot report type
[in]enableindicates if notifications shall be enabled/disabled
Returns
true if write request has been sent correctly, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_BOOT and type HIDS_CLIENT_BOOT_MOUSE_INPUT or HIDS_CLIENT_BOOT_KEYBOARD_INPUT

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

Function triggers write operation of Boot Report Characteristic.

Parameters
[in]clientclient
[in]typetype of boot report
[in]responserequire response - valid only for HIDS_CLIENT_BOOT_KEYBOARD_OUTPUT argument will be ignored in other cases
[in]lengthreport length
[in]datareport data
Returns
true if write request sent, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_BOOT

◆ hids_client_cp_command()

bool hids_client_cp_command ( ble_client_t client,
hids_client_cp_command_t  command 
)

Write command to control point.

Function triggers write operation to Control Point characteristic.

Parameters
[in]clientclient
[in]commandcontrol point command
Returns
true if write command sent, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_REPORT

◆ hids_client_discover_external_reports()

bool hids_client_discover_external_reports ( ble_client_t client)

Read External Reports descriptors.

Function triggers read request to External Report Reference Descriptors. If service supports External Report References, external_report_found will be invoked. Once all read requests are completed, discover_external_reports_complete callback is called. This function should ba called right after init in HIDS_CLIENT_PROTOCOL_MODE_REPORT mode.

Parameters
[in]clienthids_client instance
Returns
true if read requests have been sent correctly, otherwise false

◆ hids_client_discover_reports()

bool hids_client_discover_reports ( ble_client_t client)

Read Report Reference descriptors.

Function triggers read requests to Report Reference descriptors. Callback report_found will be called for each read_response. Once all read requests are completed, discover_reports_completed callback is called. It should be called in HIDS_CLIENT_PROTOCOL_MODE_REPORT right after init.

Parameters
[in]clienthids_client instance
Returns
true if read requests have been sent correctly, otherwise false

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

This function is used to print data about remote service details.

Parameters
[in]clienthids_client instance
[in]cbdump service data callback

◆ hids_client_get_capabilities()

hids_client_cap_t hids_client_get_capabilities ( ble_client_t client)

Get capabilities.

Function returns bitmask with supported characteristics. Note that Report characteristics won't be returned in this function as there might be multiple reports supported.

Parameters
clienthids_client instance
Returns
supported characteristics bitmask

◆ hids_client_get_protocol_mode()

bool hids_client_get_protocol_mode ( ble_client_t client)

Get protocol mode.

Function triggers read request to protocol mode characteristic. Callback get_protocol_mode will be invoked once finished.

Parameters
[in]clienthids_client instance
Returns
true if read request has been sent correctly, otherwise false

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

Function registers HID Client

Parameters
[in]configHIDS client config
[in]cbapplication callbacks
[in]evtbrowse svc event with HID svc details
Returns
client instance

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

Function initializes HID Client from data buffer.

Parameters
[in]conn_idxconnection index
[in]configHIDS client config
[in]cbapplication callbacks
[in]datadata buffer
[in]lengthdata buffer's length
Returns
client instance when initialized properly, NULL otherwise

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

Function triggers read request to CCC descriptor of given report.

Parameters
[in]clienthids_client instance
[in]report_idinput report ID
Returns
true if read request has been sent correctly, otherwise false
Note
This shoud be called only in HIDS_CLIENT_PROTOCOL_MODE_REPORT. This call will trigger input_report_is_enabled callback.

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

Function triggers write request to CCC descriptor of given report and registers or unregisters for notifications.

Parameters
[in]clienthids_client instance
[in]report_idinput report ID
[in]enableindicates if notifications shall be enabled/disabled
Returns
true if write request has been sent correctly, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_REPORT

◆ hids_client_read_hid_info()

bool hids_client_read_hid_info ( ble_client_t client)

Get HID Info characteristic.

Function triggers read request to HID Info characteristic. Callback hid_info_cb will be invoked once finished. It should be called after init in HIDS_CLIENT_PROTOCOL_MODE_REPORT mode.

Parameters
[in]clienthids_client instance
Returns
true if read request has been sent correctly, otherwise false

◆ hids_client_read_report_map()

bool hids_client_read_report_map ( ble_client_t client)

Read Report Map characteristic.

Function triggers read request to Report Map characteristic. Callback report_map_cb will be invoked once finished. It should be called in HIDS_CLIENT_PROTOCOL_MODE_REPORT after init.

Parameters
[in]clienthids_client instance
Returns
true if read request has been sent correctly, otherwise false

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

Function triggers read operation of Report Characteristic. Read response will be returned in report callback.

Parameters
[in]clientclient
[in]typetype of report
[in]report_idreport ID
Returns
true if read request sent, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_REPORT

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

Function triggers write operation of Report Characteristic.

Parameters
[in]clientclient
[in]typetype of boot report
[in]report_idreport ID
[in]responserequire response - valid only for HIDS_CLIENT_REPORT_TYPE_OUTPUT argument will be ignored in other cases
[in]lengthreport length
[in]datareport data
Returns
true if write request sent, otherwise false
Note
This should be called only in HIDS_CLIENT_PROTOCOL_MODE_REPORT

◆ hids_client_set_protocol_mode()

bool hids_client_set_protocol_mode ( ble_client_t client)

Set protocol mode.

Function triggers write command to protocol mode characteristic with protocol mode defined in hids_config structure. Callback set_protocol_mode will be called once operation completed.

Parameters
[in]clientclient
Returns
true if write command sent, false otherwise