BLE temperature profile using digital DS1820 or analog LM35 sensors

Dependencies:   DS1820

Committer:
gkroussos
Date:
Sat Mar 07 16:23:41 2015 +0000
Revision:
0:637031152314
Working version 1.0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gkroussos 0:637031152314 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
gkroussos 0:637031152314 2 *
gkroussos 0:637031152314 3 * The information contained herein is confidential property of Nordic Semiconductor. The use,
gkroussos 0:637031152314 4 * copying, transfer or disclosure of such information is prohibited except by express written
gkroussos 0:637031152314 5 * agreement with Nordic Semiconductor.
gkroussos 0:637031152314 6 *
gkroussos 0:637031152314 7 */
gkroussos 0:637031152314 8 /**
gkroussos 0:637031152314 9 @addtogroup BLE_GATTC Generic Attribute Profile (GATT) Client
gkroussos 0:637031152314 10 @{
gkroussos 0:637031152314 11 @brief Definitions and prototypes for the GATT Client interface.
gkroussos 0:637031152314 12 */
gkroussos 0:637031152314 13
gkroussos 0:637031152314 14 #ifndef BLE_GATTC_H__
gkroussos 0:637031152314 15 #define BLE_GATTC_H__
gkroussos 0:637031152314 16
gkroussos 0:637031152314 17 #include "ble_gatt.h"
gkroussos 0:637031152314 18 #include "ble_types.h"
gkroussos 0:637031152314 19 #include "ble_ranges.h"
gkroussos 0:637031152314 20 #include "nrf_svc.h"
gkroussos 0:637031152314 21
gkroussos 0:637031152314 22
gkroussos 0:637031152314 23 /**@brief GATTC API SVC numbers. */
gkroussos 0:637031152314 24 enum BLE_GATTC_SVCS
gkroussos 0:637031152314 25 {
gkroussos 0:637031152314 26 SD_BLE_GATTC_PRIMARY_SERVICES_DISCOVER = BLE_GATTC_SVC_BASE, /**< Primary Service Discovery. */
gkroussos 0:637031152314 27 SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, /**< Relationship Discovery. */
gkroussos 0:637031152314 28 SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, /**< Characteristic Discovery. */
gkroussos 0:637031152314 29 SD_BLE_GATTC_DESCRIPTORS_DISCOVER, /**< Characteristic Descriptor Discovery. */
gkroussos 0:637031152314 30 SD_BLE_GATTC_CHAR_VALUE_BY_UUID_READ, /**< Read Characteristic Value by UUID. */
gkroussos 0:637031152314 31 SD_BLE_GATTC_READ, /**< Generic read. */
gkroussos 0:637031152314 32 SD_BLE_GATTC_CHAR_VALUES_READ, /**< Read multiple Characteristic Values. */
gkroussos 0:637031152314 33 SD_BLE_GATTC_WRITE, /**< Generic write. */
gkroussos 0:637031152314 34 SD_BLE_GATTC_HV_CONFIRM /**< Handle Value Confirmation. */
gkroussos 0:637031152314 35 };
gkroussos 0:637031152314 36
gkroussos 0:637031152314 37 /** @addtogroup BLE_GATTC_DEFINES Defines
gkroussos 0:637031152314 38 * @{ */
gkroussos 0:637031152314 39
gkroussos 0:637031152314 40 /** @defgroup BLE_ERRORS_GATTC SVC return values specific to GATTC
gkroussos 0:637031152314 41 * @{ */
gkroussos 0:637031152314 42 #define BLE_ERROR_GATTC_PROC_NOT_PERMITTED (NRF_GATTC_ERR_BASE + 0x000)
gkroussos 0:637031152314 43 /** @} */
gkroussos 0:637031152314 44
gkroussos 0:637031152314 45 /**@brief Last Attribute Handle. */
gkroussos 0:637031152314 46 #define BLE_GATTC_HANDLE_END 0xFFFF
gkroussos 0:637031152314 47
gkroussos 0:637031152314 48 /** @} */
gkroussos 0:637031152314 49
gkroussos 0:637031152314 50 /**@brief Operation Handle Range. */
gkroussos 0:637031152314 51 typedef struct
gkroussos 0:637031152314 52 {
gkroussos 0:637031152314 53 uint16_t start_handle; /**< Start Handle. */
gkroussos 0:637031152314 54 uint16_t end_handle; /**< End Handle. */
gkroussos 0:637031152314 55 } ble_gattc_handle_range_t;
gkroussos 0:637031152314 56
gkroussos 0:637031152314 57
gkroussos 0:637031152314 58 /**@brief GATT service. */
gkroussos 0:637031152314 59 typedef struct
gkroussos 0:637031152314 60 {
gkroussos 0:637031152314 61 ble_uuid_t uuid; /**< Service UUID. */
gkroussos 0:637031152314 62 ble_gattc_handle_range_t handle_range; /**< Service Handle Range. */
gkroussos 0:637031152314 63 } ble_gattc_service_t;
gkroussos 0:637031152314 64
gkroussos 0:637031152314 65
gkroussos 0:637031152314 66 /**@brief GATT include. */
gkroussos 0:637031152314 67 typedef struct
gkroussos 0:637031152314 68 {
gkroussos 0:637031152314 69 uint16_t handle; /**< Include Handle. */
gkroussos 0:637031152314 70 ble_gattc_service_t included_srvc; /**< Handle of the included service. */
gkroussos 0:637031152314 71 } ble_gattc_include_t;
gkroussos 0:637031152314 72
gkroussos 0:637031152314 73
gkroussos 0:637031152314 74 /**@brief GATT characteristic. */
gkroussos 0:637031152314 75 typedef struct
gkroussos 0:637031152314 76 {
gkroussos 0:637031152314 77 ble_uuid_t uuid; /**< Characteristic UUID. */
gkroussos 0:637031152314 78 ble_gatt_char_props_t char_props; /**< Characteristic Properties. */
gkroussos 0:637031152314 79 uint8_t char_ext_props : 1; /**< Extended properties present. */
gkroussos 0:637031152314 80 uint16_t handle_decl; /**< Handle of the Characteristic Declaration. */
gkroussos 0:637031152314 81 uint16_t handle_value; /**< Handle of the Characteristic Value. */
gkroussos 0:637031152314 82 } ble_gattc_char_t;
gkroussos 0:637031152314 83
gkroussos 0:637031152314 84
gkroussos 0:637031152314 85 /**@brief GATT descriptor. */
gkroussos 0:637031152314 86 typedef struct
gkroussos 0:637031152314 87 {
gkroussos 0:637031152314 88 uint16_t handle; /**< Descriptor Handle. */
gkroussos 0:637031152314 89 ble_uuid_t uuid; /**< Descriptor UUID. */
gkroussos 0:637031152314 90 } ble_gattc_desc_t;
gkroussos 0:637031152314 91
gkroussos 0:637031152314 92
gkroussos 0:637031152314 93 /**@brief Write Parameters. */
gkroussos 0:637031152314 94 typedef struct
gkroussos 0:637031152314 95 {
gkroussos 0:637031152314 96 uint8_t write_op; /**< Write Operation to be performed, see BLE_GATT_WRITE_OPS. */
gkroussos 0:637031152314 97 uint16_t handle; /**< Handle to the attribute to be written. */
gkroussos 0:637031152314 98 uint16_t offset; /**< Offset in bytes. */
gkroussos 0:637031152314 99 uint16_t len; /**< Length of data in bytes. */
gkroussos 0:637031152314 100 uint8_t* p_value; /**< Pointer to the value data. */
gkroussos 0:637031152314 101 uint8_t flags; /**< Flags, see @ref BLE_GATT_EXEC_WRITE_FLAGS. */
gkroussos 0:637031152314 102 } ble_gattc_write_params_t;
gkroussos 0:637031152314 103
gkroussos 0:637031152314 104
gkroussos 0:637031152314 105 /**
gkroussos 0:637031152314 106 * @brief GATT Client Event IDs.
gkroussos 0:637031152314 107 */
gkroussos 0:637031152314 108 enum BLE_GATTC_EVTS
gkroussos 0:637031152314 109 {
gkroussos 0:637031152314 110 BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP = BLE_GATTC_EVT_BASE, /**< Primary Service Discovery Response event. */
gkroussos 0:637031152314 111 BLE_GATTC_EVT_REL_DISC_RSP, /**< Relationship Discovery Response event. */
gkroussos 0:637031152314 112 BLE_GATTC_EVT_CHAR_DISC_RSP, /**< Characteristic Discovery Response event. */
gkroussos 0:637031152314 113 BLE_GATTC_EVT_DESC_DISC_RSP, /**< Descriptor Discovery Response event. */
gkroussos 0:637031152314 114 BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP, /**< Read By UUID Response event. */
gkroussos 0:637031152314 115 BLE_GATTC_EVT_READ_RSP, /**< Read Response event. */
gkroussos 0:637031152314 116 BLE_GATTC_EVT_CHAR_VALS_READ_RSP, /**< Read multiple Response event. */
gkroussos 0:637031152314 117 BLE_GATTC_EVT_WRITE_RSP, /**< Write Response event. */
gkroussos 0:637031152314 118 BLE_GATTC_EVT_HVX, /**< Handle Value Notification or Indication event. */
gkroussos 0:637031152314 119 BLE_GATTC_EVT_TIMEOUT /**< Timeout event. */
gkroussos 0:637031152314 120 };
gkroussos 0:637031152314 121
gkroussos 0:637031152314 122 /**@brief Event structure for BLE_GATTC_EVT_PRIM_SRVC_DISC_RSP. */
gkroussos 0:637031152314 123 typedef struct
gkroussos 0:637031152314 124 {
gkroussos 0:637031152314 125 uint16_t count; /**< Service count. */
gkroussos 0:637031152314 126 ble_gattc_service_t services[1]; /**< Service data, variable length. */
gkroussos 0:637031152314 127 } ble_gattc_evt_prim_srvc_disc_rsp_t;
gkroussos 0:637031152314 128
gkroussos 0:637031152314 129 /**@brief Event structure for BLE_GATTC_EVT_REL_DISC_RSP. */
gkroussos 0:637031152314 130 typedef struct
gkroussos 0:637031152314 131 {
gkroussos 0:637031152314 132 uint16_t count; /**< Include count. */
gkroussos 0:637031152314 133 ble_gattc_include_t includes[1]; /**< Include data, variable length. */
gkroussos 0:637031152314 134 } ble_gattc_evt_rel_disc_rsp_t;
gkroussos 0:637031152314 135
gkroussos 0:637031152314 136 /**@brief Event structure for BLE_GATTC_EVT_CHAR_DISC_RSP. */
gkroussos 0:637031152314 137 typedef struct
gkroussos 0:637031152314 138 {
gkroussos 0:637031152314 139 uint16_t count; /**< Characteristic count. */
gkroussos 0:637031152314 140 ble_gattc_char_t chars[1]; /**< Characteristic data, variable length. */
gkroussos 0:637031152314 141 } ble_gattc_evt_char_disc_rsp_t;
gkroussos 0:637031152314 142
gkroussos 0:637031152314 143 /**@brief Event structure for BLE_GATTC_EVT_DESC_DISC_RSP. */
gkroussos 0:637031152314 144 typedef struct
gkroussos 0:637031152314 145 {
gkroussos 0:637031152314 146 uint16_t count; /**< Descriptor count. */
gkroussos 0:637031152314 147 ble_gattc_desc_t descs[1]; /**< Descriptor data, variable length. */
gkroussos 0:637031152314 148 } ble_gattc_evt_desc_disc_rsp_t;
gkroussos 0:637031152314 149
gkroussos 0:637031152314 150 /**@brief GATT read by UUID handle value pair. */
gkroussos 0:637031152314 151 typedef struct
gkroussos 0:637031152314 152 {
gkroussos 0:637031152314 153 uint16_t handle; /**< Attribute Handle. */
gkroussos 0:637031152314 154 uint8_t *p_value; /**< Pointer to value, variable length (length available as value_len in ble_gattc_evt_read_by_uuid_rsp_t).
gkroussos 0:637031152314 155 Please note that this pointer is absolute to the memory provided by the user when retrieving the event,
gkroussos 0:637031152314 156 so it will effectively point to a location inside the handle_value array. */
gkroussos 0:637031152314 157 } ble_gattc_handle_value_t;
gkroussos 0:637031152314 158
gkroussos 0:637031152314 159 /**@brief Event structure for BLE_GATTC_EVT_CHAR_VAL_BY_UUID_READ_RSP. */
gkroussos 0:637031152314 160 typedef struct
gkroussos 0:637031152314 161 {
gkroussos 0:637031152314 162 uint16_t count; /**< Handle-Value Pair Count. */
gkroussos 0:637031152314 163 uint16_t value_len; /**< Length of the value in Handle-Value(s) list. */
gkroussos 0:637031152314 164 ble_gattc_handle_value_t handle_value[1]; /**< Handle-Value(s) list, variable length. */
gkroussos 0:637031152314 165 } ble_gattc_evt_char_val_by_uuid_read_rsp_t;
gkroussos 0:637031152314 166
gkroussos 0:637031152314 167 /**@brief Event structure for BLE_GATTC_EVT_READ_RSP. */
gkroussos 0:637031152314 168 typedef struct
gkroussos 0:637031152314 169 {
gkroussos 0:637031152314 170 uint16_t handle; /**< Attribute Handle. */
gkroussos 0:637031152314 171 uint16_t offset; /**< Offset of the attribute data. */
gkroussos 0:637031152314 172 uint16_t len; /**< Attribute data length. */
gkroussos 0:637031152314 173 uint8_t data[1]; /**< Attribute data, variable length. */
gkroussos 0:637031152314 174 } ble_gattc_evt_read_rsp_t;
gkroussos 0:637031152314 175
gkroussos 0:637031152314 176 /**@brief Event structure for BLE_GATTC_EVT_CHAR_VALS_READ_RSP. */
gkroussos 0:637031152314 177 typedef struct
gkroussos 0:637031152314 178 {
gkroussos 0:637031152314 179 uint16_t len; /**< Concatenated Attribute values length. */
gkroussos 0:637031152314 180 uint8_t values[1]; /**< Attribute values, variable length. */
gkroussos 0:637031152314 181 } ble_gattc_evt_char_vals_read_rsp_t;
gkroussos 0:637031152314 182
gkroussos 0:637031152314 183 /**@brief Event structure for BLE_GATTC_EVT_WRITE_RSP. */
gkroussos 0:637031152314 184 typedef struct
gkroussos 0:637031152314 185 {
gkroussos 0:637031152314 186 uint16_t handle; /**< Attribute Handle. */
gkroussos 0:637031152314 187 uint8_t write_op; /**< Type of write operation, see @ref BLE_GATT_WRITE_OPS. */
gkroussos 0:637031152314 188 uint16_t offset; /**< Data Offset. */
gkroussos 0:637031152314 189 uint16_t len; /**< Data length. */
gkroussos 0:637031152314 190 uint8_t data[1]; /**< Data, variable length. */
gkroussos 0:637031152314 191 } ble_gattc_evt_write_rsp_t;
gkroussos 0:637031152314 192
gkroussos 0:637031152314 193 /**@brief Event structure for BLE_GATTC_EVT_HVX. */
gkroussos 0:637031152314 194 typedef struct
gkroussos 0:637031152314 195 {
gkroussos 0:637031152314 196 uint16_t handle; /**< Handle to which the HVx operation applies. */
gkroussos 0:637031152314 197 uint8_t type; /**< Indication or Notification, see @ref BLE_GATT_HVX_TYPES. */
gkroussos 0:637031152314 198 uint16_t len; /**< Attribute data length. */
gkroussos 0:637031152314 199 uint8_t data[1]; /**< Attribute data, variable length. */
gkroussos 0:637031152314 200 } ble_gattc_evt_hvx_t;
gkroussos 0:637031152314 201
gkroussos 0:637031152314 202 /**@brief Event structure for BLE_GATTC_EVT_TIMEOUT. */
gkroussos 0:637031152314 203 typedef struct
gkroussos 0:637031152314 204 {
gkroussos 0:637031152314 205 uint8_t src; /**< Timeout source, see @ref BLE_GATT_TIMEOUT_SOURCES. */
gkroussos 0:637031152314 206 } ble_gattc_evt_timeout_t;
gkroussos 0:637031152314 207
gkroussos 0:637031152314 208 /**@brief GATTC event type. */
gkroussos 0:637031152314 209 typedef struct
gkroussos 0:637031152314 210 {
gkroussos 0:637031152314 211 uint16_t conn_handle; /**< Connection Handle on which event occured. */
gkroussos 0:637031152314 212 uint16_t gatt_status; /**< GATT status code for the operation, see @ref BLE_GATT_STATUS_CODES. */
gkroussos 0:637031152314 213 uint16_t error_handle; /**< In case of error: The handle causing the error. In all other cases BLE_GATT_HANDLE_INVALID. */
gkroussos 0:637031152314 214 union
gkroussos 0:637031152314 215 {
gkroussos 0:637031152314 216 ble_gattc_evt_prim_srvc_disc_rsp_t prim_srvc_disc_rsp; /**< Primary Service Discovery Response Event Parameters. */
gkroussos 0:637031152314 217 ble_gattc_evt_rel_disc_rsp_t rel_disc_rsp; /**< Relationship Discovery Response Event Parameters. */
gkroussos 0:637031152314 218 ble_gattc_evt_char_disc_rsp_t char_disc_rsp; /**< Characteristic Discovery Response Event Parameters. */
gkroussos 0:637031152314 219 ble_gattc_evt_desc_disc_rsp_t desc_disc_rsp; /**< Descriptor Discovery Response Event Parameters. */
gkroussos 0:637031152314 220 ble_gattc_evt_char_val_by_uuid_read_rsp_t char_val_by_uuid_read_rsp; /**< Characteristic Value Read by UUID Response Event Parameters. */
gkroussos 0:637031152314 221 ble_gattc_evt_read_rsp_t read_rsp; /**< Read Response Event Parameters. */
gkroussos 0:637031152314 222 ble_gattc_evt_char_vals_read_rsp_t char_vals_read_rsp; /**< Characteristic Values Read Response Event Parameters. */
gkroussos 0:637031152314 223 ble_gattc_evt_write_rsp_t write_rsp; /**< Write Response Event Parameters. */
gkroussos 0:637031152314 224 ble_gattc_evt_hvx_t hvx; /**< Handle Value Notification/Indication Event Parameters. */
gkroussos 0:637031152314 225 ble_gattc_evt_timeout_t timeout; /**< Timeout Event Parameters. */
gkroussos 0:637031152314 226 } params; /**< Event Parameters. @note Only valid if @ref gatt_status == BLE_GATT_STATUS_SUCCESS. */
gkroussos 0:637031152314 227 } ble_gattc_evt_t;
gkroussos 0:637031152314 228
gkroussos 0:637031152314 229
gkroussos 0:637031152314 230 /**@brief Initiate or continue a GATT Primary Service Discovery procedure.
gkroussos 0:637031152314 231 *
gkroussos 0:637031152314 232 * @details This function initiates a Primary Service discovery, starting from the supplied handle.
gkroussos 0:637031152314 233 * If the last service has not been reached, this must be called again with an updated start handle value to continue the search.
gkroussos 0:637031152314 234 *
gkroussos 0:637031152314 235 * @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
gkroussos 0:637031152314 236 * type BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
gkroussos 0:637031152314 237 *
gkroussos 0:637031152314 238 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 239 * @param[in] start_handle Handle to start searching from.
gkroussos 0:637031152314 240 * @param[in] p_srvc_uuid Pointer to the service UUID to be found. If it is NULL, all primary services will be returned.
gkroussos 0:637031152314 241 *
gkroussos 0:637031152314 242 * @return @ref NRF_SUCCESS Successfully started or resumed the Primary Service Discovery procedure.
gkroussos 0:637031152314 243 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 244 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
gkroussos 0:637031152314 245 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 246 */
gkroussos 0:637031152314 247 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 * const p_srvc_uuid));
gkroussos 0:637031152314 248
gkroussos 0:637031152314 249
gkroussos 0:637031152314 250 /**@brief Initiate or continue a GATT Relationship Discovery procedure.
gkroussos 0:637031152314 251 *
gkroussos 0:637031152314 252 * @details This function initiates the Find Included Services sub-procedure. If the last included service has not been reached,
gkroussos 0:637031152314 253 * this must be called again with an updated handle range to continue the search.
gkroussos 0:637031152314 254 *
gkroussos 0:637031152314 255 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 256 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on.
gkroussos 0:637031152314 257 *
gkroussos 0:637031152314 258 * @return @ref NRF_SUCCESS Successfully started or resumed the Relationship Discovery procedure.
gkroussos 0:637031152314 259 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 260 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 261 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
gkroussos 0:637031152314 262 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 263 */
gkroussos 0:637031152314 264 SVCALL(SD_BLE_GATTC_RELATIONSHIPS_DISCOVER, uint32_t, sd_ble_gattc_relationships_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range));
gkroussos 0:637031152314 265
gkroussos 0:637031152314 266
gkroussos 0:637031152314 267 /**@brief Initiate or continue a GATT Characteristic Discovery procedure.
gkroussos 0:637031152314 268 *
gkroussos 0:637031152314 269 * @details This function initiates a Characteristic discovery procedure. If the last Characteristic has not been reached,
gkroussos 0:637031152314 270 * this must be called again with an updated handle range to continue the discovery.
gkroussos 0:637031152314 271 *
gkroussos 0:637031152314 272 * @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
gkroussos 0:637031152314 273 * type BLE_UUID_TYPE_UNKNOWN will be received in the corresponding event.
gkroussos 0:637031152314 274 *
gkroussos 0:637031152314 275 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 276 * @param[in] p_handle_range A pointer to the range of handles of the Service to perform this procedure on.
gkroussos 0:637031152314 277 *
gkroussos 0:637031152314 278 * @return @ref NRF_SUCCESS Successfully started or resumed the Characteristic Discovery procedure.
gkroussos 0:637031152314 279 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 280 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 281 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 282 */
gkroussos 0:637031152314 283 SVCALL(SD_BLE_GATTC_CHARACTERISTICS_DISCOVER, uint32_t, sd_ble_gattc_characteristics_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range));
gkroussos 0:637031152314 284
gkroussos 0:637031152314 285
gkroussos 0:637031152314 286 /**@brief Initiate or continue a GATT Characteristic Descriptor Discovery procedure.
gkroussos 0:637031152314 287 *
gkroussos 0:637031152314 288 * @details This function initiates the Characteristic Descriptor discovery procedure. If the last Descriptor has not been reached,
gkroussos 0:637031152314 289 * this must be called again with an updated handle range to continue the discovery.
gkroussos 0:637031152314 290 *
gkroussos 0:637031152314 291 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 292 * @param[in] p_handle_range A pointer to the range of handles of the Characteristic to perform this procedure on.
gkroussos 0:637031152314 293 *
gkroussos 0:637031152314 294 * @return @ref NRF_SUCCESS Successfully started or resumed the Descriptor Discovery procedure.
gkroussos 0:637031152314 295 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 296 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 297 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 298 */
gkroussos 0:637031152314 299 SVCALL(SD_BLE_GATTC_DESCRIPTORS_DISCOVER, uint32_t, sd_ble_gattc_descriptors_discover(uint16_t conn_handle, ble_gattc_handle_range_t const * const p_handle_range));
gkroussos 0:637031152314 300
gkroussos 0:637031152314 301
gkroussos 0:637031152314 302 /**@brief Initiate or continue a GATT Read using Characteristic UUID procedure.
gkroussos 0:637031152314 303 *
gkroussos 0:637031152314 304 * @details This function initiates the Read using Characteristic UUID procedure. If the last Characteristic has not been reached,
gkroussos 0:637031152314 305 * this must be called again with an updated handle range to continue the discovery.
gkroussos 0:637031152314 306 *
gkroussos 0:637031152314 307 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 308 * @param[in] p_uuid Pointer to a Characteristic value UUID to read.
gkroussos 0:637031152314 309 * @param[in] p_handle_range A pointer to the range of handles to perform this procedure on.
gkroussos 0:637031152314 310 *
gkroussos 0:637031152314 311 * @return @ref NRF_SUCCESS Successfully started or resumed the Read using Characteristic UUID procedure.
gkroussos 0:637031152314 312 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 313 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 314 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 315 */
gkroussos 0:637031152314 316 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 * const p_uuid, ble_gattc_handle_range_t const * const p_handle_range));
gkroussos 0:637031152314 317
gkroussos 0:637031152314 318
gkroussos 0:637031152314 319 /**@brief Initiate or continue a GATT Read (Long) Characteristic or Descriptor procedure.
gkroussos 0:637031152314 320 *
gkroussos 0:637031152314 321 * @details This function initiates a GATT Read (Long) Characteristic or Descriptor procedure. If the Characteristic or Descriptor
gkroussos 0:637031152314 322 * to be read is longer than GATT_MTU - 1, this function must be called multiple times with appropriate offset to read the
gkroussos 0:637031152314 323 * complete value.
gkroussos 0:637031152314 324 *
gkroussos 0:637031152314 325 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 326 * @param[in] handle The handle of the attribute to be read.
gkroussos 0:637031152314 327 * @param[in] offset Offset into the attribute value to be read.
gkroussos 0:637031152314 328 *
gkroussos 0:637031152314 329 * @return @ref NRF_SUCCESS Successfully started or resumed the Read (Long) procedure.
gkroussos 0:637031152314 330 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 331 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 332 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 333 */
gkroussos 0:637031152314 334 SVCALL(SD_BLE_GATTC_READ, uint32_t, sd_ble_gattc_read(uint16_t conn_handle, uint16_t handle, uint16_t offset));
gkroussos 0:637031152314 335
gkroussos 0:637031152314 336
gkroussos 0:637031152314 337 /**@brief Initiate a GATT Read Multiple Characteristic Values procedure.
gkroussos 0:637031152314 338 *
gkroussos 0:637031152314 339 * @details This function initiates a GATT Read Multiple Characteristic Values procedure.
gkroussos 0:637031152314 340 *
gkroussos 0:637031152314 341 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 342 * @param[in] p_handles A pointer to the handle(s) of the attribute(s) to be read.
gkroussos 0:637031152314 343 * @param[in] handle_count The number of handles in p_handles.
gkroussos 0:637031152314 344 *
gkroussos 0:637031152314 345 * @return @ref NRF_SUCCESS Successfully started the Read Multiple Characteristic Values procedure.
gkroussos 0:637031152314 346 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 347 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 348 * @return @ref NRF_ERROR_BUSY Client procedure already in progress.
gkroussos 0:637031152314 349 */
gkroussos 0:637031152314 350 SVCALL(SD_BLE_GATTC_CHAR_VALUES_READ, uint32_t, sd_ble_gattc_char_values_read(uint16_t conn_handle, uint16_t const * const p_handles, uint16_t handle_count));
gkroussos 0:637031152314 351
gkroussos 0:637031152314 352
gkroussos 0:637031152314 353 /**@brief Perform a Write (Characteristic Value or Descriptor, with or without response, signed or not, long or reliable) procedure.
gkroussos 0:637031152314 354 *
gkroussos 0:637031152314 355 * @details This function can perform all write procedures described in GATT.
gkroussos 0:637031152314 356 *
gkroussos 0:637031152314 357 * @note It is important to note that a write without response will <b>consume an application buffer</b>, and will therefore
gkroussos 0:637031152314 358 * generate a @ref BLE_EVT_TX_COMPLETE event when the packet has been transmitted. A write on the other hand will use the
gkroussos 0:637031152314 359 * standard client internal buffer and thus will only generate a @ref BLE_GATTC_EVT_WRITE_RSP event as soon as the write response
gkroussos 0:637031152314 360 * has been received from the peer. Please see the documentation of @ref sd_ble_tx_buffer_count_get for more details.
gkroussos 0:637031152314 361 *
gkroussos 0:637031152314 362 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 363 * @param[in] p_write_params A pointer to a write parameters structure.
gkroussos 0:637031152314 364 *
gkroussos 0:637031152314 365 * @return @ref NRF_SUCCESS Successfully started the Write procedure.
gkroussos 0:637031152314 366 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 367 * @return @ref NRF_ERROR_INVALID_ADDR Invalid pointer supplied.
gkroussos 0:637031152314 368 * @return @ref NRF_ERROR_INVALID_PARAM Invalid parameter(s) supplied.
gkroussos 0:637031152314 369 * @return @ref NRF_ERROR_DATA_SIZE Invalid data size(s) supplied.
gkroussos 0:637031152314 370 * @return @ref NRF_ERROR_BUSY Procedure already in progress.
gkroussos 0:637031152314 371 * @return @ref BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.
gkroussos 0:637031152314 372 */
gkroussos 0:637031152314 373 SVCALL(SD_BLE_GATTC_WRITE, uint32_t, sd_ble_gattc_write(uint16_t conn_handle, ble_gattc_write_params_t const * const p_write_params));
gkroussos 0:637031152314 374
gkroussos 0:637031152314 375
gkroussos 0:637031152314 376 /**@brief Send a Handle Value Confirmation to the GATT Server.
gkroussos 0:637031152314 377 *
gkroussos 0:637031152314 378 * @param[in] conn_handle The connection handle identifying the connection to perform this procedure on.
gkroussos 0:637031152314 379 * @param[in] handle The handle of the attribute in the indication.
gkroussos 0:637031152314 380 *
gkroussos 0:637031152314 381 * @return @ref NRF_SUCCESS Successfully queued the Handle Value Confirmation for transmission.
gkroussos 0:637031152314 382 * @return @ref BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
gkroussos 0:637031152314 383 * @return @ref NRF_ERROR_INVALID_STATE No Indication pending to be confirmed.
gkroussos 0:637031152314 384 * @return @ref BLE_ERROR_INVALID_ATTR_HANDLE Invalid attribute handle.
gkroussos 0:637031152314 385 * @return @ref BLE_ERROR_NO_TX_BUFFERS There are no available buffers left.
gkroussos 0:637031152314 386 */
gkroussos 0:637031152314 387 SVCALL(SD_BLE_GATTC_HV_CONFIRM, uint32_t, sd_ble_gattc_hv_confirm(uint16_t conn_handle, uint16_t handle));
gkroussos 0:637031152314 388
gkroussos 0:637031152314 389
gkroussos 0:637031152314 390 #endif /* BLE_GATTC_H__ */
gkroussos 0:637031152314 391
gkroussos 0:637031152314 392 /**
gkroussos 0:637031152314 393 @}
gkroussos 0:637031152314 394 @}
gkroussos 0:637031152314 395 */