BLE_Nano nRF51 Central heart rate
nRF51_SDK_11/components/softdevice/s130/headers/ble_gattc.h@0:2b9b5764efb5, 2016-05-26 (annotated)
- Committer:
- FranKP2138
- Date:
- Thu May 26 10:12:27 2016 +0000
- Revision:
- 0:2b9b5764efb5
RedBearLab BLE_Nano Central role for heart rate
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
FranKP2138 | 0:2b9b5764efb5 | 1 | /* |
FranKP2138 | 0:2b9b5764efb5 | 2 | * Copyright (c) Nordic Semiconductor ASA |
FranKP2138 | 0:2b9b5764efb5 | 3 | * All rights reserved. |
FranKP2138 | 0:2b9b5764efb5 | 4 | * |
FranKP2138 | 0:2b9b5764efb5 | 5 | * Redistribution and use in source and binary forms, with or without modification, |
FranKP2138 | 0:2b9b5764efb5 | 6 | * are permitted provided that the following conditions are met: |
FranKP2138 | 0:2b9b5764efb5 | 7 | * |
FranKP2138 | 0:2b9b5764efb5 | 8 | * 1. Redistributions of source code must retain the above copyright notice, this |
FranKP2138 | 0:2b9b5764efb5 | 9 | * list of conditions and the following disclaimer. |
FranKP2138 | 0:2b9b5764efb5 | 10 | * |
FranKP2138 | 0:2b9b5764efb5 | 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, this |
FranKP2138 | 0:2b9b5764efb5 | 12 | * list of conditions and the following disclaimer in the documentation and/or |
FranKP2138 | 0:2b9b5764efb5 | 13 | * other materials provided with the distribution. |
FranKP2138 | 0:2b9b5764efb5 | 14 | * |
FranKP2138 | 0:2b9b5764efb5 | 15 | * 3. Neither the name of Nordic Semiconductor ASA nor the names of other |
FranKP2138 | 0:2b9b5764efb5 | 16 | * contributors to this software may be used to endorse or promote products |
FranKP2138 | 0:2b9b5764efb5 | 17 | * derived from this software without specific prior written permission. |
FranKP2138 | 0:2b9b5764efb5 | 18 | * |
FranKP2138 | 0:2b9b5764efb5 | 19 | * 4. This software must only be used in a processor manufactured by Nordic |
FranKP2138 | 0:2b9b5764efb5 | 20 | * Semiconductor ASA, or in a processor manufactured by a third party that |
FranKP2138 | 0:2b9b5764efb5 | 21 | * is used in combination with a processor manufactured by Nordic Semiconductor. |
FranKP2138 | 0:2b9b5764efb5 | 22 | * |
FranKP2138 | 0:2b9b5764efb5 | 23 | * |
FranKP2138 | 0:2b9b5764efb5 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
FranKP2138 | 0:2b9b5764efb5 | 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
FranKP2138 | 0:2b9b5764efb5 | 26 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
FranKP2138 | 0:2b9b5764efb5 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR |
FranKP2138 | 0:2b9b5764efb5 | 28 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
FranKP2138 | 0:2b9b5764efb5 | 29 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
FranKP2138 | 0:2b9b5764efb5 | 30 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
FranKP2138 | 0:2b9b5764efb5 | 31 | * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
FranKP2138 | 0:2b9b5764efb5 | 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
FranKP2138 | 0:2b9b5764efb5 | 33 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
FranKP2138 | 0:2b9b5764efb5 | 34 | * |
FranKP2138 | 0:2b9b5764efb5 | 35 | */ |
FranKP2138 | 0:2b9b5764efb5 | 36 | |
FranKP2138 | 0:2b9b5764efb5 | 37 | /** |
FranKP2138 | 0:2b9b5764efb5 | 38 | @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client |
FranKP2138 | 0:2b9b5764efb5 | 39 | @{ |
FranKP2138 | 0:2b9b5764efb5 | 40 | @brief Definitions and prototypes for the GATT Client interface. |
FranKP2138 | 0:2b9b5764efb5 | 41 | */ |
FranKP2138 | 0:2b9b5764efb5 | 42 | |
FranKP2138 | 0:2b9b5764efb5 | 43 | #ifndef BLE_GATTC_H__ |
FranKP2138 | 0:2b9b5764efb5 | 44 | #define BLE_GATTC_H__ |
FranKP2138 | 0:2b9b5764efb5 | 45 | |
FranKP2138 | 0:2b9b5764efb5 | 46 | #include "ble_gatt.h" |
FranKP2138 | 0:2b9b5764efb5 | 47 | #include "ble_types.h" |
FranKP2138 | 0:2b9b5764efb5 | 48 | #include "ble_ranges.h" |
FranKP2138 | 0:2b9b5764efb5 | 49 | #include "nrf_svc.h" |
FranKP2138 | 0:2b9b5764efb5 | 50 | |
FranKP2138 | 0:2b9b5764efb5 | 51 | #ifdef __cplusplus |
FranKP2138 | 0:2b9b5764efb5 | 52 | extern "C" { |
FranKP2138 | 0:2b9b5764efb5 | 53 | #endif |
FranKP2138 | 0:2b9b5764efb5 | 54 | |
FranKP2138 | 0:2b9b5764efb5 | 55 | /** @addtogroup BLE_GATTC_ENUMERATIONS Enumerations |
FranKP2138 | 0:2b9b5764efb5 | 56 | * @{ */ |
FranKP2138 | 0:2b9b5764efb5 | 57 | |
FranKP2138 | 0:2b9b5764efb5 | 58 | /**@brief GATTC API SVC numbers. */ |
FranKP2138 | 0:2b9b5764efb5 | 59 | enum BLE_GATTC_SVCS |
FranKP2138 | 0:2b9b5764efb5 | 60 | { |
FranKP2138 | 0:2b9b5764efb5 | 61 | SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */ |
FranKP2138 | 0:2b9b5764efb5 | 62 | SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */ |
FranKP2138 | 0:2b9b5764efb5 | 63 | SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */ |
FranKP2138 | 0:2b9b5764efb5 | 64 | SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */ |
FranKP2138 | 0:2b9b5764efb5 | 65 | SD_BLE_GATTC_ATTR_INFO_DISCOVER, /**< Attribute Information Discovery. */ |
FranKP2138 | 0:2b9b5764efb5 | 66 | SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */ |
FranKP2138 | 0:2b9b5764efb5 | 67 | SD_BLE_GATTC_READ, /**< Generic read. */ |
FranKP2138 | 0:2b9b5764efb5 | 68 | SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */ |
FranKP2138 | 0:2b9b5764efb5 | 69 | SD_BLE_GATTC_WRITE, /**< Generic write. */ |
FranKP2138 | 0:2b9b5764efb5 | 70 | SD_BLE_GATTC_HV_CONFIRM, /**< Handle Value Confirmation. */ |
FranKP2138 | 0:2b9b5764efb5 | 71 | }; |
FranKP2138 | 0:2b9b5764efb5 | 72 | |
FranKP2138 | 0:2b9b5764efb5 | 73 | /** |
FranKP2138 | 0:2b9b5764efb5 | 74 | * @brief GATT Client Event IDs. |
FranKP2138 | 0:2b9b5764efb5 | 75 | */ |
FranKP2138 | 0:2b9b5764efb5 | 76 | enum BLE_GATTC_EVTS |
FranKP2138 | 0:2b9b5764efb5 | 77 | { |
FranKP2138 | 0:2b9b5764efb5 | 78 | BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. \n See @ref ble_gattc_evt_prim_srvc_disc_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 79 | BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. \n See @ref ble_gattc_evt_rel_disc_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 80 | BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. \n See @ref ble_gattc_evt_char_disc_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 81 | BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. \n See @ref ble_gattc_evt_desc_disc_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 82 | BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, /**< Attribute Information Response event. \n See @ref ble_gattc_evt_attr_info_disc_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 83 | BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. \n See @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 84 | BLE_GATTC_EVT_READ_RSP, /**< Read Response event. \n See @ref ble_gattc_evt_read_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 85 | BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. \n See @ref ble_gattc_evt_char_vals_read_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 86 | BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. \n See @ref ble_gattc_evt_write_rsp_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 87 | BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. \n Confirm indication with @ref sd_ble_gattc_hv_confirm. \n See @ref ble_gattc_evt_hvx_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 88 | BLE_GATTC_EVT_TIMEOUT /**< Timeout event. \n See @ref ble_gattc_evt_timeout_t. */ |
FranKP2138 | 0:2b9b5764efb5 | 89 | }; |
FranKP2138 | 0:2b9b5764efb5 | 90 | |
FranKP2138 | 0:2b9b5764efb5 | 91 | /** @} */ |
FranKP2138 | 0:2b9b5764efb5 | 92 | |
FranKP2138 | 0:2b9b5764efb5 | 93 | /** @addtogroup BLE_GATTC_DEFINES Defines |
FranKP2138 | 0:2b9b5764efb5 | 94 | * @{ */ |
FranKP2138 | 0:2b9b5764efb5 | 95 | |
FranKP2138 | 0:2b9b5764efb5 | 96 | /** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC |
FranKP2138 | 0:2b9b5764efb5 | 97 | * @{ */ |
FranKP2138 | 0:2b9b5764efb5 | 98 | #define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000) /**< Procedure not Permitted. */ |
FranKP2138 | 0:2b9b5764efb5 | 99 | /** @} */ |
FranKP2138 | 0:2b9b5764efb5 | 100 | |
FranKP2138 | 0:2b9b5764efb5 | 101 | /** @defgroup BLE_GATTC_ATTR_INFO_FORMAT Attribute Information Formats |
FranKP2138 | 0:2b9b5764efb5 | 102 | * @{ */ |
FranKP2138 | 0:2b9b5764efb5 | 103 | #define BLE_GATTC_ATTR_INFO_FORMAT_16BIT 1 /**< 16-bit Attribute Information Format. */ |
FranKP2138 | 0:2b9b5764efb5 | 104 | #define BLE_GATTC_ATTR_INFO_FORMAT_128BIT 2 /**< 128-bit Attribute Information Format. */ |
FranKP2138 | 0:2b9b5764efb5 | 105 | /** @} */ |
FranKP2138 | 0:2b9b5764efb5 | 106 | |
FranKP2138 | 0:2b9b5764efb5 | 107 | /** @} */ |
FranKP2138 | 0:2b9b5764efb5 | 108 | |
FranKP2138 | 0:2b9b5764efb5 | 109 | /** @addtogroup BLE_GATTC_STRUCTURES Structures |
FranKP2138 | 0:2b9b5764efb5 | 110 | * @{ */ |
FranKP2138 | 0:2b9b5764efb5 | 111 | |
FranKP2138 | 0:2b9b5764efb5 | 112 | /**@brief Operation Handle Range. */ |
FranKP2138 | 0:2b9b5764efb5 | 113 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 114 | { |
FranKP2138 | 0:2b9b5764efb5 | 115 | uint16_t start_handle; /**< Start Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 116 | uint16_t end_handle; /**< End Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 117 | } ble_gattc_handle_range_t; |
FranKP2138 | 0:2b9b5764efb5 | 118 | |
FranKP2138 | 0:2b9b5764efb5 | 119 | |
FranKP2138 | 0:2b9b5764efb5 | 120 | /**@brief GATT service. */ |
FranKP2138 | 0:2b9b5764efb5 | 121 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 122 | { |
FranKP2138 | 0:2b9b5764efb5 | 123 | ble_uuid_t uuid; /**< Service UUID. */ |
FranKP2138 | 0:2b9b5764efb5 | 124 | ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */ |
FranKP2138 | 0:2b9b5764efb5 | 125 | } ble_gattc_service_t; |
FranKP2138 | 0:2b9b5764efb5 | 126 | |
FranKP2138 | 0:2b9b5764efb5 | 127 | |
FranKP2138 | 0:2b9b5764efb5 | 128 | /**@brief GATT include. */ |
FranKP2138 | 0:2b9b5764efb5 | 129 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 130 | { |
FranKP2138 | 0:2b9b5764efb5 | 131 | uint16_t handle; /**< Include Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 132 | ble_gattc_service_t included_srvc; /**< Handle of the included service. */ |
FranKP2138 | 0:2b9b5764efb5 | 133 | } ble_gattc_include_t; |
FranKP2138 | 0:2b9b5764efb5 | 134 | |
FranKP2138 | 0:2b9b5764efb5 | 135 | |
FranKP2138 | 0:2b9b5764efb5 | 136 | /**@brief GATT characteristic. */ |
FranKP2138 | 0:2b9b5764efb5 | 137 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 138 | { |
FranKP2138 | 0:2b9b5764efb5 | 139 | ble_uuid_t uuid; /**< Characteristic UUID. */ |
FranKP2138 | 0:2b9b5764efb5 | 140 | ble_gatt_char_props_t char_props; /**< Characteristic Properties. */ |
FranKP2138 | 0:2b9b5764efb5 | 141 | uint8_t char_ext_props : 1; /**< Extended properties present. */ |
FranKP2138 | 0:2b9b5764efb5 | 142 | uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */ |
FranKP2138 | 0:2b9b5764efb5 | 143 | uint16_t handle_value; /**< Handle of the Characteristic Value. */ |
FranKP2138 | 0:2b9b5764efb5 | 144 | } ble_gattc_char_t; |
FranKP2138 | 0:2b9b5764efb5 | 145 | |
FranKP2138 | 0:2b9b5764efb5 | 146 | |
FranKP2138 | 0:2b9b5764efb5 | 147 | /**@brief GATT descriptor. */ |
FranKP2138 | 0:2b9b5764efb5 | 148 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 149 | { |
FranKP2138 | 0:2b9b5764efb5 | 150 | uint16_t handle; /**< Descriptor Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 151 | ble_uuid_t uuid; /**< Descriptor UUID. */ |
FranKP2138 | 0:2b9b5764efb5 | 152 | } ble_gattc_desc_t; |
FranKP2138 | 0:2b9b5764efb5 | 153 | |
FranKP2138 | 0:2b9b5764efb5 | 154 | |
FranKP2138 | 0:2b9b5764efb5 | 155 | /**@brief Write Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 156 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 157 | { |
FranKP2138 | 0:2b9b5764efb5 | 158 | uint8_t write_op; /**< Write Operation to be performed, see @ref BLE_GATT_WRITE_OPS. */ |
FranKP2138 | 0:2b9b5764efb5 | 159 | uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */ |
FranKP2138 | 0:2b9b5764efb5 | 160 | uint16_t handle; /**< Handle to the attribute to be written. */ |
FranKP2138 | 0:2b9b5764efb5 | 161 | uint16_t offset; /**< Offset in bytes. @note For WRITE_CMD and WRITE_REQ, offset must be 0. */ |
FranKP2138 | 0:2b9b5764efb5 | 162 | uint16_t len; /**< Length of data in bytes. */ |
FranKP2138 | 0:2b9b5764efb5 | 163 | uint8_t *p_value; /**< Pointer to the value data. */ |
FranKP2138 | 0:2b9b5764efb5 | 164 | } ble_gattc_write_params_t; |
FranKP2138 | 0:2b9b5764efb5 | 165 | |
FranKP2138 | 0:2b9b5764efb5 | 166 | /**@brief Attribute Information. */ |
FranKP2138 | 0:2b9b5764efb5 | 167 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 168 | { |
FranKP2138 | 0:2b9b5764efb5 | 169 | uint16_t handle; /**< Attribute handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 170 | union { |
FranKP2138 | 0:2b9b5764efb5 | 171 | ble_uuid_t uuid16; /**< 16-bit Attribute UUID. */ |
FranKP2138 | 0:2b9b5764efb5 | 172 | ble_uuid128_t uuid128; /**< 128-bit Attribute UUID. */ |
FranKP2138 | 0:2b9b5764efb5 | 173 | } info; |
FranKP2138 | 0:2b9b5764efb5 | 174 | } ble_gattc_attr_info_t; |
FranKP2138 | 0:2b9b5764efb5 | 175 | |
FranKP2138 | 0:2b9b5764efb5 | 176 | /**@brief Event structure for @ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 177 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 178 | { |
FranKP2138 | 0:2b9b5764efb5 | 179 | uint16_t count; /**< Service count. */ |
FranKP2138 | 0:2b9b5764efb5 | 180 | ble_gattc_service_t services[1]; /**< Service data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 181 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 182 | } ble_gattc_evt_prim_srvc_disc_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 183 | |
FranKP2138 | 0:2b9b5764efb5 | 184 | /**@brief Event structure for @ref BLE_GATTC_EVT_REL_DISC_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 185 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 186 | { |
FranKP2138 | 0:2b9b5764efb5 | 187 | uint16_t count; /**< Include count. */ |
FranKP2138 | 0:2b9b5764efb5 | 188 | ble_gattc_include_t includes[1]; /**< Include data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 189 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 190 | } ble_gattc_evt_rel_disc_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 191 | |
FranKP2138 | 0:2b9b5764efb5 | 192 | /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_DISC_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 193 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 194 | { |
FranKP2138 | 0:2b9b5764efb5 | 195 | uint16_t count; /**< Characteristic count. */ |
FranKP2138 | 0:2b9b5764efb5 | 196 | ble_gattc_char_t chars[1]; /**< Characteristic data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 197 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 198 | } ble_gattc_evt_char_disc_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 199 | |
FranKP2138 | 0:2b9b5764efb5 | 200 | /**@brief Event structure for @ref BLE_GATTC_EVT_DESC_DISC_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 201 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 202 | { |
FranKP2138 | 0:2b9b5764efb5 | 203 | uint16_t count; /**< Descriptor count. */ |
FranKP2138 | 0:2b9b5764efb5 | 204 | ble_gattc_desc_t descs[1]; /**< Descriptor data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 205 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 206 | } ble_gattc_evt_desc_disc_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 207 | |
FranKP2138 | 0:2b9b5764efb5 | 208 | /**@brief Event structure for @ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 209 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 210 | { |
FranKP2138 | 0:2b9b5764efb5 | 211 | uint16_t count; /**< Attribute count. */ |
FranKP2138 | 0:2b9b5764efb5 | 212 | uint8_t format; /**< Attribute information format, see @ref BLE_GATTC_ATTR_INFO_FORMAT. */ |
FranKP2138 | 0:2b9b5764efb5 | 213 | ble_gattc_attr_info_t attr_info[1]; /**< Attribute information. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 214 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 215 | } ble_gattc_evt_attr_info_disc_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 216 | |
FranKP2138 | 0:2b9b5764efb5 | 217 | /**@brief GATT read by UUID handle value pair. */ |
FranKP2138 | 0:2b9b5764efb5 | 218 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 219 | { |
FranKP2138 | 0:2b9b5764efb5 | 220 | uint16_t handle; /**< Attribute Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 221 | uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in @ref ble_gattc_evt_char_val_by_uuid_read_rsp_t). |
FranKP2138 | 0:2b9b5764efb5 | 222 | Please note that this pointer is absolute to the memory provided by the user when retrieving the event, |
FranKP2138 | 0:2b9b5764efb5 | 223 | so it will effectively point to a location inside the handle_value array. */ |
FranKP2138 | 0:2b9b5764efb5 | 224 | } ble_gattc_handle_value_t; |
FranKP2138 | 0:2b9b5764efb5 | 225 | |
FranKP2138 | 0:2b9b5764efb5 | 226 | /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 227 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 228 | { |
FranKP2138 | 0:2b9b5764efb5 | 229 | uint16_t count; /**< Handle-Value Pair Count. */ |
FranKP2138 | 0:2b9b5764efb5 | 230 | uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */ |
FranKP2138 | 0:2b9b5764efb5 | 231 | ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 232 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 233 | } ble_gattc_evt_char_val_by_uuid_read_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 234 | |
FranKP2138 | 0:2b9b5764efb5 | 235 | /**@brief Event structure for @ref BLE_GATTC_EVT_READ_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 236 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 237 | { |
FranKP2138 | 0:2b9b5764efb5 | 238 | uint16_t handle; /**< Attribute Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 239 | uint16_t offset; /**< Offset of the attribute data. */ |
FranKP2138 | 0:2b9b5764efb5 | 240 | uint16_t len; /**< Attribute data length. */ |
FranKP2138 | 0:2b9b5764efb5 | 241 | uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 242 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 243 | } ble_gattc_evt_read_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 244 | |
FranKP2138 | 0:2b9b5764efb5 | 245 | /**@brief Event structure for @ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 246 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 247 | { |
FranKP2138 | 0:2b9b5764efb5 | 248 | uint16_t len; /**< Concatenated Attribute values length. */ |
FranKP2138 | 0:2b9b5764efb5 | 249 | uint8_t values[1]; /**< Attribute values. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 250 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 251 | } ble_gattc_evt_char_vals_read_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 252 | |
FranKP2138 | 0:2b9b5764efb5 | 253 | /**@brief Event structure for @ref BLE_GATTC_EVT_WRITE_RSP. */ |
FranKP2138 | 0:2b9b5764efb5 | 254 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 255 | { |
FranKP2138 | 0:2b9b5764efb5 | 256 | uint16_t handle; /**< Attribute Handle. */ |
FranKP2138 | 0:2b9b5764efb5 | 257 | uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */ |
FranKP2138 | 0:2b9b5764efb5 | 258 | uint16_t offset; /**< Data offset. */ |
FranKP2138 | 0:2b9b5764efb5 | 259 | uint16_t len; /**< Data length. */ |
FranKP2138 | 0:2b9b5764efb5 | 260 | uint8_t data[1]; /**< Data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 261 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 262 | } ble_gattc_evt_write_rsp_t; |
FranKP2138 | 0:2b9b5764efb5 | 263 | |
FranKP2138 | 0:2b9b5764efb5 | 264 | /**@brief Event structure for @ref BLE_GATTC_EVT_HVX. */ |
FranKP2138 | 0:2b9b5764efb5 | 265 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 266 | { |
FranKP2138 | 0:2b9b5764efb5 | 267 | uint16_t handle; /**< Handle to which the HVx operation applies. */ |
FranKP2138 | 0:2b9b5764efb5 | 268 | uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */ |
FranKP2138 | 0:2b9b5764efb5 | 269 | uint16_t len; /**< Attribute data length. */ |
FranKP2138 | 0:2b9b5764efb5 | 270 | uint8_t data[1]; /**< Attribute data. @note This is a variable length array. The size of 1 indicated is only a placeholder for compilation. |
FranKP2138 | 0:2b9b5764efb5 | 271 | See @ref sd_ble_evt_get for more information on how to use event structures with variable length array members. */ |
FranKP2138 | 0:2b9b5764efb5 | 272 | } ble_gattc_evt_hvx_t; |
FranKP2138 | 0:2b9b5764efb5 | 273 | |
FranKP2138 | 0:2b9b5764efb5 | 274 | /**@brief Event structure for @ref BLE_GATTC_EVT_TIMEOUT. */ |
FranKP2138 | 0:2b9b5764efb5 | 275 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 276 | { |
FranKP2138 | 0:2b9b5764efb5 | 277 | uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */ |
FranKP2138 | 0:2b9b5764efb5 | 278 | } ble_gattc_evt_timeout_t; |
FranKP2138 | 0:2b9b5764efb5 | 279 | |
FranKP2138 | 0:2b9b5764efb5 | 280 | /**@brief GATTC event structure. */ |
FranKP2138 | 0:2b9b5764efb5 | 281 | typedef struct |
FranKP2138 | 0:2b9b5764efb5 | 282 | { |
FranKP2138 | 0:2b9b5764efb5 | 283 | uint16_t conn_handle; /**< Connection Handle on which event occured. */ |
FranKP2138 | 0:2b9b5764efb5 | 284 | uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */ |
FranKP2138 | 0:2b9b5764efb5 | 285 | uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases @ref BLE_GATT_HANDLE_INVALID. */ |
FranKP2138 | 0:2b9b5764efb5 | 286 | union |
FranKP2138 | 0:2b9b5764efb5 | 287 | { |
FranKP2138 | 0:2b9b5764efb5 | 288 | ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 289 | ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 290 | ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 291 | ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 292 | ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 293 | ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 294 | ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 295 | ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 296 | ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 297 | ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 298 | ble_gattc_evt_attr_info_disc_rsp_t attr_info_disc_rsp; /**< Attribute Information Discovery Event Parameters. */ |
FranKP2138 | 0:2b9b5764efb5 | 299 | } params; /**< Event Parameters. @note Only valid if @ref gatt_status == @ref BLE_GATT_STATUS_SUCCESS. */ |
FranKP2138 | 0:2b9b5764efb5 | 300 | } ble_gattc_evt_t; |
FranKP2138 | 0:2b9b5764efb5 | 301 | /** @} */ |
FranKP2138 | 0:2b9b5764efb5 | 302 | |
FranKP2138 | 0:2b9b5764efb5 | 303 | /** @addtogroup BLE_GATTC_FUNCTIONS Functions |
FranKP2138 | 0:2b9b5764efb5 | 304 | * @{ */ |
FranKP2138 | 0:2b9b5764efb5 | 305 | |
FranKP2138 | 0:2b9b5764efb5 | 306 | /**@brief Initiate or continue a GATT Primary Service Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 307 | * |
FranKP2138 | 0:2b9b5764efb5 | 308 | * @details This function initiates or resumes a Primary Service discovery procedure, starting from the supplied handle. |
FranKP2138 | 0:2b9b5764efb5 | 309 | * If the last service has not been reached, this function must be called again with an updated start handle value to continue the search. |
FranKP2138 | 0:2b9b5764efb5 | 310 | * |
FranKP2138 | 0:2b9b5764efb5 | 311 | * @note If any of the discovered services have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with |
FranKP2138 | 0:2b9b5764efb5 | 312 | * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. |
FranKP2138 | 0:2b9b5764efb5 | 313 | * |
FranKP2138 | 0:2b9b5764efb5 | 314 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 315 | * @event{@ref BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 316 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 317 | * |
FranKP2138 | 0:2b9b5764efb5 | 318 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 319 | * @mmsc{@ref BLE_GATTC_PRIM_SRVC_DISC_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 320 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 321 | * |
FranKP2138 | 0:2b9b5764efb5 | 322 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 323 | * @param[in] start_handle Handle to start searching from. |
FranKP2138 | 0:2b9b5764efb5 | 324 | * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned. |
FranKP2138 | 0:2b9b5764efb5 | 325 | * |
FranKP2138 | 0:2b9b5764efb5 | 326 | * @retval ::NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 327 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 328 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 329 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
FranKP2138 | 0:2b9b5764efb5 | 330 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 331 | */ |
FranKP2138 | 0:2b9b5764efb5 | 332 | SVCALL(SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER, uint32_t, sd_ble_gattc_primary_services_discover(uint16_t conn_handle, uint16_t start_handle, ble_uuid_t const *p_srvc_uuid)); |
FranKP2138 | 0:2b9b5764efb5 | 333 | |
FranKP2138 | 0:2b9b5764efb5 | 334 | |
FranKP2138 | 0:2b9b5764efb5 | 335 | /**@brief Initiate or continue a GATT Relationship Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 336 | * |
FranKP2138 | 0:2b9b5764efb5 | 337 | * @details This function initiates or resumes the Find Included Services sub-procedure. If the last included service has not been reached, |
FranKP2138 | 0:2b9b5764efb5 | 338 | * this must be called again with an updated handle range to continue the search. |
FranKP2138 | 0:2b9b5764efb5 | 339 | * |
FranKP2138 | 0:2b9b5764efb5 | 340 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 341 | * @event{@ref BLE_GATTC_EVT_REL_DISC_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 342 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 343 | * |
FranKP2138 | 0:2b9b5764efb5 | 344 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 345 | * @mmsc{@ref BLE_GATTC_REL_DISC_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 346 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 347 | * |
FranKP2138 | 0:2b9b5764efb5 | 348 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 349 | * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 350 | * |
FranKP2138 | 0:2b9b5764efb5 | 351 | * @retval ::NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 352 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 353 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 354 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 355 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
FranKP2138 | 0:2b9b5764efb5 | 356 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 357 | */ |
FranKP2138 | 0:2b9b5764efb5 | 358 | SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); |
FranKP2138 | 0:2b9b5764efb5 | 359 | |
FranKP2138 | 0:2b9b5764efb5 | 360 | |
FranKP2138 | 0:2b9b5764efb5 | 361 | /**@brief Initiate or continue a GATT Characteristic Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 362 | * |
FranKP2138 | 0:2b9b5764efb5 | 363 | * @details This function initiates or resumes a Characteristic discovery procedure. If the last Characteristic has not been reached, |
FranKP2138 | 0:2b9b5764efb5 | 364 | * this must be called again with an updated handle range to continue the discovery. |
FranKP2138 | 0:2b9b5764efb5 | 365 | * |
FranKP2138 | 0:2b9b5764efb5 | 366 | * @note If any of the discovered characteristics have 128-bit UUIDs which are not present in the table provided to ble_vs_uuids_assign, a UUID structure with |
FranKP2138 | 0:2b9b5764efb5 | 367 | * type @ref BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event. |
FranKP2138 | 0:2b9b5764efb5 | 368 | * |
FranKP2138 | 0:2b9b5764efb5 | 369 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 370 | * @event{@ref BLE_GATTC_EVT_CHAR_DISC_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 371 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 372 | * |
FranKP2138 | 0:2b9b5764efb5 | 373 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 374 | * @mmsc{@ref BLE_GATTC_CHAR_DISC_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 375 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 376 | * |
FranKP2138 | 0:2b9b5764efb5 | 377 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 378 | * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 379 | * |
FranKP2138 | 0:2b9b5764efb5 | 380 | * @retval ::NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 381 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 382 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 383 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 384 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 385 | */ |
FranKP2138 | 0:2b9b5764efb5 | 386 | SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); |
FranKP2138 | 0:2b9b5764efb5 | 387 | |
FranKP2138 | 0:2b9b5764efb5 | 388 | |
FranKP2138 | 0:2b9b5764efb5 | 389 | /**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 390 | * |
FranKP2138 | 0:2b9b5764efb5 | 391 | * @details This function initiates or resumes a Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached, |
FranKP2138 | 0:2b9b5764efb5 | 392 | * this must be called again with an updated handle range to continue the discovery. |
FranKP2138 | 0:2b9b5764efb5 | 393 | * |
FranKP2138 | 0:2b9b5764efb5 | 394 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 395 | * @event{BLE_GATTC_EVT_DESC_DISC_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 396 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 397 | * |
FranKP2138 | 0:2b9b5764efb5 | 398 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 399 | * @mmsc{@ref BLE_GATTC_DESC_DISC_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 400 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 401 | * |
FranKP2138 | 0:2b9b5764efb5 | 402 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 403 | * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 404 | * |
FranKP2138 | 0:2b9b5764efb5 | 405 | * @retval ::NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 406 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 407 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 408 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 409 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 410 | */ |
FranKP2138 | 0:2b9b5764efb5 | 411 | SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const *p_handle_range)); |
FranKP2138 | 0:2b9b5764efb5 | 412 | |
FranKP2138 | 0:2b9b5764efb5 | 413 | |
FranKP2138 | 0:2b9b5764efb5 | 414 | /**@brief Initiate or continue a GATT Read using Characteristic UUID procedure. |
FranKP2138 | 0:2b9b5764efb5 | 415 | * |
FranKP2138 | 0:2b9b5764efb5 | 416 | * @details This function initiates or resumes a Read using Characteristic UUID procedure. If the last Characteristic has not been reached, |
FranKP2138 | 0:2b9b5764efb5 | 417 | * this must be called again with an updated handle range to continue the discovery. |
FranKP2138 | 0:2b9b5764efb5 | 418 | * |
FranKP2138 | 0:2b9b5764efb5 | 419 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 420 | * @event{BLE_GATTC_EVT_DESC_DISC_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 421 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 422 | * |
FranKP2138 | 0:2b9b5764efb5 | 423 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 424 | * @mmsc{@ref BLE_GATTC_READ_UUID_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 425 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 426 | * |
FranKP2138 | 0:2b9b5764efb5 | 427 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 428 | * @param[in] p_uuid Pointer to a Characteristic value UUID to read. |
FranKP2138 | 0:2b9b5764efb5 | 429 | * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 430 | * |
FranKP2138 | 0:2b9b5764efb5 | 431 | * @retval ::NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure. |
FranKP2138 | 0:2b9b5764efb5 | 432 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 433 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 434 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 435 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 436 | */ |
FranKP2138 | 0:2b9b5764efb5 | 437 | SVCALL(SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, uint32_t, sd_ble_gattc_char_value_by_uuid_read(uint16_t conn_handle, ble_uuid_t const *p_uuid, ble_gattc_handle_range_t const *p_handle_range)); |
FranKP2138 | 0:2b9b5764efb5 | 438 | |
FranKP2138 | 0:2b9b5764efb5 | 439 | |
FranKP2138 | 0:2b9b5764efb5 | 440 | /**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure. |
FranKP2138 | 0:2b9b5764efb5 | 441 | * |
FranKP2138 | 0:2b9b5764efb5 | 442 | * @details This function initiates or resumes a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor |
FranKP2138 | 0:2b9b5764efb5 | 443 | * to be read is longer than ATT_MTU - 1, this function must be called multiple times with appropriate offset to read the |
FranKP2138 | 0:2b9b5764efb5 | 444 | * complete value. |
FranKP2138 | 0:2b9b5764efb5 | 445 | * |
FranKP2138 | 0:2b9b5764efb5 | 446 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 447 | * @event{@ref BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 448 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 449 | * |
FranKP2138 | 0:2b9b5764efb5 | 450 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 451 | * @mmsc{@ref BLE_GATTC_VALUE_READ_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 452 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 453 | * |
FranKP2138 | 0:2b9b5764efb5 | 454 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 455 | * @param[in] handle The handle of the attribute to be read. |
FranKP2138 | 0:2b9b5764efb5 | 456 | * @param[in] offset Offset into the attribute value to be read. |
FranKP2138 | 0:2b9b5764efb5 | 457 | * |
FranKP2138 | 0:2b9b5764efb5 | 458 | * @retval ::NRF_SUCCESS Successfully started or resumed the Read (Long) procedure. |
FranKP2138 | 0:2b9b5764efb5 | 459 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 460 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 461 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 462 | */ |
FranKP2138 | 0:2b9b5764efb5 | 463 | SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset)); |
FranKP2138 | 0:2b9b5764efb5 | 464 | |
FranKP2138 | 0:2b9b5764efb5 | 465 | |
FranKP2138 | 0:2b9b5764efb5 | 466 | /**@brief Initiate a GATT Read Multiple Characteristic Values procedure. |
FranKP2138 | 0:2b9b5764efb5 | 467 | * |
FranKP2138 | 0:2b9b5764efb5 | 468 | * @details This function initiates a GATT Read Multiple Characteristic Values procedure. |
FranKP2138 | 0:2b9b5764efb5 | 469 | * |
FranKP2138 | 0:2b9b5764efb5 | 470 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 471 | * @event{@ref BLE_GATTC_EVT_CHAR_VALS_READ_RSP} |
FranKP2138 | 0:2b9b5764efb5 | 472 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 473 | * |
FranKP2138 | 0:2b9b5764efb5 | 474 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 475 | * @mmsc{@ref BLE_GATTC_READ_MULT_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 476 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 477 | * |
FranKP2138 | 0:2b9b5764efb5 | 478 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 479 | * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read. |
FranKP2138 | 0:2b9b5764efb5 | 480 | * @param[in] handle_count The number of handles in p_handles. |
FranKP2138 | 0:2b9b5764efb5 | 481 | * |
FranKP2138 | 0:2b9b5764efb5 | 482 | * @retval ::NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure. |
FranKP2138 | 0:2b9b5764efb5 | 483 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 484 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 485 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 486 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 487 | */ |
FranKP2138 | 0:2b9b5764efb5 | 488 | SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const *p_handles, uint16_t handle_count)); |
FranKP2138 | 0:2b9b5764efb5 | 489 | |
FranKP2138 | 0:2b9b5764efb5 | 490 | |
FranKP2138 | 0:2b9b5764efb5 | 491 | /**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure. |
FranKP2138 | 0:2b9b5764efb5 | 492 | * |
FranKP2138 | 0:2b9b5764efb5 | 493 | * @details This function can perform all write procedures described in GATT. |
FranKP2138 | 0:2b9b5764efb5 | 494 | * |
FranKP2138 | 0:2b9b5764efb5 | 495 | * @note It is important to note that a write without response will <b>consume an application buffer</b>, and will therefore |
FranKP2138 | 0:2b9b5764efb5 | 496 | * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write (with response) on the other hand will use the |
FranKP2138 | 0:2b9b5764efb5 | 497 | * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response |
FranKP2138 | 0:2b9b5764efb5 | 498 | * has been received from the peer. Please see the documentation of @ref sd_ble_tx_packet_count_get for more details. |
FranKP2138 | 0:2b9b5764efb5 | 499 | * |
FranKP2138 | 0:2b9b5764efb5 | 500 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 501 | * @event{@ref BLE_GATTC_EVT_WRITE_RSP, Generated when using write request or queued writes.} |
FranKP2138 | 0:2b9b5764efb5 | 502 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 503 | * |
FranKP2138 | 0:2b9b5764efb5 | 504 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 505 | * @mmsc{@ref BLE_GATTC_VALUE_WRITE_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 506 | * @mmsc{@ref BLE_GATTC_VALUE_LONG_WRITE_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 507 | * @mmsc{@ref BLE_GATTC_VALUE_RELIABLE_WRITE_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 508 | * @mmsc{@ref BLE_COMMON_APP_BUFF_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 509 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 510 | * |
FranKP2138 | 0:2b9b5764efb5 | 511 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 512 | * @param[in] p_write_params A pointer to a write parameters structure. |
FranKP2138 | 0:2b9b5764efb5 | 513 | * |
FranKP2138 | 0:2b9b5764efb5 | 514 | * @retval ::NRF_SUCCESS Successfully started the Write procedure. |
FranKP2138 | 0:2b9b5764efb5 | 515 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 516 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State. |
FranKP2138 | 0:2b9b5764efb5 | 517 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 518 | * @retval ::NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied. |
FranKP2138 | 0:2b9b5764efb5 | 519 | * @retval ::NRF_ERROR_DATA_SIZE Invalid data size(s) supplied. |
FranKP2138 | 0:2b9b5764efb5 | 520 | * @retval ::NRF_ERROR_BUSY Procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 521 | * @retval ::BLE_ERROR_NO_TX_PACKETS No available application packets for this connection. |
FranKP2138 | 0:2b9b5764efb5 | 522 | */ |
FranKP2138 | 0:2b9b5764efb5 | 523 | SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const *p_write_params)); |
FranKP2138 | 0:2b9b5764efb5 | 524 | |
FranKP2138 | 0:2b9b5764efb5 | 525 | |
FranKP2138 | 0:2b9b5764efb5 | 526 | /**@brief Send a Handle Value Confirmation to the GATT Server. |
FranKP2138 | 0:2b9b5764efb5 | 527 | * |
FranKP2138 | 0:2b9b5764efb5 | 528 | * @mscs |
FranKP2138 | 0:2b9b5764efb5 | 529 | * @mmsc{@ref BLE_GATTC_HVI_MSC} |
FranKP2138 | 0:2b9b5764efb5 | 530 | * @endmscs |
FranKP2138 | 0:2b9b5764efb5 | 531 | * |
FranKP2138 | 0:2b9b5764efb5 | 532 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 533 | * @param[in] handle The handle of the attribute in the indication. |
FranKP2138 | 0:2b9b5764efb5 | 534 | * |
FranKP2138 | 0:2b9b5764efb5 | 535 | * @retval ::NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission. |
FranKP2138 | 0:2b9b5764efb5 | 536 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle. |
FranKP2138 | 0:2b9b5764efb5 | 537 | * @retval ::NRF_ERROR_INVALID_STATE Invalid Connection State or no Indication pending to be confirmed. |
FranKP2138 | 0:2b9b5764efb5 | 538 | * @retval ::BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle. |
FranKP2138 | 0:2b9b5764efb5 | 539 | */ |
FranKP2138 | 0:2b9b5764efb5 | 540 | SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle)); |
FranKP2138 | 0:2b9b5764efb5 | 541 | |
FranKP2138 | 0:2b9b5764efb5 | 542 | /**@brief Discovers information about a range of attributes on a GATT server. |
FranKP2138 | 0:2b9b5764efb5 | 543 | * |
FranKP2138 | 0:2b9b5764efb5 | 544 | * @events |
FranKP2138 | 0:2b9b5764efb5 | 545 | * @event{@ref BLE_GATTC_EVT_ATTR_INFO_DISC_RSP, Generated when information about a range of attributes has been received.} |
FranKP2138 | 0:2b9b5764efb5 | 546 | * @endevents |
FranKP2138 | 0:2b9b5764efb5 | 547 | * |
FranKP2138 | 0:2b9b5764efb5 | 548 | * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on. |
FranKP2138 | 0:2b9b5764efb5 | 549 | * @param[in] p_handle_range The range of handles to request information about. |
FranKP2138 | 0:2b9b5764efb5 | 550 | * |
FranKP2138 | 0:2b9b5764efb5 | 551 | * @retval ::NRF_SUCCESS Successfully started an attribute information discovery procedure. |
FranKP2138 | 0:2b9b5764efb5 | 552 | * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid connection handle. |
FranKP2138 | 0:2b9b5764efb5 | 553 | * @retval ::NRF_ERROR_INVALID_STATE Invalid connection state |
FranKP2138 | 0:2b9b5764efb5 | 554 | * @retval ::NRF_ERROR_INVALID_ADDR Invalid pointer supplied. |
FranKP2138 | 0:2b9b5764efb5 | 555 | * @retval ::NRF_ERROR_BUSY Client procedure already in progress. |
FranKP2138 | 0:2b9b5764efb5 | 556 | */ |
FranKP2138 | 0:2b9b5764efb5 | 557 | SVCALL(SD_BLE_GATTC_ATTR_INFO_DISCOVER, uint32_t, sd_ble_gattc_attr_info_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * p_handle_range)); |
FranKP2138 | 0:2b9b5764efb5 | 558 | |
FranKP2138 | 0:2b9b5764efb5 | 559 | /** @} */ |
FranKP2138 | 0:2b9b5764efb5 | 560 | |
FranKP2138 | 0:2b9b5764efb5 | 561 | #ifdef __cplusplus |
FranKP2138 | 0:2b9b5764efb5 | 562 | } |
FranKP2138 | 0:2b9b5764efb5 | 563 | #endif |
FranKP2138 | 0:2b9b5764efb5 | 564 | #endif /* BLE_GATTC_H__ */ |
FranKP2138 | 0:2b9b5764efb5 | 565 | |
FranKP2138 | 0:2b9b5764efb5 | 566 | /** |
FranKP2138 | 0:2b9b5764efb5 | 567 | @} |
FranKP2138 | 0:2b9b5764efb5 | 568 | @} |
FranKP2138 | 0:2b9b5764efb5 | 569 | */ |
FranKP2138 | 0:2b9b5764efb5 | 570 |