BLE FOTA APP

Dependencies:   BLE_API mbed

It doesn't work with the default FOTA bootloader. It use NVIC_SystemReset() to enter a bootloader.

Committer:
yihui
Date:
Fri Oct 10 03:36:28 2014 +0000
Revision:
1:a607cd9655d7
use NVIC_SystemReset() to run bootloader

Who changed what in which revision?

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