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