Microchip® Advanced Software Framework

hid_device.c File Reference

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_thid_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().

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  )
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_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().

const ble_gap_event_cb_t hid_gap_handle
static
Initial value:
= {
}
at_ble_status_t hid_prf_disconnect_event_handler(void *params)
device disconnected handler function
Definition: hid_device.c:174
const ble_gatt_server_event_cb_t hid_gatt_server_handle
static
Initial value:
= {
.characteristic_changed = hid_prf_char_changed_handler
}
at_ble_status_t hid_prf_char_changed_handler(void *params)
characteristic change handler function
Definition: hid_device.c:189
hid_prf_info_t* hid_prf_dataref[HID_MAX_SERV_INST]
uint8_t scan_rsp_data[SCAN_RESP_LEN] = {0x09, 0xff, 0x00, 0x06, 0xd6, 0xb2, 0xf0, 0x05, 0xf0, 0xf8}