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