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