HID Device Profile Declarations.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include "at_ble_api.h"
Data Structures | |
struct | hid_boot_ntf |
HID boot notification or indication, notify to user. More... | |
struct | hid_control_mode_ntf |
HID control point info, notify to user when control point change by user. More... | |
struct | hid_gatt_serv_handler |
struct | hid_info |
HID info of device. More... | |
struct | hid_prf_info_t |
HID profile application info. More... | |
struct | hid_proto_mode_ntf |
HID protocol mode info, notify to user when protocol mode change by user. More... | |
struct | hid_report_map |
HID Report Map Information. More... | |
struct | hid_report_ntf |
HID report notification or indication, notify to user. More... | |
struct | hid_report_ref |
HID Report Reference Descriptor. More... | |
Macros | |
#define | ADV_DATA_APPEARANCE_DATA (0x03C2) |
Number of characteristic for HID. More... | |
#define | ADV_DATA_APPEARANCE_DATA (0x03C1) |
Number of characteristic for HID. More... | |
#define | ADV_DATA_APPEARANCE_LEN (2) |
Advertisement data appearance len. More... | |
#define | ADV_DATA_APPEARANCE_TYPE (0x19) |
Advertisement appearance type. More... | |
#define | ADV_DATA_NAME_DATA ("ATMEL-HID") |
#define | ADV_DATA_NAME_LEN (9) |
Advertisement data name appearance len. More... | |
#define | ADV_DATA_NAME_TYPE (0x09) |
Advertisement data name type. More... | |
#define | ADV_DATA_UUID_LEN (2) |
Advertisement data UUID length. More... | |
#define | ADV_DATA_UUID_TYPE (0x03) |
Advertisement UUID type. More... | |
#define | ADV_TYPE_LEN (0x01) |
Advertisement type length. More... | |
#define | APP_HID_ADV_TIMEOUT (655) |
APP_HID_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out. More... | |
#define | APP_HID_FAST_ADV (160) |
APP_HID_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s). More... | |
#define | HID_CHARACTERISTIC_NUM (HID_DEFAULT_CHARACTERISITC_NUM + HID_NUM_OF_REPORT + 1) |
#define | HID_CHARACTERISTIC_NUM (HID_DEFAULT_CHARACTERISITC_NUM + HID_NUM_OF_REPORT + 2) |
#define | HID_DEFAULT_CHARACTERISITC_NUM (4) |
Default number of characteristic. More... | |
#define | HID_MAX_REPORT_NUM (10) |
Number of Report. More... | |
#define | HID_MAX_SERV_INST (2) |
HID Max Service Instance. More... | |
#define | HID_NUM_OF_REPORT (1) |
Number of Report : Configure by user. More... | |
#define | HID_SERV_INST (1) |
HID Service Instance : Configure by user. More... | |
#define | SCAN_RESP_LEN (10) |
scan_resp_len is the length of the scan response data More... | |
Typedefs | |
typedef void(* | boot_ntf_callback_t )(hid_boot_ntf_t *) |
Boot notification callback. More... | |
typedef void(* | control_point_ntf_callback_t )(hid_control_mode_ntf_t *) |
COntrol point notification callback. More... | |
typedef struct hid_boot_ntf | hid_boot_ntf_t |
HID boot notification or indication, notify to user. More... | |
typedef struct hid_control_mode_ntf | hid_control_mode_ntf_t |
HID control point info, notify to user when control point change by user. More... | |
typedef struct hid_gatt_serv_handler | hid_gatt_serv_handler_t |
typedef struct hid_info | hid_info_t |
HID info of device. More... | |
typedef struct hid_proto_mode_ntf | hid_proto_mode_ntf_t |
HID protocol mode info, notify to user when protocol mode change by user. More... | |
typedef struct hid_report_map | hid_report_map_t |
HID Report Map Information. More... | |
typedef struct hid_report_ntf | hid_report_ntf_t |
HID report notification or indication, notify to user. More... | |
typedef struct hid_report_ref | hid_report_ref_t |
HID Report Reference Descriptor. More... | |
typedef void(* | protocol_mode_ntf_callback_t )(hid_proto_mode_ntf_t *) |
Protocol mode notification callback. More... | |
typedef void(* | report_ntf_callback_t )(hid_report_ntf_t *) |
Report notification callback. More... | |
Enumerations | |
enum | hid_char_type_t { PROTOCOL_MODE, REPORT_MAP, CHAR_REPORT, CHAR_REPORT_CCD, BOOT_MOUSE_INPUT_REPORT, BOOT_KEY_OUTPUT_REPORT, BOOT_KEY_INPUT_REPORT, HID_INFORMATION, CONTROL_POINT } |
HID characteristic. More... | |
enum | hid_prf_error_t { HID_PRF_SUCESS = 0, HID_PRF_INSTANCE_OUT_RANGE, HID_PRF_NO_INSTANCE } |
HID Profile error code. More... | |
Functions | |
void | hid_prf_boot_keyboardreport_update (at_ble_handle_t conn_handle, uint8_t serv_inst, uint8_t *bootreport, uint16_t len) |
Called by user to notify boot report for keyboard to HID host. More... | |
void | hid_prf_boot_mousereport_update (at_ble_handle_t conn_handle, uint8_t serv_inst, uint8_t *bootreport, uint16_t len) |
Called by user to notify boot report for mouse to HID host. More... | |
at_ble_status_t | hid_prf_char_changed_handler (void *params) |
Service characteristic change handler function. More... | |
uint8_t | hid_prf_conf (hid_prf_info_t *ref) |
HID device profile configuration function. More... | |
void | hid_prf_dev_adv (void) |
HID profile advertisement function. More... | |
at_ble_status_t | hid_prf_disconnect_event_handler (void *params) |
HID device disconnected handler function. More... | |
void | hid_prf_init (void *param) |
HID device profile initialization function. More... | |
void | hid_prf_report_update (uint16_t conn_handle, uint8_t serv_inst, uint8_t reportid, uint8_t *report, uint16_t len) |
Called by user to notify report to HID host. More... | |
void | notify_boot_ntf_handler (boot_ntf_callback_t boot_ntf_fn) |
Boot notification handler function. More... | |
void | notify_control_point_handler (control_point_ntf_callback_t control_mode_ntf_fn) |
Control point notification handler function. More... | |
void | notify_protocol_mode_handler (protocol_mode_ntf_callback_t proto_mode_ntf_fn) |
Protocol mode handler function. More... | |
void | notify_report_ntf_handler (report_ntf_callback_t report_ntf_fn) |
Report notification handler function. More... | |
#define ADV_DATA_APPEARANCE_DATA (0x03C2) |
Number of characteristic for HID.
Enable by user for keyboard application : Configure by user.
Enable by user for mouse application : Configure by user.
#define ADV_DATA_APPEARANCE_DATA (0x03C1) |
Number of characteristic for HID.
Enable by user for keyboard application : Configure by user.
Enable by user for mouse application : Configure by user.
#define ADV_DATA_APPEARANCE_LEN (2) |
Advertisement data appearance len.
#define ADV_DATA_APPEARANCE_TYPE (0x19) |
Advertisement appearance type.
#define ADV_DATA_NAME_DATA ("ATMEL-HID") |
#define ADV_DATA_NAME_LEN (9) |
Advertisement data name appearance len.
#define ADV_DATA_NAME_TYPE (0x09) |
Advertisement data name type.
#define ADV_DATA_UUID_LEN (2) |
Advertisement data UUID length.
#define ADV_DATA_UUID_TYPE (0x03) |
Advertisement UUID type.
#define ADV_TYPE_LEN (0x01) |
Advertisement type length.
#define APP_HID_ADV_TIMEOUT (655) |
APP_HID_ADV_TIMEOUT Advertising time-out between 0x0001 and 0x028F in seconds, 0x0000 disables time-out.
Referenced by hid_prf_dev_adv(), and hid_prf_disconnect_event_handler().
#define APP_HID_FAST_ADV (160) |
APP_HID_FAST_ADV between 0x0020 and 0x4000 in 0.625 ms units (20ms to 10.24s).
Referenced by hid_prf_dev_adv(), and hid_prf_disconnect_event_handler().
#define HID_CHARACTERISTIC_NUM (HID_DEFAULT_CHARACTERISITC_NUM + HID_NUM_OF_REPORT + 1) |
Referenced by hid_serv_init().
#define HID_CHARACTERISTIC_NUM (HID_DEFAULT_CHARACTERISITC_NUM + HID_NUM_OF_REPORT + 2) |
#define HID_DEFAULT_CHARACTERISITC_NUM (4) |
Default number of characteristic.
#define HID_MAX_REPORT_NUM (10) |
Number of Report.
#define HID_MAX_SERV_INST (2) |
HID Max Service Instance.
Referenced by hid_prf_conf(), hid_prf_init(), and hid_serv_get_instance().
#define HID_NUM_OF_REPORT (1) |
Number of Report : Configure by user.
Referenced by hid_get_reportchar(), hid_keyboard_app_init(), hid_mouse_app_init(), hid_ntf_instance(), hid_prf_char_changed_handler(), and hid_serv_def_init().
#define HID_SERV_INST (1) |
HID Service Instance : Configure by user.
#define SCAN_RESP_LEN (10) |
scan_resp_len is the length of the scan response data
typedef void(* boot_ntf_callback_t)(hid_boot_ntf_t *) |
Boot notification callback.
typedef void(* control_point_ntf_callback_t)(hid_control_mode_ntf_t *) |
COntrol point notification callback.
typedef struct hid_boot_ntf hid_boot_ntf_t |
HID boot notification or indication, notify to user.
typedef struct hid_control_mode_ntf hid_control_mode_ntf_t |
HID control point info, notify to user when control point change by user.
typedef struct hid_gatt_serv_handler hid_gatt_serv_handler_t |
typedef struct hid_info hid_info_t |
HID info of device.
typedef struct hid_proto_mode_ntf hid_proto_mode_ntf_t |
HID protocol mode info, notify to user when protocol mode change by user.
typedef struct hid_report_map hid_report_map_t |
HID Report Map Information.
typedef struct hid_report_ntf hid_report_ntf_t |
HID report notification or indication, notify to user.
typedef struct hid_report_ref hid_report_ref_t |
HID Report Reference Descriptor.
typedef void(* protocol_mode_ntf_callback_t)(hid_proto_mode_ntf_t *) |
Protocol mode notification callback.
typedef void(* report_ntf_callback_t)(hid_report_ntf_t *) |
Report notification callback.
enum hid_char_type_t |
enum hid_prf_error_t |
void hid_prf_boot_keyboardreport_update | ( | at_ble_handle_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t * | bootreport, | ||
uint16_t | len | ||
) |
Called by user to notify boot report for keyboard to HID host.
[in] | conn_handle | Connection handle |
[in] | serv_inst | Service instance |
[in] | bootreport | Report info that need to send to host |
[in] | len | Report length |
Called by user to notify boot report for keyboard to HID host.
References hid_boot_keyboardreport_update().
void hid_prf_boot_mousereport_update | ( | at_ble_handle_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t * | bootreport, | ||
uint16_t | len | ||
) |
Called by user to notify boot report for mouse to HID host.
[in] | conn_handle | Connection handle |
[in] | serv_inst | Service instance |
[in] | bootreport | Report info that need to send to host |
[in] | len | Report length |
Called by user to notify boot report for mouse to HID host.
References hid_boot_mousereport_update().
at_ble_status_t hid_prf_char_changed_handler | ( | void * | params | ) |
Service characteristic change handler function.
Service characteristic change handler function.
References AT_BLE_SUCCESS, BOOT_KEY_INPUT_REPORT, BOOT_MOUSE_INPUT_REPORT, boot_ntf_cb, hid_boot_ntf::boot_value, at_ble_characteristic_changed_t::char_handle, at_ble_characteristic_changed_t::char_new_value, CHAR_REPORT_CCD, hid_proto_mode_ntf::conn_handle, hid_boot_ntf::conn_handle, hid_report_ntf::conn_handle, at_ble_characteristic_changed_t::conn_handle, CONTROL_POINT, control_point_ntf_cb, hid_control_mode_ntf::control_value, DBG_LOG_DEV, hid_get_reportid(), hid_ntf_instance(), HID_NUM_OF_REPORT, hid_serv_get_instance(), hid_proto_mode_ntf::mode, mode_ntf_cb, hid_boot_ntf::ntf_conf, hid_report_ntf::ntf_conf, PROTOCOL_MODE, hid_prf_info_t::protocol_mode, hid_report_ntf::report_ID, report_ntf_cb, hid_control_mode_ntf::serv_inst, hid_proto_mode_ntf::serv_inst, hid_boot_ntf::serv_inst, and hid_report_ntf::serv_inst.
uint8_t hid_prf_conf | ( | hid_prf_info_t * | ref | ) |
HID device profile configuration function.
[in] | ref | HID profile application info |
HID device profile configuration function.
References HID_MAX_SERV_INST, HID_PRF_INSTANCE_OUT_RANGE, HID_PRF_NO_INSTANCE, HID_PRF_SUCESS, hid_prf_info_t::hid_serv_instance, and NULL.
Referenced by hid_keyboard_app_init(), and hid_mouse_app_init().
void hid_prf_dev_adv | ( | void | ) |
HID profile advertisement function.
HID profile advertisement function.
References APP_HID_ADV_TIMEOUT, APP_HID_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, ble_advertisement_data_set(), DBG_LOG, and NULL.
Referenced by hid_prf_init().
at_ble_status_t hid_prf_disconnect_event_handler | ( | void * | params | ) |
HID device disconnected handler function.
[in] | disconnect | disconnect info |
HID device disconnected handler function.
References ALL_UNUSED, APP_HID_ADV_TIMEOUT, APP_HID_FAST_ADV, AT_BLE_ADV_FP_ANY, AT_BLE_ADV_GEN_DISCOVERABLE, at_ble_adv_start(), AT_BLE_ADV_TYPE_UNDIRECTED, AT_BLE_SUCCESS, DBG_LOG, and NULL.
void hid_prf_init | ( | void * | param | ) |
HID device profile initialization function.
HID device profile initialization function.
References BLE_GAP_EVENT_TYPE, BLE_GATT_SERVER_EVENT_TYPE, ble_mgr_events_callback_handler(), DBG_LOG_DEV, DBG_LOG_PTS, dis_init_service(), dis_primary_service_define(), HID_MAX_SERV_INST, hid_prf_dev_adv(), hid_serv_def_init(), hid_serv_init(), hid_serv_report_map(), hid_service_dbreg(), NULL, REGISTER_CALL_BACK, hid_prf_info_t::report_map_info, hid_report_map::report_map_len, hid_prf_info_t::serv_handle_info, and UNUSED.
Referenced by main().
void hid_prf_report_update | ( | at_ble_handle_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t | reportid, | ||
uint8_t * | report, | ||
uint16_t | len | ||
) |
Called by user to notify report to HID host.
[in] | conn_handle | Connection handle |
[in] | serv_inst | Service instance |
[in] | reportid | Report ID corresponding to report |
[in] | report | Report info that need to send to host |
[in] | len | Report length |
Called by user to notify report to HID host.
References hid_serv_report_update().
Referenced by main().
void notify_boot_ntf_handler | ( | boot_ntf_callback_t | boot_ntf_fn | ) |
Boot notification handler function.
Boot notification handler function.
References boot_ntf_cb.
Referenced by main().
void notify_control_point_handler | ( | control_point_ntf_callback_t | control_mode_ntf_fn | ) |
Control point notification handler function.
Control point notification handler function.
References control_point_ntf_cb.
Referenced by main().
void notify_protocol_mode_handler | ( | protocol_mode_ntf_callback_t | proto_mode_ntf_fn | ) |
Protocol mode handler function.
Protocol mode handler function.
References mode_ntf_cb.
Referenced by main().
void notify_report_ntf_handler | ( | report_ntf_callback_t | report_ntf_fn | ) |
Report notification handler function.
Report notification handler function.
References report_ntf_cb.
Referenced by main().