HID Device Profile.
Copyright (c) 2017-2018 Microchip Technology Inc. and its subsidiaries.
#include <asf.h>
#include "string.h"
#include "ble_utils.h"
#include "ble_manager.h"
#include "hid_device.h"
#include "hid.h"
#include "device_info.h"
Functions | |
void | hid_prf_boot_keyboardreport_update (at_ble_handle_t conn_handle, uint8_t serv_inst, uint8_t *bootreport, uint16_t len) |
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) |
boot report for keyboard to HID host More... | |
at_ble_status_t | hid_prf_char_changed_handler (void *params) |
characteristic change handler function More... | |
uint8_t | hid_prf_conf (hid_prf_info_t *ref) |
device profile configuration function More... | |
void | hid_prf_dev_adv (void) |
device advertisement handler function More... | |
at_ble_status_t | hid_prf_disconnect_event_handler (void *params) |
device disconnected handler function More... | |
void | hid_prf_init (void *param) |
device profile initialization function More... | |
void | hid_prf_report_update (at_ble_handle_t conn_handle, uint8_t serv_inst, uint8_t reportid, uint8_t *report, uint16_t len) |
report to HID host More... | |
void | notify_boot_ntf_handler (boot_ntf_callback_t boot_ntf_fn) |
to user about the new notification configuration set by HID host for boot mode More... | |
void | notify_control_point_handler (control_point_ntf_callback_t control_mode_ntf_fn) |
to user about the control point set by HID host for boot mode More... | |
void | notify_protocol_mode_handler (protocol_mode_ntf_callback_t proto_mode_ntf_fn) |
to user about the new protocol mode set by HID host for boot mode More... | |
void | notify_report_ntf_handler (report_ntf_callback_t report_ntf_fn) |
to user about the new notification configuration set by HID host for report mode More... | |
Variables | |
boot_ntf_callback_t | boot_ntf_cb |
control_point_ntf_callback_t | control_point_ntf_cb |
static const ble_gap_event_cb_t | hid_gap_handle |
static const ble_gatt_server_event_cb_t | hid_gatt_server_handle |
hid_prf_info_t * | hid_prf_dataref [HID_MAX_SERV_INST] |
protocol_mode_ntf_callback_t | mode_ntf_cb |
report_ntf_callback_t | report_ntf_cb |
uint8_t | scan_rsp_data [SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |
void hid_prf_boot_keyboardreport_update | ( | at_ble_handle_t | conn_handle, |
uint8_t | serv_inst, | ||
uint8_t * | bootreport, | ||
uint16_t | len | ||
) |
boot report for keyboard to HID host
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 | ||
) |
boot report for keyboard to HID host
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 | ) |
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 | ) |
device profile configuration function
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 | ) |
device advertisement handler 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 | ) |
device disconnected handler function
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 | ) |
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 | ||
) |
report to HID host
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 | ) |
to user about the new notification configuration set by HID host for boot mode
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 | ) |
to user about the control point set by HID host for boot mode
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 | ) |
to user about the new protocol mode set by HID host for boot mode
Protocol mode handler function.
References mode_ntf_cb.
Referenced by main().
void notify_report_ntf_handler | ( | report_ntf_callback_t | report_ntf_fn | ) |
to user about the new notification configuration set by HID host for report mode
Report notification handler function.
References report_ntf_cb.
Referenced by main().
boot_ntf_callback_t boot_ntf_cb |
Referenced by hid_prf_char_changed_handler(), and notify_boot_ntf_handler().
control_point_ntf_callback_t control_point_ntf_cb |
Referenced by hid_prf_char_changed_handler(), and notify_control_point_handler().
|
static |
|
static |
hid_prf_info_t* hid_prf_dataref[HID_MAX_SERV_INST] |
protocol_mode_ntf_callback_t mode_ntf_cb |
Referenced by hid_prf_char_changed_handler(), and notify_protocol_mode_handler().
report_ntf_callback_t report_ntf_cb |
Referenced by hid_prf_char_changed_handler(), and notify_report_ntf_handler().
uint8_t scan_rsp_data[SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8} |