HID Service Declarations.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include "hid_device.h"
Data Structures | |
struct | hid_reportref_desc |
HID report reference descriptor instance for device role. More... | |
struct | hid_serv |
HID service instance for device role. More... | |
Typedefs | |
typedef struct hid_reportref_desc | hid_reportref_desc_t |
HID report reference descriptor instance for device role. More... | |
typedef struct hid_serv | hid_serv_t |
HID service instance for device role. More... | |
Enumerations | |
enum | hid_control_mode { SUSPEND = 0, EXIT_SUSPEND } |
HID control point. More... | |
enum | hid_dev_type { HID_MOUSE_MODE = 1, HID_KEYBOARD_MODE } |
Protocol Mode Value. More... | |
enum | hid_proto_mode { HID_BOOT_PROTOCOL_MODE = 0, HID_REPORT_PROTOCOL_MODE } |
Protocol Mode Value. More... | |
enum | hid_report_type { INPUT_REPORT = 1, OUTPUT_REPORT, FEATURE_REPORT } |
HID control point. More... | |
enum | hid_serv_status { HID_SERV_FAILED = -1, HID_SERV_SUCESS = 0, HID_SERV_REG_FAILED, HID_INVALID_INST = 0xFF } |
Error Code for HID service operation. More... | |
Functions | |
void | hid_boot_keyboardreport_update (at_ble_handle_t conn_handle, uint8_t serv_inst, uint8_t *bootreport, uint16_t len) |
Function to update the boot keyboard report. More... | |
void | hid_boot_mousereport_update (at_ble_handle_t conn_handle, uint8_t serv_inst, uint8_t *bootreport, uint16_t len) |
Function to update the boot mouse report. More... | |
uint8_t | hid_get_reportchar (uint16_t handle, uint8_t serv, uint8_t reportid) |
Function to get report characteristic id. More... | |
uint8_t | hid_get_reportid (uint8_t serv, uint16_t handle, uint8_t reportnum) |
Function to get the report ID. More... | |
uint8_t | hid_ntf_instance (uint8_t serv_num, uint16_t char_handle) |
Function to get the notification instance. More... | |
void | hid_serv_def_init (uint8_t servnum) |
service definition initialization function More... | |
uint8_t | hid_serv_get_instance (uint16_t handle) |
Function to get service instance. More... | |
void | hid_serv_init (uint8_t servinst, uint8_t device, uint8_t *mode, uint8_t report_num, uint8_t *report_type, uint8_t **report_val, uint8_t *report_len, hid_info_t *info) |
Initialize the hid profile based on user input. More... | |
void | hid_serv_report_map (uint8_t servinst, uint8_t *report_info, uint16_t len) |
Function update the report descriptor for HID device. More... | |
void | hid_serv_report_update (uint16_t conn_handle, uint8_t serv_inst, uint8_t reportid, uint8_t *report, uint16_t len) |
Function to update the report. More... | |
uint16_t | hid_service_dbreg (uint8_t inst, uint8_t *report_type, uint8_t *report_id, uint8_t report_num) |
Register the service into database. More... | |
typedef struct hid_reportref_desc hid_reportref_desc_t |
HID report reference descriptor instance for device role.
typedef struct hid_serv hid_serv_t |
HID service instance for device role.
enum hid_control_mode |
enum hid_dev_type |
enum hid_proto_mode |
enum hid_report_type |
enum hid_serv_status |
void hid_boot_keyboardreport_update | ( | at_ble_handle_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t * | bootreport, | ||
uint16_t | len | ||
) |
Function to update the boot keyboard report.
[in] | conn_handle | Connection handle |
[in] | serv_inst | Service Instance |
[in] | bootreport | Report to be send |
[in] | len | Length of report |
Function to update the boot keyboard report.
References ALL_UNUSED, at_ble_characteristic_value_get(), at_ble_characteristic_value_set(), at_ble_notification_send(), AT_BLE_SUCCESS, DBG_LOG_DEV, length, and status.
Referenced by hid_prf_boot_keyboardreport_update().
void hid_boot_mousereport_update | ( | at_ble_handle_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t * | bootreport, | ||
uint16_t | len | ||
) |
Function to update the boot mouse report.
[in] | conn_handle | Connection handle |
[in] | serv_inst | Service Instance |
[in] | bootreport | Report to be send |
[in] | len | Length of report |
Function to update the boot mouse report.
References ALL_UNUSED, at_ble_characteristic_value_get(), at_ble_characteristic_value_set(), at_ble_notification_send(), AT_BLE_SUCCESS, DBG_LOG_DEV, length, and status.
Referenced by hid_prf_boot_mousereport_update().
uint8_t hid_get_reportchar | ( | uint16_t | handle, |
uint8_t | serv, | ||
uint8_t | reportid | ||
) |
Function to get report characteristic id.
[in] | handle | Connection handle |
[in] | serv | Service Instance |
[in] | reportid | Report id |
Function to get report characteristic id.
References at_ble_descriptor_value_get(), AT_BLE_SUCCESS, DBG_LOG_DEV, HID_INVALID_INST, HID_NUM_OF_REPORT, id, len, and status.
Referenced by hid_serv_report_update().
uint8_t hid_get_reportid | ( | uint8_t | serv, |
uint16_t | handle, | ||
uint8_t | reportnum | ||
) |
Function to get the report ID.
[in] | serv | HID service instance |
[in] | handle | Connection handle |
[in] | report_num | Number of report |
Function to get the report ID.
References at_ble_descriptor_value_get(), AT_BLE_SUCCESS, DBG_LOG_DEV, HID_INVALID_INST, len, and status.
Referenced by hid_prf_char_changed_handler().
uint8_t hid_ntf_instance | ( | uint8_t | serv_num, |
uint16_t | char_handle | ||
) |
Function to get the notification instance.
[in] | serv_num | Service Instance |
[in] | char_handle | Character Handle |
Function to get the notification instance.
References BOOT_KEY_INPUT_REPORT, BOOT_MOUSE_INPUT_REPORT, CHAR_REPORT, CHAR_REPORT_CCD, CONTROL_POINT, DBG_LOG_DEV, HID_NUM_OF_REPORT, and PROTOCOL_MODE.
Referenced by hid_prf_char_changed_handler().
void hid_serv_def_init | ( | uint8_t | servnum | ) |
service definition initialization function
[in] | servinst | HID service instance |
service definition initialization function
References hid_serv::hid_control_point, hid_serv::hid_dev_boot_keyboard_in_report, hid_serv::hid_dev_boot_keyboard_out_report, hid_serv::hid_dev_boot_mouse_in_report, hid_serv::hid_dev_info, hid_serv::hid_dev_proto_mode_char, hid_serv::hid_dev_report_map_char, hid_serv::hid_dev_report_val_char, hid_serv::hid_dev_serv_handle, hid_serv::hid_dev_serv_uuid, HID_NUM_OF_REPORT, id, and NULL.
Referenced by hid_prf_init().
uint8_t hid_serv_get_instance | ( | uint16_t | handle | ) |
Function to get service instance.
[in] | handle | Connection handle |
Function to get service instance.
References DBG_LOG_DEV, HID_MAX_SERV_INST, and id.
Referenced by hid_prf_char_changed_handler().
void hid_serv_init | ( | uint8_t | servinst, |
uint8_t | device, | ||
uint8_t * | mode, | ||
uint8_t | report_num, | ||
uint8_t * | report_type, | ||
uint8_t ** | report_val, | ||
uint8_t * | report_len, | ||
hid_info_t * | info | ||
) |
Initialize the hid profile based on user input.
[in] | servinst | HID service instance |
[in] | device | HID device |
[in] | mode | HID mode |
[in] | report_num | Number of report |
[in] | report_type | Report Type |
[in] | report_val | Report Value |
[in] | report_len | Report Length |
[in] | info | HID device info |
Initialize the hid profile based on user input.
References at_ble_chr_t::additional_desc_count, at_ble_chr_t::additional_desc_list, AT_BLE_ATTR_NO_PERMISSIONS, AT_BLE_ATTR_READABLE_NO_AUTHN_NO_AUTHR, AT_BLE_ATTR_READABLE_REQ_AUTHN_NO_AUTHR, AT_BLE_ATTR_WRITABLE_NO_AUTHN_NO_AUTHR, AT_BLE_ATTR_WRITABLE_REQ_AUTHN_NO_AUTHR, AT_BLE_CHAR_NOTIFY, AT_BLE_CHAR_READ, AT_BLE_CHAR_WRITE, AT_BLE_CHAR_WRITE_WITHOUT_RESPONSE, AT_BLE_UUID_16, BLE_PAIR_ENABLE, at_ble_service_t::char_count, at_ble_service_t::char_list, at_ble_chr_t::char_val, at_ble_chr_t::client_config_desc, ctrl_point, DBG_LOG, DBG_LOG_PTS, at_ble_generic_att_desc_t::desc_val_length, at_ble_generic_att_desc_t::desc_val_max_length, FEATURE_REPORT, at_ble_generic_att_desc_t::handle, at_ble_server_config_desc_t::handle, at_ble_user_desc_t::handle, at_ble_char_val_t::handle, at_ble_service_t::handle, HID_CHARACTERISTIC_NUM, hid_serv::hid_control_point, hid_serv::hid_dev_boot_keyboard_in_report, hid_serv::hid_dev_boot_keyboard_out_report, hid_serv::hid_dev_boot_mouse_in_report, hid_serv::hid_dev_info, hid_serv::hid_dev_proto_mode_char, hid_serv::hid_dev_report_map_char, hid_serv::hid_dev_report_val_char, hid_serv::hid_dev_serv_handle, hid_serv::hid_dev_serv_uuid, HID_KEYBOARD_MODE, HID_MOUSE_MODE, HID_REPORT_REF_DESC, HID_SERV_UUID, HID_UUID_CHAR_BOOT_KEY_INPUT_REPORT, HID_UUID_CHAR_BOOT_KEY_OUTPUT_REPORT, HID_UUID_CHAR_BOOT_MOUSE_INPUT_REPORT, HID_UUID_CHAR_HID_CONTROL_POINT, HID_UUID_CHAR_HID_INFORMATION, HID_UUID_CHAR_PROTOCOL_MODE, HID_UUID_CHAR_REPORT, HID_UUID_CHAR_REPORT_MAP, i, id, at_ble_service_t::inc_list, at_ble_service_t::included_count, at_ble_char_val_t::init_value, INPUT_REPORT, keyb_in_report, Keyb_out_report, at_ble_user_desc_t::len, at_ble_char_val_t::len, at_ble_char_val_t::max_len, mode, mouse_in_report, NULL, OUTPUT_REPORT, at_ble_generic_att_desc_t::perm, at_ble_server_config_desc_t::perm, at_ble_service_t::perm, at_ble_user_desc_t::permissions, at_ble_char_val_t::permissions, at_ble_chr_t::presentation_format, PRIMARY_SERVICE, printf, at_ble_char_val_t::properties, hid_gatt_serv_handler::serv, hid_gatt_serv_handler::serv_chars, hid_gatt_serv_handler::serv_desc, at_ble_chr_t::server_config_desc, at_ble_uuid_t::type, at_ble_service_t::type, at_ble_chr_t::user_desc, at_ble_user_desc_t::user_description, at_ble_uuid_t::uuid, at_ble_generic_att_desc_t::uuid, at_ble_char_val_t::uuid, and at_ble_service_t::uuid.
Referenced by hid_prf_init().
void hid_serv_report_map | ( | uint8_t | servinst, |
uint8_t * | report_info, | ||
uint16_t | len | ||
) |
Function update the report descriptor for HID device.
[in] | servinst | HID service instance |
[in] | report_info | Report Info |
[in] | len | Length of report |
Function update the report descriptor for HID device.
References at_ble_chr_t::char_val, hid_serv::hid_dev_report_map_char, at_ble_char_val_t::init_value, len, at_ble_char_val_t::len, at_ble_char_val_t::max_len, and hid_gatt_serv_handler::serv_chars.
Referenced by hid_prf_init().
void hid_serv_report_update | ( | uint16_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t | reportid, | ||
uint8_t * | report, | ||
uint16_t | len | ||
) |
Function to update the report.
[in] | conn_handle | Connection handle |
[in] | serv_inst | Service Instance |
[in] | report_id | Report ID |
[in] | report | Report to be send |
[in] | len | Length of report |
Function to update the report.
References at_ble_characteristic_value_set(), at_ble_notification_send(), AT_BLE_SUCCESS, DBG_LOG, DBG_LOG_DEV, hid_get_reportchar(), HID_INVALID_INST, id, and status.
Referenced by hid_prf_report_update().
uint16_t hid_service_dbreg | ( | uint8_t | inst, |
uint8_t * | report_type, | ||
uint8_t * | report_id, | ||
uint8_t | report_num | ||
) |
Register the service into database.
[in] | inst | HID service instance |
[in] | report_type | Report Type |
[in] | report_id | Report ID |
[in] | report_num | Number of report |
Register the service into database.
References at_ble_descriptor_value_set(), at_ble_service_define(), AT_BLE_SUCCESS, DBG_LOG, DBG_LOG_DEV, delay_ms, at_ble_service_t::handle, HID_SERV_FAILED, id, hid_gatt_serv_handler::serv, and status.
Referenced by hid_prf_init().