nochanges

Dependents:   BLE_Acceleration_Statejudging

Fork of nRF51822 by Nordic Semiconductor

Committer:
MonroeLee
Date:
Thu Jun 09 05:15:47 2016 +0000
Revision:
638:6efcf74f000d
Parent:
37:c29c330d942c
no changes

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Rohit Grover 37:c29c330d942c 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
Rohit Grover 37:c29c330d942c 2 *
Rohit Grover 37:c29c330d942c 3 * The information contained herein is property of Nordic Semiconductor ASA.
Rohit Grover 37:c29c330d942c 4 * Terms and conditions of usage are described in detail in NORDIC
Rohit Grover 37:c29c330d942c 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
Rohit Grover 37:c29c330d942c 6 *
Rohit Grover 37:c29c330d942c 7 * Licensees are granted free, non-transferable use of the information. NO
Rohit Grover 37:c29c330d942c 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
Rohit Grover 37:c29c330d942c 9 * the file.
Rohit Grover 37:c29c330d942c 10 *
Rohit Grover 37:c29c330d942c 11 */
Rohit Grover 37:c29c330d942c 12
Rohit Grover 37:c29c330d942c 13 /** @file
Rohit Grover 37:c29c330d942c 14 *
Rohit Grover 37:c29c330d942c 15 * @defgroup ble_sdk_srv_hids Human Interface Device Service
Rohit Grover 37:c29c330d942c 16 * @{
Rohit Grover 37:c29c330d942c 17 * @ingroup ble_sdk_srv
Rohit Grover 37:c29c330d942c 18 * @brief Human Interface Device Service module.
Rohit Grover 37:c29c330d942c 19 *
Rohit Grover 37:c29c330d942c 20 * @details This module implements the Human Interface Device Service with the corresponding set of
Rohit Grover 37:c29c330d942c 21 * characteristics. During initialization it adds the Human Interface Device Service and
Rohit Grover 37:c29c330d942c 22 * a set of characteristics as per the Human Interface Device Service specification and
Rohit Grover 37:c29c330d942c 23 * the user requirements to the BLE stack database.
Rohit Grover 37:c29c330d942c 24 *
Rohit Grover 37:c29c330d942c 25 * If enabled, notification of Input Report characteristics is performed when the
Rohit Grover 37:c29c330d942c 26 * application calls the corresponding ble_hids_xx_input_report_send() function.
Rohit Grover 37:c29c330d942c 27 *
Rohit Grover 37:c29c330d942c 28 * If an event handler is supplied by the application, the Human Interface Device Service
Rohit Grover 37:c29c330d942c 29 * will generate Human Interface Device Service events to the application.
Rohit Grover 37:c29c330d942c 30 *
Rohit Grover 37:c29c330d942c 31 * @note The application must propagate BLE stack events to the Human Interface Device Service
Rohit Grover 37:c29c330d942c 32 * module by calling ble_hids_on_ble_evt() from the @ref ble_stack_handler callback.
Rohit Grover 37:c29c330d942c 33 *
Rohit Grover 37:c29c330d942c 34 * @note Attention!
Rohit Grover 37:c29c330d942c 35 * To maintain compliance with Nordic Semiconductor ASA Bluetooth profile
Rohit Grover 37:c29c330d942c 36 * qualification listings, this section of source code must not be modified.
Rohit Grover 37:c29c330d942c 37 */
Rohit Grover 37:c29c330d942c 38
Rohit Grover 37:c29c330d942c 39 #ifndef BLE_HIDS_H__
Rohit Grover 37:c29c330d942c 40 #define BLE_HIDS_H__
Rohit Grover 37:c29c330d942c 41
Rohit Grover 37:c29c330d942c 42 #include <stdint.h>
Rohit Grover 37:c29c330d942c 43 #include <stdbool.h>
Rohit Grover 37:c29c330d942c 44 #include "ble.h"
Rohit Grover 37:c29c330d942c 45 #include "ble_srv_common.h"
Rohit Grover 37:c29c330d942c 46
Rohit Grover 37:c29c330d942c 47 // Report Type values
Rohit Grover 37:c29c330d942c 48 #define BLE_HIDS_REP_TYPE_INPUT 1
Rohit Grover 37:c29c330d942c 49 #define BLE_HIDS_REP_TYPE_OUTPUT 2
Rohit Grover 37:c29c330d942c 50 #define BLE_HIDS_REP_TYPE_FEATURE 3
Rohit Grover 37:c29c330d942c 51
Rohit Grover 37:c29c330d942c 52 // Maximum number of the various Report Types
Rohit Grover 37:c29c330d942c 53 #define BLE_HIDS_MAX_INPUT_REP 10
Rohit Grover 37:c29c330d942c 54 #define BLE_HIDS_MAX_OUTPUT_REP 10
Rohit Grover 37:c29c330d942c 55 #define BLE_HIDS_MAX_FEATURE_REP 10
Rohit Grover 37:c29c330d942c 56
Rohit Grover 37:c29c330d942c 57 // Information Flags
Rohit Grover 37:c29c330d942c 58 #define HID_INFO_FLAG_REMOTE_WAKE_MSK 0x01
Rohit Grover 37:c29c330d942c 59 #define HID_INFO_FLAG_NORMALLY_CONNECTABLE_MSK 0x02
Rohit Grover 37:c29c330d942c 60
Rohit Grover 37:c29c330d942c 61 /**@brief HID Service characteristic id. */
Rohit Grover 37:c29c330d942c 62 typedef struct
Rohit Grover 37:c29c330d942c 63 {
Rohit Grover 37:c29c330d942c 64 uint16_t uuid; /**< UUID of characteristic. */
Rohit Grover 37:c29c330d942c 65 uint8_t rep_type; /**< Type of report (only used for BLE_UUID_REPORT_CHAR, see @ref BLE_HIDS_REPORT_TYPE). */
Rohit Grover 37:c29c330d942c 66 uint8_t rep_index; /**< Index of the characteristic (only used for BLE_UUID_REPORT_CHAR). */
Rohit Grover 37:c29c330d942c 67 } ble_hids_char_id_t;
Rohit Grover 37:c29c330d942c 68
Rohit Grover 37:c29c330d942c 69 /**@brief HID Service event type. */
Rohit Grover 37:c29c330d942c 70 typedef enum
Rohit Grover 37:c29c330d942c 71 {
Rohit Grover 37:c29c330d942c 72 BLE_HIDS_EVT_HOST_SUSP, /**< Suspend command received. */
Rohit Grover 37:c29c330d942c 73 BLE_HIDS_EVT_HOST_EXIT_SUSP, /**< Exit suspend command received. */
Rohit Grover 37:c29c330d942c 74 BLE_HIDS_EVT_NOTIF_ENABLED, /**< Notification enabled event. */
Rohit Grover 37:c29c330d942c 75 BLE_HIDS_EVT_NOTIF_DISABLED, /**< Notification disabled event. */
Rohit Grover 37:c29c330d942c 76 BLE_HIDS_EVT_REP_CHAR_WRITE, /**< A new value has been written to an Report characteristic. */
Rohit Grover 37:c29c330d942c 77 BLE_HIDS_EVT_BOOT_MODE_ENTERED, /**< Boot mode entered. */
Rohit Grover 37:c29c330d942c 78 BLE_HIDS_EVT_REPORT_MODE_ENTERED, /**< Report mode entered. */
Rohit Grover 37:c29c330d942c 79 BLE_HIDS_EVT_REPORT_READ /**< Read with response */
Rohit Grover 37:c29c330d942c 80 } ble_hids_evt_type_t;
Rohit Grover 37:c29c330d942c 81
Rohit Grover 37:c29c330d942c 82 /**@brief HID Service event. */
Rohit Grover 37:c29c330d942c 83 typedef struct
Rohit Grover 37:c29c330d942c 84 {
Rohit Grover 37:c29c330d942c 85 ble_hids_evt_type_t evt_type; /**< Type of event. */
Rohit Grover 37:c29c330d942c 86 union
Rohit Grover 37:c29c330d942c 87 {
Rohit Grover 37:c29c330d942c 88 struct
Rohit Grover 37:c29c330d942c 89 {
Rohit Grover 37:c29c330d942c 90 ble_hids_char_id_t char_id; /**< Id of characteristic for which notification has been started. */
Rohit Grover 37:c29c330d942c 91 } notification;
Rohit Grover 37:c29c330d942c 92 struct
Rohit Grover 37:c29c330d942c 93 {
Rohit Grover 37:c29c330d942c 94 ble_hids_char_id_t char_id; /**< Id of characteristic having been written. */
Rohit Grover 37:c29c330d942c 95 uint16_t offset; /**< Offset for the write operation. */
Rohit Grover 37:c29c330d942c 96 uint16_t len; /**< Length of the incoming data. */
Rohit Grover 37:c29c330d942c 97 uint8_t* data; /**< Incoming data, variable length */
Rohit Grover 37:c29c330d942c 98 } char_write;
Rohit Grover 37:c29c330d942c 99 struct
Rohit Grover 37:c29c330d942c 100 {
Rohit Grover 37:c29c330d942c 101 ble_hids_char_id_t char_id; /**< Id of characteristic being read. */
Rohit Grover 37:c29c330d942c 102 } char_auth_read;
Rohit Grover 37:c29c330d942c 103 } params;
Rohit Grover 37:c29c330d942c 104 ble_evt_t * p_ble_evt; /**< corresponding received ble event, NULL if not relevant */
Rohit Grover 37:c29c330d942c 105 } ble_hids_evt_t;
Rohit Grover 37:c29c330d942c 106
Rohit Grover 37:c29c330d942c 107 // Forward declaration of the ble_hids_t type.
Rohit Grover 37:c29c330d942c 108 typedef struct ble_hids_s ble_hids_t;
Rohit Grover 37:c29c330d942c 109
Rohit Grover 37:c29c330d942c 110 /**@brief HID Service event handler type. */
Rohit Grover 37:c29c330d942c 111 typedef void (*ble_hids_evt_handler_t) (ble_hids_t * p_hids, ble_hids_evt_t * p_evt);
Rohit Grover 37:c29c330d942c 112
Rohit Grover 37:c29c330d942c 113 /**@brief HID Information characteristic value. */
Rohit Grover 37:c29c330d942c 114 typedef struct
Rohit Grover 37:c29c330d942c 115 {
Rohit Grover 37:c29c330d942c 116 uint16_t bcd_hid; /**< 16-bit unsigned integer representing version number of base USB HID Specification implemented by HID Device */
Rohit Grover 37:c29c330d942c 117 uint8_t b_country_code; /**< Identifies which country the hardware is localized for. Most hardware is not localized and thus this value would be zero (0). */
Rohit Grover 37:c29c330d942c 118 uint8_t flags; /**< See http://developer.bluetooth.org/gatt/characteristics/Pages/CharacteristicViewer.aspx?u=org.bluetooth.characteristic.hid_information.xml */
Rohit Grover 37:c29c330d942c 119 ble_srv_security_mode_t security_mode; /**< Security mode for the HID Information characteristic. */
Rohit Grover 37:c29c330d942c 120 } ble_hids_hid_information_t;
Rohit Grover 37:c29c330d942c 121
Rohit Grover 37:c29c330d942c 122 /**@brief HID Service Input Report characteristic init structure. This contains all options and
Rohit Grover 37:c29c330d942c 123 * data needed for initialization of one Input Report characteristic. */
Rohit Grover 37:c29c330d942c 124 typedef struct
Rohit Grover 37:c29c330d942c 125 {
Rohit Grover 37:c29c330d942c 126 uint16_t max_len; /**< Maximum length of characteristic value. */
Rohit Grover 37:c29c330d942c 127 ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */
Rohit Grover 37:c29c330d942c 128 ble_srv_cccd_security_mode_t security_mode; /**< Security mode for the HID Input Report characteristic, including cccd. */
Rohit Grover 37:c29c330d942c 129 uint8_t read_resp : 1; /**< Should application generate a response to read requests. */
Rohit Grover 37:c29c330d942c 130 } ble_hids_inp_rep_init_t;
Rohit Grover 37:c29c330d942c 131
Rohit Grover 37:c29c330d942c 132 /**@brief HID Service Output Report characteristic init structure. This contains all options and
Rohit Grover 37:c29c330d942c 133 * data needed for initialization of one Output Report characteristic. */
Rohit Grover 37:c29c330d942c 134 typedef struct
Rohit Grover 37:c29c330d942c 135 {
Rohit Grover 37:c29c330d942c 136 uint16_t max_len; /**< Maximum length of characteristic value. */
Rohit Grover 37:c29c330d942c 137 ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */
Rohit Grover 37:c29c330d942c 138 ble_srv_cccd_security_mode_t security_mode; /**< Security mode for the HID Output Report characteristic, including cccd. */
Rohit Grover 37:c29c330d942c 139 uint8_t read_resp : 1; /**< Should application generate a response to read requests. */
Rohit Grover 37:c29c330d942c 140 } ble_hids_outp_rep_init_t;
Rohit Grover 37:c29c330d942c 141
Rohit Grover 37:c29c330d942c 142 /**@brief HID Service Feature Report characteristic init structure. This contains all options and
Rohit Grover 37:c29c330d942c 143 * data needed for initialization of one Feature Report characteristic. */
Rohit Grover 37:c29c330d942c 144 typedef struct
Rohit Grover 37:c29c330d942c 145 {
Rohit Grover 37:c29c330d942c 146 uint16_t max_len; /**< Maximum length of characteristic value. */
Rohit Grover 37:c29c330d942c 147 ble_srv_report_ref_t rep_ref; /**< Value of the Report Reference descriptor. */
Rohit Grover 37:c29c330d942c 148 ble_srv_cccd_security_mode_t security_mode; /**< Security mode for the HID Service Feature Report characteristic, including cccd. */
Rohit Grover 37:c29c330d942c 149 uint8_t read_resp : 1; /**< Should application generate a response to read requests. */
Rohit Grover 37:c29c330d942c 150 } ble_hids_feature_rep_init_t;
Rohit Grover 37:c29c330d942c 151
Rohit Grover 37:c29c330d942c 152 /**@brief HID Service Report Map characteristic init structure. This contains all options and data
Rohit Grover 37:c29c330d942c 153 * needed for initialization of the Report Map characteristic. */
Rohit Grover 37:c29c330d942c 154 typedef struct
Rohit Grover 37:c29c330d942c 155 {
Rohit Grover 37:c29c330d942c 156 uint8_t * p_data; /**< Report map data. */
Rohit Grover 37:c29c330d942c 157 uint16_t data_len; /**< Length of report map data. */
Rohit Grover 37:c29c330d942c 158 uint8_t ext_rep_ref_num; /**< Number of Optional External Report Reference descriptors. */
Rohit Grover 37:c29c330d942c 159 ble_uuid_t * p_ext_rep_ref; /**< Optional External Report Reference descriptor (will be added if != NULL). */
Rohit Grover 37:c29c330d942c 160 ble_srv_security_mode_t security_mode; /**< Security mode for the HID Service Report Map characteristic. */
Rohit Grover 37:c29c330d942c 161 } ble_hids_rep_map_init_t;
Rohit Grover 37:c29c330d942c 162
Rohit Grover 37:c29c330d942c 163 /**@brief HID Report characteristic structure. */
Rohit Grover 37:c29c330d942c 164 typedef struct
Rohit Grover 37:c29c330d942c 165 {
Rohit Grover 37:c29c330d942c 166 ble_gatts_char_handles_t char_handles; /**< Handles related to the Report characteristic. */
Rohit Grover 37:c29c330d942c 167 uint16_t ref_handle; /**< Handle of the Report Reference descriptor. */
Rohit Grover 37:c29c330d942c 168 } ble_hids_rep_char_t;
Rohit Grover 37:c29c330d942c 169
Rohit Grover 37:c29c330d942c 170 /**@brief HID Service init structure. This contains all options and data needed for initialization
Rohit Grover 37:c29c330d942c 171 * of the service. */
Rohit Grover 37:c29c330d942c 172 typedef struct
Rohit Grover 37:c29c330d942c 173 {
Rohit Grover 37:c29c330d942c 174 ble_hids_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the HID Service. */
Rohit Grover 37:c29c330d942c 175 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
Rohit Grover 37:c29c330d942c 176 bool is_kb; /**< TRUE if device is operating as a keyboard, FALSE if it is not. */
Rohit Grover 37:c29c330d942c 177 bool is_mouse; /**< TRUE if device is operating as a mouse, FALSE if it is not. */
Rohit Grover 37:c29c330d942c 178 uint8_t inp_rep_count; /**< Number of Input Report characteristics. */
Rohit Grover 37:c29c330d942c 179 ble_hids_inp_rep_init_t * p_inp_rep_array; /**< Information about the Input Report characteristics. */
Rohit Grover 37:c29c330d942c 180 uint8_t outp_rep_count; /**< Number of Output Report characteristics. */
Rohit Grover 37:c29c330d942c 181 ble_hids_outp_rep_init_t * p_outp_rep_array; /**< Information about the Output Report characteristics. */
Rohit Grover 37:c29c330d942c 182 uint8_t feature_rep_count; /**< Number of Feature Report characteristics. */
Rohit Grover 37:c29c330d942c 183 ble_hids_feature_rep_init_t * p_feature_rep_array; /**< Information about the Feature Report characteristics. */
Rohit Grover 37:c29c330d942c 184 ble_hids_rep_map_init_t rep_map; /**< Information nedeed for initialization of the Report Map characteristic. */
Rohit Grover 37:c29c330d942c 185 ble_hids_hid_information_t hid_information; /**< Value of the HID Information characteristic. */
Rohit Grover 37:c29c330d942c 186 uint8_t included_services_count; /**< Number of services to include in HID service. */
Rohit Grover 37:c29c330d942c 187 uint16_t * p_included_services_array; /**< Array of services to include in HID service. */
Rohit Grover 37:c29c330d942c 188 ble_srv_security_mode_t security_mode_protocol; /**< Security settings for HID service protocol attribute */
Rohit Grover 37:c29c330d942c 189 ble_srv_security_mode_t security_mode_ctrl_point; /**< Security settings for HID service Control Point attribute */
Rohit Grover 37:c29c330d942c 190 ble_srv_cccd_security_mode_t security_mode_boot_mouse_inp_rep; /**< Security settings for HID service Mouse input report attribute */
Rohit Grover 37:c29c330d942c 191 ble_srv_cccd_security_mode_t security_mode_boot_kb_inp_rep; /**< Security settings for HID service Keyboard input report attribute */
Rohit Grover 37:c29c330d942c 192 ble_srv_security_mode_t security_mode_boot_kb_outp_rep; /**< Security settings for HID service Keyboard output report attribute */
Rohit Grover 37:c29c330d942c 193 } ble_hids_init_t;
Rohit Grover 37:c29c330d942c 194
Rohit Grover 37:c29c330d942c 195 /**@brief HID Service structure. This contains various status information for the service. */
Rohit Grover 37:c29c330d942c 196 typedef struct ble_hids_s
Rohit Grover 37:c29c330d942c 197 {
Rohit Grover 37:c29c330d942c 198 ble_hids_evt_handler_t evt_handler; /**< Event handler to be called for handling events in the HID Service. */
Rohit Grover 37:c29c330d942c 199 ble_srv_error_handler_t error_handler; /**< Function to be called in case of an error. */
Rohit Grover 37:c29c330d942c 200 uint16_t service_handle; /**< Handle of HID Service (as provided by the BLE stack). */
Rohit Grover 37:c29c330d942c 201 ble_gatts_char_handles_t protocol_mode_handles; /**< Handles related to the Protocol Mode characteristic (will only be created if ble_hids_init_t.is_kb or ble_hids_init_t.is_mouse is set). */
Rohit Grover 37:c29c330d942c 202 uint8_t inp_rep_count; /**< Number of Input Report characteristics. */
Rohit Grover 37:c29c330d942c 203 ble_hids_rep_char_t inp_rep_array[BLE_HIDS_MAX_INPUT_REP]; /**< Information about the Input Report characteristics. */
Rohit Grover 37:c29c330d942c 204 uint8_t outp_rep_count; /**< Number of Output Report characteristics. */
Rohit Grover 37:c29c330d942c 205 ble_hids_rep_char_t outp_rep_array[BLE_HIDS_MAX_OUTPUT_REP]; /**< Information about the Output Report characteristics. */
Rohit Grover 37:c29c330d942c 206 uint8_t feature_rep_count; /**< Number of Feature Report characteristics. */
Rohit Grover 37:c29c330d942c 207 ble_hids_rep_char_t feature_rep_array[BLE_HIDS_MAX_FEATURE_REP]; /**< Information about the Feature Report characteristics. */
Rohit Grover 37:c29c330d942c 208 ble_gatts_char_handles_t rep_map_handles; /**< Handles related to the Report Map characteristic. */
Rohit Grover 37:c29c330d942c 209 uint16_t rep_map_ext_rep_ref_handle; /**< Handle of the Report Map External Report Reference descriptor. */
Rohit Grover 37:c29c330d942c 210 ble_gatts_char_handles_t boot_kb_inp_rep_handles; /**< Handles related to the Boot Keyboard Input Report characteristic (will only be created if ble_hids_init_t.is_kb is set). */
Rohit Grover 37:c29c330d942c 211 ble_gatts_char_handles_t boot_kb_outp_rep_handles; /**< Handles related to the Boot Keyboard Output Report characteristic (will only be created if ble_hids_init_t.is_kb is set). */
Rohit Grover 37:c29c330d942c 212 ble_gatts_char_handles_t boot_mouse_inp_rep_handles; /**< Handles related to the Boot Mouse Input Report characteristic (will only be created if ble_hids_init_t.is_mouse is set). */
Rohit Grover 37:c29c330d942c 213 ble_gatts_char_handles_t hid_information_handles; /**< Handles related to the Report Map characteristic. */
Rohit Grover 37:c29c330d942c 214 ble_gatts_char_handles_t hid_control_point_handles; /**< Handles related to the Report Map characteristic. */
Rohit Grover 37:c29c330d942c 215 uint16_t conn_handle; /**< Handle of the current connection (as provided by the BLE stack, is BLE_CONN_HANDLE_INVALID if not in a connection). */
Rohit Grover 37:c29c330d942c 216 } ble_hids_t;
Rohit Grover 37:c29c330d942c 217
Rohit Grover 37:c29c330d942c 218 /**@brief Function for initializing the HID Service.
Rohit Grover 37:c29c330d942c 219 *
Rohit Grover 37:c29c330d942c 220 * @param[out] p_hids HID Service structure. This structure will have to be supplied by the
Rohit Grover 37:c29c330d942c 221 * application. It will be initialized by this function, and will later be
Rohit Grover 37:c29c330d942c 222 * used to identify this particular service instance.
Rohit Grover 37:c29c330d942c 223 * @param[in] p_hids_init Information needed to initialize the service.
Rohit Grover 37:c29c330d942c 224 *
Rohit Grover 37:c29c330d942c 225 * @return NRF_SUCCESS on successful initialization of service, otherwise an error code.
Rohit Grover 37:c29c330d942c 226 */
Rohit Grover 37:c29c330d942c 227 uint32_t ble_hids_init(ble_hids_t * p_hids, const ble_hids_init_t * p_hids_init);
Rohit Grover 37:c29c330d942c 228
Rohit Grover 37:c29c330d942c 229 /**@brief Function for handling the Application's BLE Stack events.
Rohit Grover 37:c29c330d942c 230 *
Rohit Grover 37:c29c330d942c 231 * @details Handles all events from the BLE stack of interest to the HID Service.
Rohit Grover 37:c29c330d942c 232 *
Rohit Grover 37:c29c330d942c 233 * @param[in] p_hids HID Service structure.
Rohit Grover 37:c29c330d942c 234 * @param[in] p_ble_evt Event received from the BLE stack.
Rohit Grover 37:c29c330d942c 235 */
Rohit Grover 37:c29c330d942c 236 void ble_hids_on_ble_evt(ble_hids_t * p_hids, ble_evt_t * p_ble_evt);
Rohit Grover 37:c29c330d942c 237
Rohit Grover 37:c29c330d942c 238 /**@brief Function for sending Input Report.
Rohit Grover 37:c29c330d942c 239 *
Rohit Grover 37:c29c330d942c 240 * @details Sends data on an Input Report characteristic.
Rohit Grover 37:c29c330d942c 241 *
Rohit Grover 37:c29c330d942c 242 * @param[in] p_hids HID Service structure.
Rohit Grover 37:c29c330d942c 243 * @param[in] rep_index Index of the characteristic (corresponding to the index in
Rohit Grover 37:c29c330d942c 244 * ble_hids_t.inp_rep_array as passed to ble_hids_init()).
Rohit Grover 37:c29c330d942c 245 * @param[in] len Length of data to be sent.
Rohit Grover 37:c29c330d942c 246 * @param[in] p_data Pointer to data to be sent.
Rohit Grover 37:c29c330d942c 247 *
Rohit Grover 37:c29c330d942c 248 * @return NRF_SUCCESS on successful sending of input report, otherwise an error code.
Rohit Grover 37:c29c330d942c 249 */
Rohit Grover 37:c29c330d942c 250 uint32_t ble_hids_inp_rep_send(ble_hids_t * p_hids,
Rohit Grover 37:c29c330d942c 251 uint8_t rep_index,
Rohit Grover 37:c29c330d942c 252 uint16_t len,
Rohit Grover 37:c29c330d942c 253 uint8_t * p_data);
Rohit Grover 37:c29c330d942c 254
Rohit Grover 37:c29c330d942c 255 /**@brief Function for sending Boot Keyboard Input Report.
Rohit Grover 37:c29c330d942c 256 *
Rohit Grover 37:c29c330d942c 257 * @details Sends data on an Boot Keyboard Input Report characteristic.
Rohit Grover 37:c29c330d942c 258 *
Rohit Grover 37:c29c330d942c 259 * @param[in] p_hids HID Service structure.
Rohit Grover 37:c29c330d942c 260 * @param[in] len Length of data to be sent.
Rohit Grover 37:c29c330d942c 261 * @param[in] p_data Pointer to data to be sent.
Rohit Grover 37:c29c330d942c 262 *
Rohit Grover 37:c29c330d942c 263 * @return NRF_SUCCESS on successful sending of the report, otherwise an error code.
Rohit Grover 37:c29c330d942c 264 */
Rohit Grover 37:c29c330d942c 265 uint32_t ble_hids_boot_kb_inp_rep_send(ble_hids_t * p_hids,
Rohit Grover 37:c29c330d942c 266 uint16_t len,
Rohit Grover 37:c29c330d942c 267 uint8_t * p_data);
Rohit Grover 37:c29c330d942c 268
Rohit Grover 37:c29c330d942c 269 /**@brief Function for sending Boot Mouse Input Report.
Rohit Grover 37:c29c330d942c 270 *
Rohit Grover 37:c29c330d942c 271 * @details Sends data on an Boot Mouse Input Report characteristic.
Rohit Grover 37:c29c330d942c 272 *
Rohit Grover 37:c29c330d942c 273 * @param[in] p_hids HID Service structure.
Rohit Grover 37:c29c330d942c 274 * @param[in] buttons State of mouse buttons.
Rohit Grover 37:c29c330d942c 275 * @param[in] x_delta Horizontal movement.
Rohit Grover 37:c29c330d942c 276 * @param[in] y_delta Vertical movement.
Rohit Grover 37:c29c330d942c 277 * @param[in] optional_data_len Length of optional part of Boot Mouse Input Report.
Rohit Grover 37:c29c330d942c 278 * @param[in] p_optional_data Optional part of Boot Mouse Input Report.
Rohit Grover 37:c29c330d942c 279 *
Rohit Grover 37:c29c330d942c 280 * @return NRF_SUCCESS on successful sending of the report, otherwise an error code.
Rohit Grover 37:c29c330d942c 281 */
Rohit Grover 37:c29c330d942c 282 uint32_t ble_hids_boot_mouse_inp_rep_send(ble_hids_t * p_hids,
Rohit Grover 37:c29c330d942c 283 uint8_t buttons,
Rohit Grover 37:c29c330d942c 284 int8_t x_delta,
Rohit Grover 37:c29c330d942c 285 int8_t y_delta,
Rohit Grover 37:c29c330d942c 286 uint16_t optional_data_len,
Rohit Grover 37:c29c330d942c 287 uint8_t * p_optional_data);
Rohit Grover 37:c29c330d942c 288
Rohit Grover 37:c29c330d942c 289 /**@brief Function for getting the current value of Output Report from the stack.
Rohit Grover 37:c29c330d942c 290 *
Rohit Grover 37:c29c330d942c 291 * @details Fetches the current value of the output report characteristic from the stack.
Rohit Grover 37:c29c330d942c 292 *
Rohit Grover 37:c29c330d942c 293 * @param[in] p_hids HID Service structure.
Rohit Grover 37:c29c330d942c 294 * @param[in] rep_index Index of the characteristic (corresponding to the index in
Rohit Grover 37:c29c330d942c 295 * ble_hids_t.outp_rep_array as passed to ble_hids_init()).
Rohit Grover 37:c29c330d942c 296 * @param[in] len Length of output report needed.
Rohit Grover 37:c29c330d942c 297 * @param[in] offset Offset in bytes to read from.
Rohit Grover 37:c29c330d942c 298 * @param[out] p_outp_rep Pointer to the output report.
Rohit Grover 37:c29c330d942c 299 *
Rohit Grover 37:c29c330d942c 300 * @return NRF_SUCCESS on successful read of the report, otherwise an error code.
Rohit Grover 37:c29c330d942c 301 */
Rohit Grover 37:c29c330d942c 302 uint32_t ble_hids_outp_rep_get(ble_hids_t * p_hids,
Rohit Grover 37:c29c330d942c 303 uint8_t rep_index,
Rohit Grover 37:c29c330d942c 304 uint16_t len,
Rohit Grover 37:c29c330d942c 305 uint8_t offset,
Rohit Grover 37:c29c330d942c 306 uint8_t * p_outp_rep);
Rohit Grover 37:c29c330d942c 307
Rohit Grover 37:c29c330d942c 308 #endif // BLE_HIDS_H__
Rohit Grover 37:c29c330d942c 309
Rohit Grover 37:c29c330d942c 310 /** @} */