テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

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