BLE_API wrapper library for STMicroelectronics' BlueNRG Bluetooth Low Energy expansion board shield

Fork of X_NUCLEO_IDB0XA1 by ST Expansion SW Team

Committer:
Wolfgang Betz
Date:
Wed Oct 07 08:39:04 2015 +0200
Revision:
132:51056160fa4a
Child:
219:9981f62cdb1a
Andrea's version as of mail from 10/06/2015 05:56 PM

From: Andrea PALMIERI <andrea.palmieri@st.com>
To: Wolfgang BETZ <wolfgang.betz@st.com>, Rohit Grover <rohit.grover@arm.com>,
Antonio VILEI <antonio.vilei@st.com>, Mihail Stoyanov
<Mihail.Stoyanov@arm.com>
CC: Nicola CAPOVILLA <nicola.capovilla@st.com>, Silvio Lucio OLIVA
<silvio.oliva@st.com>, "jonathan.austin@arm.com" <jonathan.austin@arm.com>
Content-Class: urn:content-classes:message
Date: Tue, 6 Oct 2015 17:56:34 +0200
Subject: RE: Arduino Compatibility of X-NUCLEO-IDB04A1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Wolfgang Betz 132:51056160fa4a 1 /******************** (C) COPYRIGHT 2014 STMicroelectronics ********************
Wolfgang Betz 132:51056160fa4a 2 * File Name : bluenrg_gatt_aci.h
Wolfgang Betz 132:51056160fa4a 3 * Author : AMS - AAS
Wolfgang Betz 132:51056160fa4a 4 * Version : V1.0.0
Wolfgang Betz 132:51056160fa4a 5 * Date : 26-Jun-2014
Wolfgang Betz 132:51056160fa4a 6 * Description : Header file with GATT commands for BlueNRG FW6.3.
Wolfgang Betz 132:51056160fa4a 7 ********************************************************************************
Wolfgang Betz 132:51056160fa4a 8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
Wolfgang Betz 132:51056160fa4a 9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
Wolfgang Betz 132:51056160fa4a 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
Wolfgang Betz 132:51056160fa4a 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
Wolfgang Betz 132:51056160fa4a 12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING
Wolfgang Betz 132:51056160fa4a 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
Wolfgang Betz 132:51056160fa4a 14 *******************************************************************************/
Wolfgang Betz 132:51056160fa4a 15
Wolfgang Betz 132:51056160fa4a 16 #ifndef __BLUENRG_GATT_ACI_H__
Wolfgang Betz 132:51056160fa4a 17 #define __BLUENRG_GATT_ACI_H__
Wolfgang Betz 132:51056160fa4a 18
Wolfgang Betz 132:51056160fa4a 19 #include "bluenrg_gatt_server.h"
Wolfgang Betz 132:51056160fa4a 20
Wolfgang Betz 132:51056160fa4a 21 /**
Wolfgang Betz 132:51056160fa4a 22 *@addtogroup GATT GATT
Wolfgang Betz 132:51056160fa4a 23 *@brief GATT layer.
Wolfgang Betz 132:51056160fa4a 24 *@{
Wolfgang Betz 132:51056160fa4a 25 */
Wolfgang Betz 132:51056160fa4a 26
Wolfgang Betz 132:51056160fa4a 27 /**
Wolfgang Betz 132:51056160fa4a 28 *@defgroup GATT_Functions GATT functions
Wolfgang Betz 132:51056160fa4a 29 *@brief API for GATT layer.
Wolfgang Betz 132:51056160fa4a 30 *@{
Wolfgang Betz 132:51056160fa4a 31 */
Wolfgang Betz 132:51056160fa4a 32
Wolfgang Betz 132:51056160fa4a 33 /**
Wolfgang Betz 132:51056160fa4a 34 * @brief Initialize the GATT layer for server and client roles.
Wolfgang Betz 132:51056160fa4a 35 * @note It adds also the GATT service with Service Changed Characteristic.
Wolfgang Betz 132:51056160fa4a 36 * Until this command is issued the GATT channel will not process any commands
Wolfgang Betz 132:51056160fa4a 37 * even if the connection is opened. This command has to be given
Wolfgang Betz 132:51056160fa4a 38 * before using any of the GAP features.
Wolfgang Betz 132:51056160fa4a 39 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 40 */
Wolfgang Betz 132:51056160fa4a 41 tBleStatus aci_gatt_init(void);
Wolfgang Betz 132:51056160fa4a 42
Wolfgang Betz 132:51056160fa4a 43 /**
Wolfgang Betz 132:51056160fa4a 44 * @brief Add a service to the GATT Server. When a service is created in the server, the Host needs
Wolfgang Betz 132:51056160fa4a 45 * to reserve the handle ranges for this service using max_attr_records parameter. This
Wolfgang Betz 132:51056160fa4a 46 * parameter specifies the maximum number of attribute records that can be added to this
Wolfgang Betz 132:51056160fa4a 47 * service (including the service attribute, include attribute, characteristic attribute,
Wolfgang Betz 132:51056160fa4a 48 * characteristic value attribute and characteristic descriptor attribute). Handle of the
Wolfgang Betz 132:51056160fa4a 49 * created service is returned.
Wolfgang Betz 132:51056160fa4a 50 * @param service_uuid_type Type of service UUID (16-bit or 128-bit). See @ref UUID_Types "UUID Types".
Wolfgang Betz 132:51056160fa4a 51 * @param[in] service_uuid 16-bit or 128-bit UUID based on the UUID Type field
Wolfgang Betz 132:51056160fa4a 52 * @param service_type Primary or secondary service. See @ref Service_type "Service Type".
Wolfgang Betz 132:51056160fa4a 53 * @param max_attr_records Maximum number of attribute records that can be added to this service
Wolfgang Betz 132:51056160fa4a 54 * @param[out] serviceHandle Handle of the Service. When this service is added to the service,
Wolfgang Betz 132:51056160fa4a 55 * a handle is allocated by the server to this service. Server also
Wolfgang Betz 132:51056160fa4a 56 * allocates a range of handles for this service from serviceHandle to
Wolfgang Betz 132:51056160fa4a 57 * <serviceHandle + max_attr_records>.
Wolfgang Betz 132:51056160fa4a 58 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 59 */
Wolfgang Betz 132:51056160fa4a 60 tBleStatus aci_gatt_add_serv(uint8_t service_uuid_type,
Wolfgang Betz 132:51056160fa4a 61 const uint8_t* service_uuid,
Wolfgang Betz 132:51056160fa4a 62 uint8_t service_type,
Wolfgang Betz 132:51056160fa4a 63 uint8_t max_attr_records,
Wolfgang Betz 132:51056160fa4a 64 uint16_t *serviceHandle);
Wolfgang Betz 132:51056160fa4a 65
Wolfgang Betz 132:51056160fa4a 66 /**
Wolfgang Betz 132:51056160fa4a 67 * @brief Include a service given by included_start_handle and included_end_handle to another service
Wolfgang Betz 132:51056160fa4a 68 * given by service_handle. Attribute server creates an INCLUDE definition attribute and return
Wolfgang Betz 132:51056160fa4a 69 * the handle of this attribute in included_handle.
Wolfgang Betz 132:51056160fa4a 70 * @param service_handle Handle of the service to which another service has to be included
Wolfgang Betz 132:51056160fa4a 71 * @param included_start_handle Start Handle of the service which has to be included in service
Wolfgang Betz 132:51056160fa4a 72 * @param included_end_handle End Handle of the service which has to be included in service
Wolfgang Betz 132:51056160fa4a 73 * @param included_uuid_type Type of UUID for included service (16-bit or 128-bit). See @ref Well-Known_UUIDs "Well-Known UUIDs".
Wolfgang Betz 132:51056160fa4a 74 * @param[in] included_uuid 16-bit or 128-bit UUID.
Wolfgang Betz 132:51056160fa4a 75 * @param[out] included_handle Handle of the include declaration.
Wolfgang Betz 132:51056160fa4a 76 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 77 */
Wolfgang Betz 132:51056160fa4a 78 tBleStatus aci_gatt_include_service(uint16_t service_handle, uint16_t included_start_handle,
Wolfgang Betz 132:51056160fa4a 79 uint16_t included_end_handle, uint8_t included_uuid_type,
Wolfgang Betz 132:51056160fa4a 80 const uint8_t* included_uuid, uint16_t *included_handle);
Wolfgang Betz 132:51056160fa4a 81
Wolfgang Betz 132:51056160fa4a 82 /**
Wolfgang Betz 132:51056160fa4a 83 * @brief Add a characteristic to a service.
Wolfgang Betz 132:51056160fa4a 84 * @param serviceHandle Handle of the service to which the characteristic has to be added.
Wolfgang Betz 132:51056160fa4a 85 * @param charUuidType Type of characteristic UUID (16-bit or 128-bit). See @ref UUID_Types "UUID Types".
Wolfgang Betz 132:51056160fa4a 86 * @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 87 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 88 * @param charUuid 16-bit or 128-bit UUID.
Wolfgang Betz 132:51056160fa4a 89 * @param charValueLen Maximum length of the characteristic value.
Wolfgang Betz 132:51056160fa4a 90 * @param charProperties Bitwise OR values of Characteristic Properties (defined in Volume 3,
Wolfgang Betz 132:51056160fa4a 91 * Section 3.3.3.1 of Bluetooth Specification 4.0). See @ref Char_properties "Characteristic properties".
Wolfgang Betz 132:51056160fa4a 92 * @param secPermissions Security permissions for the added characteristic. See @ref Security_permissions "Security permissions".
Wolfgang Betz 132:51056160fa4a 93 * @arg ATTR_PERMISSION_NONE
Wolfgang Betz 132:51056160fa4a 94 * @arg ATTR_PERMISSION_AUTHEN_READ
Wolfgang Betz 132:51056160fa4a 95 * @arg ATTR_PERMISSION_AUTHOR_READ
Wolfgang Betz 132:51056160fa4a 96 * @arg ATTR_PERMISSION_ENCRY_READ
Wolfgang Betz 132:51056160fa4a 97 * @arg ATTR_PERMISSION_AUTHEN_WRITE
Wolfgang Betz 132:51056160fa4a 98 * @arg ATTR_PERMISSION_AUTHOR_WRITE
Wolfgang Betz 132:51056160fa4a 99 * @arg ATTR_PERMISSION_ENCRY_WRITE
Wolfgang Betz 132:51056160fa4a 100 * @param gattEvtMask Bit mask that enables events that will be sent to the application by the GATT server
Wolfgang Betz 132:51056160fa4a 101 * on certain ATT requests. See @ref Gatt_Event_Mask "Gatt Event Mask".
Wolfgang Betz 132:51056160fa4a 102 * @arg GATT_DONT_NOTIFY_EVENTS
Wolfgang Betz 132:51056160fa4a 103 * @arg GATT_NOTIFY_ATTRIBUTE_WRITE
Wolfgang Betz 132:51056160fa4a 104 * @arg GATT_NOTIFY_WRITE_REQ_AND_WAIT_FOR_APPL_RESP
Wolfgang Betz 132:51056160fa4a 105 * @arg GATT_NOTIFY_READ_REQ_AND_WAIT_FOR_APPL_RESP
Wolfgang Betz 132:51056160fa4a 106 * @param encryKeySize The minimum encryption key size requirement for this attribute. Valid Range: 7 to 16.
Wolfgang Betz 132:51056160fa4a 107 * @param isVariable If the attribute has a variable length value field (1) or not (0).
Wolfgang Betz 132:51056160fa4a 108 * @param charHandle Handle of the Characteristic that has been added. It is the handle of the characteristic declaration.
Wolfgang Betz 132:51056160fa4a 109 * The attribute that holds the characteristic value is allocated at the next handle, followed by the Client
Wolfgang Betz 132:51056160fa4a 110 * Characteristic Configuration descriptor if the characteristic has @ref CHAR_PROP_NOTIFY or @ref CHAR_PROP_INDICATE
Wolfgang Betz 132:51056160fa4a 111 * properties.
Wolfgang Betz 132:51056160fa4a 112 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 113 */
Wolfgang Betz 132:51056160fa4a 114 tBleStatus aci_gatt_add_char(uint16_t serviceHandle,
Wolfgang Betz 132:51056160fa4a 115 uint8_t charUuidType,
Wolfgang Betz 132:51056160fa4a 116 const uint8_t* charUuid,
Wolfgang Betz 132:51056160fa4a 117 uint8_t charValueLen,
Wolfgang Betz 132:51056160fa4a 118 uint8_t charProperties,
Wolfgang Betz 132:51056160fa4a 119 uint8_t secPermissions,
Wolfgang Betz 132:51056160fa4a 120 uint8_t gattEvtMask,
Wolfgang Betz 132:51056160fa4a 121 uint8_t encryKeySize,
Wolfgang Betz 132:51056160fa4a 122 uint8_t isVariable,
Wolfgang Betz 132:51056160fa4a 123 uint16_t* charHandle);
Wolfgang Betz 132:51056160fa4a 124
Wolfgang Betz 132:51056160fa4a 125 /**
Wolfgang Betz 132:51056160fa4a 126 * Add a characteristic descriptor to a service.
Wolfgang Betz 132:51056160fa4a 127 * @param serviceHandle Handle of the service to which the characteristic belongs
Wolfgang Betz 132:51056160fa4a 128 * @param charHandle Handle of the characteristic to which description has to be added.
Wolfgang Betz 132:51056160fa4a 129 * @param descUuidType 16-bit or 128-bit UUID. See @ref UUID_Types "UUID Types".
Wolfgang Betz 132:51056160fa4a 130 * @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 131 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 132 * @param[in] uuid UUID of the Characteristic descriptor. It can be one of the UUID assigned by Bluetooth SIG
Wolfgang Betz 132:51056160fa4a 133 * (Well_known_UUIDs) or a user-defined one.
Wolfgang Betz 132:51056160fa4a 134 * @param descValueMaxLen The maximum length of the descriptor value
Wolfgang Betz 132:51056160fa4a 135 * @param descValueLen Current Length of the characteristic descriptor value
Wolfgang Betz 132:51056160fa4a 136 * @param[in] descValue Value of the characteristic description
Wolfgang Betz 132:51056160fa4a 137 * @param secPermissions Security permissions for the added descriptor. See @ref Security_permissions "Security permissions".
Wolfgang Betz 132:51056160fa4a 138 * @arg ATTR_PERMISSION_NONE
Wolfgang Betz 132:51056160fa4a 139 * @arg ATTR_PERMISSION_AUTHEN_READ
Wolfgang Betz 132:51056160fa4a 140 * @arg ATTR_PERMISSION_AUTHOR_READ
Wolfgang Betz 132:51056160fa4a 141 * @arg ATTR_PERMISSION_ENCRY_READ
Wolfgang Betz 132:51056160fa4a 142 * @arg ATTR_PERMISSION_AUTHEN_WRITE
Wolfgang Betz 132:51056160fa4a 143 * @arg ATTR_PERMISSION_AUTHOR_WRITE
Wolfgang Betz 132:51056160fa4a 144 * @arg ATTR_PERMISSION_ENCRY_WRITE
Wolfgang Betz 132:51056160fa4a 145 * @param accPermissions Access permissions for the added descriptor. See @ref Access_permissions "Access permissions".
Wolfgang Betz 132:51056160fa4a 146 * @arg ATTR_NO_ACCESS
Wolfgang Betz 132:51056160fa4a 147 * @arg ATTR_ACCESS_READ_ONLY
Wolfgang Betz 132:51056160fa4a 148 * @arg ATTR_ACCESS_WRITE_REQ_ONLY
Wolfgang Betz 132:51056160fa4a 149 * @arg ATTR_ACCESS_READ_WRITE
Wolfgang Betz 132:51056160fa4a 150 * @arg ATTR_ACCESS_WRITE_WITHOUT_RESPONSE
Wolfgang Betz 132:51056160fa4a 151 * @arg ATTR_ACCESS_SIGNED_WRITE_ALLOWED
Wolfgang Betz 132:51056160fa4a 152 * @param gattEvtMask Bit mask that enables events that will be sent to the application by the GATT server
Wolfgang Betz 132:51056160fa4a 153 * on certain ATT requests. See @ref Gatt_Event_Mask "Gatt Event Mask".
Wolfgang Betz 132:51056160fa4a 154 * @param encryKeySize The minimum encryption key size requirement for this attribute. Valid Range: 7 to 16.
Wolfgang Betz 132:51056160fa4a 155 * @param isVariable If the attribute has a variable length value field (1) or not (0).
Wolfgang Betz 132:51056160fa4a 156 * @param[out] descHandle Handle of the Characteristic Descriptor.
Wolfgang Betz 132:51056160fa4a 157 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 158 */
Wolfgang Betz 132:51056160fa4a 159 tBleStatus aci_gatt_add_char_desc(uint16_t serviceHandle,
Wolfgang Betz 132:51056160fa4a 160 uint16_t charHandle,
Wolfgang Betz 132:51056160fa4a 161 uint8_t descUuidType,
Wolfgang Betz 132:51056160fa4a 162 const uint8_t* uuid,
Wolfgang Betz 132:51056160fa4a 163 uint8_t descValueMaxLen,
Wolfgang Betz 132:51056160fa4a 164 uint8_t descValueLen,
Wolfgang Betz 132:51056160fa4a 165 const void* descValue,
Wolfgang Betz 132:51056160fa4a 166 uint8_t secPermissions,
Wolfgang Betz 132:51056160fa4a 167 uint8_t accPermissions,
Wolfgang Betz 132:51056160fa4a 168 uint8_t gattEvtMask,
Wolfgang Betz 132:51056160fa4a 169 uint8_t encryKeySize,
Wolfgang Betz 132:51056160fa4a 170 uint8_t isVariable,
Wolfgang Betz 132:51056160fa4a 171 uint16_t* descHandle);
Wolfgang Betz 132:51056160fa4a 172
Wolfgang Betz 132:51056160fa4a 173 /**
Wolfgang Betz 132:51056160fa4a 174 * @brief Update a characteristic value in a service.
Wolfgang Betz 132:51056160fa4a 175 * @note If notifications (or indications) are enabled on that characteristic, a notification (or indication)
Wolfgang Betz 132:51056160fa4a 176 * will be sent to the client after sending this command to the BlueNRG. The command is queued into the
Wolfgang Betz 132:51056160fa4a 177 * BlueNRG command queue. If the buffer is full, because previous commands could not be still processed,
Wolfgang Betz 132:51056160fa4a 178 * the function will return @ref BLE_STATUS_INSUFFICIENT_RESOURCES. This will happen if notifications (or
Wolfgang Betz 132:51056160fa4a 179 * indications) are enabled and the application calls aci_gatt_update_char_value() at an higher rate
Wolfgang Betz 132:51056160fa4a 180 * than what is allowed by the link. Throughput on BLE link depends on connection interval and
Wolfgang Betz 132:51056160fa4a 181 * connection length parameters (decided by the master, see aci_l2cap_connection_parameter_update_request()
Wolfgang Betz 132:51056160fa4a 182 * for more info on how to suggest new connection parameters from a slave). If the application does not
Wolfgang Betz 132:51056160fa4a 183 * want to lose notifications because BlueNRG buffer becomes full, it has to retry again till the function
Wolfgang Betz 132:51056160fa4a 184 * returns @ref BLE_STATUS_SUCCESS or any other error code.\n
Wolfgang Betz 132:51056160fa4a 185 * Example:\n
Wolfgang Betz 132:51056160fa4a 186 * Here if BlueNRG buffer become full because BlueNRG was not able to send packets for a while, some
Wolfgang Betz 132:51056160fa4a 187 * notifications will be lost.
Wolfgang Betz 132:51056160fa4a 188 * @code
Wolfgang Betz 132:51056160fa4a 189 * tBleStatus Free_Fall_Notify(void)
Wolfgang Betz 132:51056160fa4a 190 * {
Wolfgang Betz 132:51056160fa4a 191 * uint8_t val;
Wolfgang Betz 132:51056160fa4a 192 * tBleStatus ret;
Wolfgang Betz 132:51056160fa4a 193 *
Wolfgang Betz 132:51056160fa4a 194 * val = 0x01;
Wolfgang Betz 132:51056160fa4a 195 * ret = aci_gatt_update_char_value(accServHandle, freeFallCharHandle, 0, 1, &val);
Wolfgang Betz 132:51056160fa4a 196 *
Wolfgang Betz 132:51056160fa4a 197 * if (ret != BLE_STATUS_SUCCESS){
Wolfgang Betz 132:51056160fa4a 198 * PRINTF("Error while updating ACC characteristic.\n") ;
Wolfgang Betz 132:51056160fa4a 199 * return BLE_STATUS_ERROR ;
Wolfgang Betz 132:51056160fa4a 200 * }
Wolfgang Betz 132:51056160fa4a 201 * return BLE_STATUS_SUCCESS;
Wolfgang Betz 132:51056160fa4a 202 * }
Wolfgang Betz 132:51056160fa4a 203 * @endcode
Wolfgang Betz 132:51056160fa4a 204 * Here if BlueNRG buffer become full, the application try again to send the notification.
Wolfgang Betz 132:51056160fa4a 205 * @code
Wolfgang Betz 132:51056160fa4a 206 * struct timer t;
Wolfgang Betz 132:51056160fa4a 207 * Timer_Set(&t, CLOCK_SECOND*10);
Wolfgang Betz 132:51056160fa4a 208 * while(aci_gatt_update_char_value(chatServHandle,TXCharHandle,0,len,array_val)==BLE_STATUS_INSUFFICIENT_RESOURCES){
Wolfgang Betz 132:51056160fa4a 209 * // Radio is busy (buffer full).
Wolfgang Betz 132:51056160fa4a 210 * if(Timer_Expired(&t))
Wolfgang Betz 132:51056160fa4a 211 * break;
Wolfgang Betz 132:51056160fa4a 212 * }
Wolfgang Betz 132:51056160fa4a 213 * @endcode
Wolfgang Betz 132:51056160fa4a 214 *
Wolfgang Betz 132:51056160fa4a 215 * @param servHandle Handle of the service to which characteristic belongs
Wolfgang Betz 132:51056160fa4a 216 * @param charHandle Handle of the characteristic
Wolfgang Betz 132:51056160fa4a 217 * @param charValOffset The offset from which the attribute value has to be updated. If this is set to 0,
Wolfgang Betz 132:51056160fa4a 218 * and the attribute value is of variable length, then the length of the attribute will
Wolfgang Betz 132:51056160fa4a 219 * be set to the charValueLen. If the charValOffset is set to a value greater than 0,
Wolfgang Betz 132:51056160fa4a 220 * then the length of the attribute will be set to the maximum length as specified for
Wolfgang Betz 132:51056160fa4a 221 * the attribute while adding the characteristic.
Wolfgang Betz 132:51056160fa4a 222 * @param charValueLen Length of the characteristic value in octets
Wolfgang Betz 132:51056160fa4a 223 * @param[in] charValue Characteristic value
Wolfgang Betz 132:51056160fa4a 224 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 225 */
Wolfgang Betz 132:51056160fa4a 226 tBleStatus aci_gatt_update_char_value(uint16_t servHandle,
Wolfgang Betz 132:51056160fa4a 227 uint16_t charHandle,
Wolfgang Betz 132:51056160fa4a 228 uint8_t charValOffset,
Wolfgang Betz 132:51056160fa4a 229 uint8_t charValueLen,
Wolfgang Betz 132:51056160fa4a 230 const uint8_t *charValue);
Wolfgang Betz 132:51056160fa4a 231 /**
Wolfgang Betz 132:51056160fa4a 232 * @brief Delete the specified characteristic from the service.
Wolfgang Betz 132:51056160fa4a 233 * @param servHandle Handle of the service to which characteristic belongs
Wolfgang Betz 132:51056160fa4a 234 * @param charHandle Handle of the characteristic to be deleted
Wolfgang Betz 132:51056160fa4a 235 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 236 */
Wolfgang Betz 132:51056160fa4a 237 tBleStatus aci_gatt_del_char(uint16_t servHandle, uint16_t charHandle);
Wolfgang Betz 132:51056160fa4a 238
Wolfgang Betz 132:51056160fa4a 239 /**
Wolfgang Betz 132:51056160fa4a 240 * @brief Delete the specified service from the GATT server database.
Wolfgang Betz 132:51056160fa4a 241 * @param servHandle Handle of the service to be deleted
Wolfgang Betz 132:51056160fa4a 242 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 243 */
Wolfgang Betz 132:51056160fa4a 244 tBleStatus aci_gatt_del_service(uint16_t servHandle);
Wolfgang Betz 132:51056160fa4a 245
Wolfgang Betz 132:51056160fa4a 246 /**
Wolfgang Betz 132:51056160fa4a 247 * @brief Delete the Include definition from the service.
Wolfgang Betz 132:51056160fa4a 248 * @param servHandle Handle of the service to which Include definition belongs
Wolfgang Betz 132:51056160fa4a 249 * @param includeServHandle Handle of the Included definition to be deleted
Wolfgang Betz 132:51056160fa4a 250 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 251 */
Wolfgang Betz 132:51056160fa4a 252 tBleStatus aci_gatt_del_include_service(uint16_t servHandle, uint16_t includeServHandle);
Wolfgang Betz 132:51056160fa4a 253
Wolfgang Betz 132:51056160fa4a 254 /**
Wolfgang Betz 132:51056160fa4a 255 * @brief Perform an ATT MTU exchange procedure.
Wolfgang Betz 132:51056160fa4a 256 * @note When the ATT MTU exchange procedure is completed, a @ref EVT_BLUE_ATT_EXCHANGE_MTU_RESP
Wolfgang Betz 132:51056160fa4a 257 * event is generated. A @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is also generated
Wolfgang Betz 132:51056160fa4a 258 * to indicate the end of the procedure.
Wolfgang Betz 132:51056160fa4a 259 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 260 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 261 */
Wolfgang Betz 132:51056160fa4a 262 tBleStatus aci_gatt_exchange_configuration(uint16_t conn_handle);
Wolfgang Betz 132:51056160fa4a 263
Wolfgang Betz 132:51056160fa4a 264 /**
Wolfgang Betz 132:51056160fa4a 265 * @brief Send a @a Find @a Information @a Request.
Wolfgang Betz 132:51056160fa4a 266 * @note This command is used to obtain the mapping of attribute handles with their associated
Wolfgang Betz 132:51056160fa4a 267 * types. The responses of the procedure are given through the
Wolfgang Betz 132:51056160fa4a 268 * @ref EVT_BLUE_ATT_FIND_INFORMATION_RESP event. The end of the procedure is indicated by
Wolfgang Betz 132:51056160fa4a 269 * a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 270 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 271 * @param start_handle Starting handle of the range of attributes to be discovered on the server
Wolfgang Betz 132:51056160fa4a 272 * @param end_handle Ending handle of the range of attributes to be discovered on the server
Wolfgang Betz 132:51056160fa4a 273 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 274 */
Wolfgang Betz 132:51056160fa4a 275 tBleStatus aci_att_find_information_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle);
Wolfgang Betz 132:51056160fa4a 276
Wolfgang Betz 132:51056160fa4a 277 /**
Wolfgang Betz 132:51056160fa4a 278 * @brief Send a @a Find @a By @a Type @a Value @a Request
Wolfgang Betz 132:51056160fa4a 279 * @note The Find By Type Value Request is used to obtain the handles of attributes that
Wolfgang Betz 132:51056160fa4a 280 * have a given 16-bit UUID attribute type and a given attribute value.
Wolfgang Betz 132:51056160fa4a 281 * The responses of the procedure are given through the @ref EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP event.
Wolfgang Betz 132:51056160fa4a 282 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 283 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 284 * @param start_handle First requested handle number
Wolfgang Betz 132:51056160fa4a 285 * @param end_handle Last requested handle number
Wolfgang Betz 132:51056160fa4a 286 * @param uuid 2 octet UUID to find (little-endian)
Wolfgang Betz 132:51056160fa4a 287 * @param attr_val_len Length of attribute value (maximum value is ATT_MTU - 7).
Wolfgang Betz 132:51056160fa4a 288 * @param attr_val Attribute value to find
Wolfgang Betz 132:51056160fa4a 289 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 290 */
Wolfgang Betz 132:51056160fa4a 291 tBleStatus aci_att_find_by_type_value_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle,
Wolfgang Betz 132:51056160fa4a 292 uint8_t* uuid, uint8_t attr_val_len, uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 293
Wolfgang Betz 132:51056160fa4a 294 /**
Wolfgang Betz 132:51056160fa4a 295 * @brief Send a @a Read @a By @a Type @a Request
Wolfgang Betz 132:51056160fa4a 296 * @note The Read By Type Request is used to obtain the values of attributes where the attribute type
Wolfgang Betz 132:51056160fa4a 297 * is known but the handle is not known.
Wolfgang Betz 132:51056160fa4a 298 * The responses of the procedure are given through the @ref EVT_BLUE_ATT_READ_BY_TYPE_RESP event.
Wolfgang Betz 132:51056160fa4a 299 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 300 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 301 * @param start_handle First requested handle number
Wolfgang Betz 132:51056160fa4a 302 * @param end_handle Last requested handle number
Wolfgang Betz 132:51056160fa4a 303 * @param uuid_type @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 304 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 305 * @param uuid 2 or 16 octet UUID
Wolfgang Betz 132:51056160fa4a 306 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 307 */
Wolfgang Betz 132:51056160fa4a 308 tBleStatus aci_att_read_by_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle,
Wolfgang Betz 132:51056160fa4a 309 uint8_t uuid_type, uint8_t* uuid);
Wolfgang Betz 132:51056160fa4a 310
Wolfgang Betz 132:51056160fa4a 311 /**
Wolfgang Betz 132:51056160fa4a 312 * @brief Send a @a Read @a By @a Group @a Type @a Request
Wolfgang Betz 132:51056160fa4a 313 * @note The Read By Group Type Request is used to obtain the values of grouping attributes where the attribute
Wolfgang Betz 132:51056160fa4a 314 * type is known but the handle is not known. Grouping attributes are defined at GATT layer. The grouping
Wolfgang Betz 132:51056160fa4a 315 * attribute types are: «Primary Service», «Secondary Service» and «Characteristic».
Wolfgang Betz 132:51056160fa4a 316 * The responses of the procedure are given through the @ref EVT_BLUE_ATT_READ_BY_GROUP_TYPE_RESP event.
Wolfgang Betz 132:51056160fa4a 317 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE.
Wolfgang Betz 132:51056160fa4a 318 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 319 * @param start_handle First requested handle number
Wolfgang Betz 132:51056160fa4a 320 * @param end_handle Last requested handle number
Wolfgang Betz 132:51056160fa4a 321 * @param uuid_type @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 322 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 323 * @param uuid 2 or 16 octet UUID
Wolfgang Betz 132:51056160fa4a 324 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 325 */
Wolfgang Betz 132:51056160fa4a 326 tBleStatus aci_att_read_by_group_type_req(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle,
Wolfgang Betz 132:51056160fa4a 327 uint8_t uuid_type, uint8_t* uuid);
Wolfgang Betz 132:51056160fa4a 328
Wolfgang Betz 132:51056160fa4a 329 /**
Wolfgang Betz 132:51056160fa4a 330 * @brief Send a @a Prepare @a Write @a Request
Wolfgang Betz 132:51056160fa4a 331 * @note The Prepare Write Request is used to request the server to prepare to write the value of an attribute.
Wolfgang Betz 132:51056160fa4a 332 * The responses of the procedure are given through the @ref EVT_BLUE_ATT_PREPARE_WRITE_RESP event.
Wolfgang Betz 132:51056160fa4a 333 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE.
Wolfgang Betz 132:51056160fa4a 334 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 335 * @param attr_handle The handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 336 * @param value_offset The offset of the first octet to be written
Wolfgang Betz 132:51056160fa4a 337 * @param attr_val_len Length of attribute value (maximum value is ATT_MTU - 5).
Wolfgang Betz 132:51056160fa4a 338 * @param attr_val The value of the attribute to be written
Wolfgang Betz 132:51056160fa4a 339 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 340 */
Wolfgang Betz 132:51056160fa4a 341 tBleStatus aci_att_prepare_write_req(uint16_t conn_handle, uint16_t attr_handle, uint16_t value_offset,
Wolfgang Betz 132:51056160fa4a 342 uint8_t attr_val_len, uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 343
Wolfgang Betz 132:51056160fa4a 344 /**
Wolfgang Betz 132:51056160fa4a 345 * @brief Send an @a Execute @a Write @a Request
Wolfgang Betz 132:51056160fa4a 346 * @note The Execute Write Request is used to request the server to write or cancel the write of all the
Wolfgang Betz 132:51056160fa4a 347 * prepared values currently held in the prepare queue from this client.
Wolfgang Betz 132:51056160fa4a 348 * The result of the procedure is given through the @ref EVT_BLUE_ATT_EXEC_WRITE_RESP event.
Wolfgang Betz 132:51056160fa4a 349 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 350 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 351 * @param execute @arg 0x00 – Cancel all prepared writes
Wolfgang Betz 132:51056160fa4a 352 * @arg 0x01 – Immediately write all pending prepared values.
Wolfgang Betz 132:51056160fa4a 353 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 354 */
Wolfgang Betz 132:51056160fa4a 355 tBleStatus aci_att_execute_write_req(uint16_t conn_handle, uint8_t execute);
Wolfgang Betz 132:51056160fa4a 356
Wolfgang Betz 132:51056160fa4a 357 /**
Wolfgang Betz 132:51056160fa4a 358 * @brief This command will start the GATT client procedure to discover all primary services on the server.
Wolfgang Betz 132:51056160fa4a 359 * @note The responses of the procedure are given through the @ref EVT_BLUE_ATT_READ_BY_GROUP_TYPE_RESP event.
Wolfgang Betz 132:51056160fa4a 360 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 361 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 362 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 363 */
Wolfgang Betz 132:51056160fa4a 364 tBleStatus aci_gatt_disc_all_prim_services(uint16_t conn_handle);
Wolfgang Betz 132:51056160fa4a 365
Wolfgang Betz 132:51056160fa4a 366 /**
Wolfgang Betz 132:51056160fa4a 367 * @brief Start the procedure to discover the primary services of the specified UUID on the server.
Wolfgang Betz 132:51056160fa4a 368 * @note The responses of the procedure are given through the @ref EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP event.
Wolfgang Betz 132:51056160fa4a 369 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 370 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 371 * @param uuid_type @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 372 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 373 * @param uuid 2 or 16 octet UUID
Wolfgang Betz 132:51056160fa4a 374 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 375 */
Wolfgang Betz 132:51056160fa4a 376 tBleStatus aci_gatt_disc_prim_service_by_uuid(uint16_t conn_handle, uint8_t uuid_type, uint8_t* uuid);
Wolfgang Betz 132:51056160fa4a 377
Wolfgang Betz 132:51056160fa4a 378 /**
Wolfgang Betz 132:51056160fa4a 379 * @brief Start the procedure to find all included services.
Wolfgang Betz 132:51056160fa4a 380 * @note The responses of the procedure are given through the @ref EVT_BLUE_ATT_READ_BY_TYPE_RESP event.
Wolfgang Betz 132:51056160fa4a 381 * The end of the procedure is indicated by a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event.
Wolfgang Betz 132:51056160fa4a 382 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 383 * @param start_handle Start handle of the service
Wolfgang Betz 132:51056160fa4a 384 * @param end_handle End handle of the service
Wolfgang Betz 132:51056160fa4a 385 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 386 */
Wolfgang Betz 132:51056160fa4a 387 tBleStatus aci_gatt_find_included_services(uint16_t conn_handle, uint16_t start_handle,
Wolfgang Betz 132:51056160fa4a 388 uint16_t end_handle);
Wolfgang Betz 132:51056160fa4a 389
Wolfgang Betz 132:51056160fa4a 390 /**
Wolfgang Betz 132:51056160fa4a 391 * @brief Start the procedure to discover all the characteristics of a given service.
Wolfgang Betz 132:51056160fa4a 392 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 393 * Before procedure completion the response packets are given through @ref EVT_BLUE_ATT_READ_BY_TYPE_RESP event.
Wolfgang Betz 132:51056160fa4a 394 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 395 * @param start_attr_handle Start attribute handle of the service
Wolfgang Betz 132:51056160fa4a 396 * @param end_attr_handle End attribute handle of the service
Wolfgang Betz 132:51056160fa4a 397 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 398 */
Wolfgang Betz 132:51056160fa4a 399 tBleStatus aci_gatt_disc_all_charac_of_serv(uint16_t conn_handle, uint16_t start_attr_handle,
Wolfgang Betz 132:51056160fa4a 400 uint16_t end_attr_handle);
Wolfgang Betz 132:51056160fa4a 401
Wolfgang Betz 132:51056160fa4a 402 /**
Wolfgang Betz 132:51056160fa4a 403 * @brief Start the procedure to discover all the characteristics specified by a UUID.
Wolfgang Betz 132:51056160fa4a 404 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 405 * Before procedure completion the response packets are given through
Wolfgang Betz 132:51056160fa4a 406 * @ref EVT_BLUE_GATT_DISC_READ_CHAR_BY_UUID_RESP event.
Wolfgang Betz 132:51056160fa4a 407 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 408 * @param start_handle Start attribute handle of the service
Wolfgang Betz 132:51056160fa4a 409 * @param end_handle End attribute handle of the service
Wolfgang Betz 132:51056160fa4a 410 * @param uuid_type @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 411 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 412 * @param uuid 2 or 16 octet UUID
Wolfgang Betz 132:51056160fa4a 413 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 414 */
Wolfgang Betz 132:51056160fa4a 415 tBleStatus aci_gatt_disc_charac_by_uuid(uint16_t conn_handle, uint16_t start_handle,
Wolfgang Betz 132:51056160fa4a 416 uint16_t end_handle, uint8_t uuid_type, const uint8_t* uuid);
Wolfgang Betz 132:51056160fa4a 417
Wolfgang Betz 132:51056160fa4a 418 /**
Wolfgang Betz 132:51056160fa4a 419 * @brief Start the procedure to discover all characteristic descriptors on the server.
Wolfgang Betz 132:51056160fa4a 420 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 421 * Before procedure completion the response packets are given through @ref EVT_BLUE_ATT_FIND_INFORMATION_RESP event.
Wolfgang Betz 132:51056160fa4a 422 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 423 * @param char_val_handle Starting handle of the characteristic
Wolfgang Betz 132:51056160fa4a 424 * @param char_end_handle End handle of the characteristic
Wolfgang Betz 132:51056160fa4a 425 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 426 */
Wolfgang Betz 132:51056160fa4a 427 tBleStatus aci_gatt_disc_all_charac_descriptors(uint16_t conn_handle, uint16_t char_val_handle,
Wolfgang Betz 132:51056160fa4a 428 uint16_t char_end_handle);
Wolfgang Betz 132:51056160fa4a 429
Wolfgang Betz 132:51056160fa4a 430 /**
Wolfgang Betz 132:51056160fa4a 431 * @brief Start the procedure to read the attribute value.
Wolfgang Betz 132:51056160fa4a 432 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 433 * Before procedure completion the response packet is given through @ref EVT_BLUE_ATT_READ_RESP event.
Wolfgang Betz 132:51056160fa4a 434 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 435 * @param attr_handle Handle of the characteristic to be read
Wolfgang Betz 132:51056160fa4a 436 * @return Value indicating success or error code.\n
Wolfgang Betz 132:51056160fa4a 437 * It can be @ref BLE_STATUS_NOT_ALLOWED in the following cases:\n
Wolfgang Betz 132:51056160fa4a 438 * - If the exchange has already taken place\n
Wolfgang Betz 132:51056160fa4a 439 * - If GATT is expecting response for previous request\n
Wolfgang Betz 132:51056160fa4a 440 * - Already a request is in the queue to be sent\n
Wolfgang Betz 132:51056160fa4a 441 * - Channel not open\n
Wolfgang Betz 132:51056160fa4a 442 * - Already one GATT procedure is started
Wolfgang Betz 132:51056160fa4a 443 */
Wolfgang Betz 132:51056160fa4a 444 tBleStatus aci_gatt_read_charac_val(uint16_t conn_handle, uint16_t attr_handle);
Wolfgang Betz 132:51056160fa4a 445
Wolfgang Betz 132:51056160fa4a 446 /**
Wolfgang Betz 132:51056160fa4a 447 * @brief Start the procedure to read all the characteristics specified by the UUID.
Wolfgang Betz 132:51056160fa4a 448 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 449 * Before procedure completion the response packets are given through
Wolfgang Betz 132:51056160fa4a 450 * @ref EVT_BLUE_GATT_DISC_READ_CHAR_BY_UUID_RESP event.
Wolfgang Betz 132:51056160fa4a 451 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 452 * @param start_handle Starting handle of the range to be searched
Wolfgang Betz 132:51056160fa4a 453 * @param end_handle End handle of the range to be searched
Wolfgang Betz 132:51056160fa4a 454 * @param uuid_type @arg @ref UUID_TYPE_16
Wolfgang Betz 132:51056160fa4a 455 * @arg @ref UUID_TYPE_128
Wolfgang Betz 132:51056160fa4a 456 * @param uuid 2 or 16 octet UUID
Wolfgang Betz 132:51056160fa4a 457 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 458 */
Wolfgang Betz 132:51056160fa4a 459 tBleStatus aci_gatt_read_using_charac_uuid(uint16_t conn_handle, uint16_t start_handle, uint16_t end_handle,
Wolfgang Betz 132:51056160fa4a 460 uint8_t uuid_type, uint8_t* uuid);
Wolfgang Betz 132:51056160fa4a 461
Wolfgang Betz 132:51056160fa4a 462 /**
Wolfgang Betz 132:51056160fa4a 463 * @brief Start the procedure to read a long characteristic value.
Wolfgang Betz 132:51056160fa4a 464 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 465 * Before procedure completion the response packets are given through @ref EVT_BLUE_ATT_READ_BLOB_RESP event.
Wolfgang Betz 132:51056160fa4a 466 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 467 * @param attr_handle Handle of the characteristic to be read
Wolfgang Betz 132:51056160fa4a 468 * @param val_offset Offset from which the value needs to be read
Wolfgang Betz 132:51056160fa4a 469 * @return Value indicating success or error code.\n
Wolfgang Betz 132:51056160fa4a 470 * It can be @ref BLE_STATUS_NOT_ALLOWED in the following cases:\n
Wolfgang Betz 132:51056160fa4a 471 * - If the exchange has already taken place\n
Wolfgang Betz 132:51056160fa4a 472 * - If GATT is expecting response for previous request\n
Wolfgang Betz 132:51056160fa4a 473 * - Already a request is in the queue to be sent\n
Wolfgang Betz 132:51056160fa4a 474 * - Channel not open\n
Wolfgang Betz 132:51056160fa4a 475 * - Already one GATT procedure is started
Wolfgang Betz 132:51056160fa4a 476 */
Wolfgang Betz 132:51056160fa4a 477 tBleStatus aci_gatt_read_long_charac_val(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 478 uint16_t val_offset);
Wolfgang Betz 132:51056160fa4a 479
Wolfgang Betz 132:51056160fa4a 480 /**
Wolfgang Betz 132:51056160fa4a 481 * @brief Start a procedure to read multiple characteristic values from a server.
Wolfgang Betz 132:51056160fa4a 482 * @note This sub-procedure is used to read multiple Characteristic Values from a server when the
Wolfgang Betz 132:51056160fa4a 483 * client knows the Characteristic Value Handles.
Wolfgang Betz 132:51056160fa4a 484 * When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 485 * Before procedure completion the response packets are given through
Wolfgang Betz 132:51056160fa4a 486 * @ref EVT_BLUE_ATT_READ_MULTIPLE_RESP event.
Wolfgang Betz 132:51056160fa4a 487 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 488 * @param num_handles The number of handles for which the value has to be read
Wolfgang Betz 132:51056160fa4a 489 * @param set_of_handles The handles for which the attribute value has to be read
Wolfgang Betz 132:51056160fa4a 490 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 491 */
Wolfgang Betz 132:51056160fa4a 492 tBleStatus aci_gatt_read_multiple_charac_val(uint16_t conn_handle, uint8_t num_handles,
Wolfgang Betz 132:51056160fa4a 493 uint8_t* set_of_handles);
Wolfgang Betz 132:51056160fa4a 494
Wolfgang Betz 132:51056160fa4a 495 /**
Wolfgang Betz 132:51056160fa4a 496 * @brief Start the procedure to write a characteristic value.
Wolfgang Betz 132:51056160fa4a 497 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 498 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 499 * @param attr_handle Handle of the characteristic to be written
Wolfgang Betz 132:51056160fa4a 500 * @param value_len Length of the value to be written
Wolfgang Betz 132:51056160fa4a 501 * @param[in] attr_value Value to be written
Wolfgang Betz 132:51056160fa4a 502 * @return Value indicating success or error code.\n
Wolfgang Betz 132:51056160fa4a 503 * It can be @ref BLE_STATUS_NOT_ALLOWED in the following cases:\n
Wolfgang Betz 132:51056160fa4a 504 * - If the exchange has already taken place\n
Wolfgang Betz 132:51056160fa4a 505 * - If GATT is expecting response for previous request\n
Wolfgang Betz 132:51056160fa4a 506 * - Already a request is in the queue to be sent\n
Wolfgang Betz 132:51056160fa4a 507 * - Channel not open\n
Wolfgang Betz 132:51056160fa4a 508 * - Already one GATT procedure is started
Wolfgang Betz 132:51056160fa4a 509 */
Wolfgang Betz 132:51056160fa4a 510 tBleStatus aci_gatt_write_charac_value(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 511 uint8_t value_len, uint8_t *attr_value);
Wolfgang Betz 132:51056160fa4a 512
Wolfgang Betz 132:51056160fa4a 513 /**
Wolfgang Betz 132:51056160fa4a 514 * @brief Start the procedure to write a long characteristic value.
Wolfgang Betz 132:51056160fa4a 515 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 516 * During the procedure, @ref EVT_BLUE_ATT_PREPARE_WRITE_RESP and @ref EVT_BLUE_ATT_EXEC_WRITE_RESP
Wolfgang Betz 132:51056160fa4a 517 * events are raised.
Wolfgang Betz 132:51056160fa4a 518 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 519 * @param attr_handle Handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 520 * @param val_offset Offset at which the attribute has to be written
Wolfgang Betz 132:51056160fa4a 521 * @param val_len Length of the value to be written
Wolfgang Betz 132:51056160fa4a 522 * @param attr_val Value to be written
Wolfgang Betz 132:51056160fa4a 523 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 524 */
Wolfgang Betz 132:51056160fa4a 525 tBleStatus aci_gatt_write_long_charac_val(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 526 uint16_t val_offset, uint8_t val_len, const uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 527
Wolfgang Betz 132:51056160fa4a 528 /**
Wolfgang Betz 132:51056160fa4a 529 * @brief Start the procedure to write a characteristic reliably.
Wolfgang Betz 132:51056160fa4a 530 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 531 * During the procedure, @ref EVT_BLUE_ATT_PREPARE_WRITE_RESP and @ref EVT_BLUE_ATT_EXEC_WRITE_RESP
Wolfgang Betz 132:51056160fa4a 532 * events are raised.
Wolfgang Betz 132:51056160fa4a 533 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 534 * @param attr_handle Handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 535 * @param val_offset Offset at which the attribute has to be written
Wolfgang Betz 132:51056160fa4a 536 * @param val_len Length of the value to be written
Wolfgang Betz 132:51056160fa4a 537 * @param attr_val Value to be written
Wolfgang Betz 132:51056160fa4a 538 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 539 */
Wolfgang Betz 132:51056160fa4a 540 tBleStatus aci_gatt_write_charac_reliable(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 541 uint16_t val_offset, uint8_t val_len, uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 542
Wolfgang Betz 132:51056160fa4a 543 /**
Wolfgang Betz 132:51056160fa4a 544 * @brief Start the procedure to write a long characteristic descriptor.
Wolfgang Betz 132:51056160fa4a 545 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 546 * During the procedure, @ref EVT_BLUE_ATT_PREPARE_WRITE_RESP and @ref EVT_BLUE_ATT_EXEC_WRITE_RESP
Wolfgang Betz 132:51056160fa4a 547 * events are raised.
Wolfgang Betz 132:51056160fa4a 548 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 549 * @param attr_handle Handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 550 * @param val_offset Offset at which the attribute has to be written
Wolfgang Betz 132:51056160fa4a 551 * @param val_len Length of the value to be written
Wolfgang Betz 132:51056160fa4a 552 * @param attr_val Value to be written
Wolfgang Betz 132:51056160fa4a 553 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 554 */
Wolfgang Betz 132:51056160fa4a 555 tBleStatus aci_gatt_write_long_charac_desc(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 556 uint16_t val_offset, uint8_t val_len, uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 557
Wolfgang Betz 132:51056160fa4a 558 /**
Wolfgang Betz 132:51056160fa4a 559 * @brief Start the procedure to read a long characteristic value.
Wolfgang Betz 132:51056160fa4a 560 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 561 * Before procedure completion the response packets are given through @ref EVT_BLUE_ATT_READ_BLOB_RESP
Wolfgang Betz 132:51056160fa4a 562 * event.
Wolfgang Betz 132:51056160fa4a 563 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 564 * @param attr_handle Handle of the characteristic descriptor
Wolfgang Betz 132:51056160fa4a 565 * @param val_offset Offset from which the value needs to be read
Wolfgang Betz 132:51056160fa4a 566 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 567 */
Wolfgang Betz 132:51056160fa4a 568 tBleStatus aci_gatt_read_long_charac_desc(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 569 uint16_t val_offset);
Wolfgang Betz 132:51056160fa4a 570
Wolfgang Betz 132:51056160fa4a 571 /**
Wolfgang Betz 132:51056160fa4a 572 * @brief Start the procedure to write a characteristic descriptor.
Wolfgang Betz 132:51056160fa4a 573 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 574 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 575 * @param attr_handle Handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 576 * @param value_len Length of the value to be written
Wolfgang Betz 132:51056160fa4a 577 * @param[in] attr_value Value to be written
Wolfgang Betz 132:51056160fa4a 578 * @return Value indicating success or error code.\n
Wolfgang Betz 132:51056160fa4a 579 * It can be @ref BLE_STATUS_NOT_ALLOWED in the following cases:\n
Wolfgang Betz 132:51056160fa4a 580 * - If the exchange has already taken place\n
Wolfgang Betz 132:51056160fa4a 581 * - If GATT is expecting response for previous request\n
Wolfgang Betz 132:51056160fa4a 582 * - Already a request is in the queue to be sent\n
Wolfgang Betz 132:51056160fa4a 583 * - Channel not open\n
Wolfgang Betz 132:51056160fa4a 584 * - Already one GATT procedure is started
Wolfgang Betz 132:51056160fa4a 585 */
Wolfgang Betz 132:51056160fa4a 586 tBleStatus aci_gatt_write_charac_descriptor(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 587 uint8_t value_len, uint8_t *attr_value);
Wolfgang Betz 132:51056160fa4a 588
Wolfgang Betz 132:51056160fa4a 589 /**
Wolfgang Betz 132:51056160fa4a 590 * @brief Start the procedure to read the descriptor specified.
Wolfgang Betz 132:51056160fa4a 591 * @note When the procedure is completed, a @ref EVT_BLUE_GATT_PROCEDURE_COMPLETE event is generated.
Wolfgang Betz 132:51056160fa4a 592 * Before procedure completion the response packet is given through @ref EVT_BLUE_ATT_READ_RESP event.
Wolfgang Betz 132:51056160fa4a 593 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 594 * @param attr_handle Handle of the descriptor to be read
Wolfgang Betz 132:51056160fa4a 595 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 596 */
Wolfgang Betz 132:51056160fa4a 597 tBleStatus aci_gatt_read_charac_desc(uint16_t conn_handle, uint16_t attr_handle);
Wolfgang Betz 132:51056160fa4a 598
Wolfgang Betz 132:51056160fa4a 599 /**
Wolfgang Betz 132:51056160fa4a 600 * @brief Start the procedure to write a characteristic value without waiting for any response from the server.
Wolfgang Betz 132:51056160fa4a 601 * @note No events are generated after this command is executed.
Wolfgang Betz 132:51056160fa4a 602 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 603 * @param attr_handle Handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 604 * @param val_len Length of the value to be written (up to ATT_MTU - 3)
Wolfgang Betz 132:51056160fa4a 605 * @param[in] attr_val Value to be written
Wolfgang Betz 132:51056160fa4a 606 * @return Value indicating success or error code.\n
Wolfgang Betz 132:51056160fa4a 607 * It can be @ref BLE_STATUS_NOT_ALLOWED in the following cases:\n
Wolfgang Betz 132:51056160fa4a 608 * - If the exchange has already taken place\n
Wolfgang Betz 132:51056160fa4a 609 * - If GATT is expecting response for previous request\n
Wolfgang Betz 132:51056160fa4a 610 * - Already a request is in the queue to be sent\n
Wolfgang Betz 132:51056160fa4a 611 * - Channel not open\n
Wolfgang Betz 132:51056160fa4a 612 * - Already one GATT procedure is started
Wolfgang Betz 132:51056160fa4a 613 */
Wolfgang Betz 132:51056160fa4a 614 tBleStatus aci_gatt_write_without_response(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 615 uint8_t val_len, const uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 616
Wolfgang Betz 132:51056160fa4a 617 /**
Wolfgang Betz 132:51056160fa4a 618 * @brief Start a signed write without response from the server.
Wolfgang Betz 132:51056160fa4a 619 * @note The procedure i used to write a characteristic value with an authentication signature without waiting
Wolfgang Betz 132:51056160fa4a 620 * for any response from the server. It cannot be used when the link is encrypted.
Wolfgang Betz 132:51056160fa4a 621 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 622 * @param attr_handle Handle of the attribute to be written
Wolfgang Betz 132:51056160fa4a 623 * @param val_len Length of the value to be written (up to ATT_MTU - 13).
Wolfgang Betz 132:51056160fa4a 624 * @param attr_val Value to be written
Wolfgang Betz 132:51056160fa4a 625 * @return Value indicating success or error code
Wolfgang Betz 132:51056160fa4a 626 */
Wolfgang Betz 132:51056160fa4a 627 tBleStatus aci_gatt_signed_write_without_resp(uint16_t conn_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 628 uint8_t val_len, uint8_t* attr_val);
Wolfgang Betz 132:51056160fa4a 629
Wolfgang Betz 132:51056160fa4a 630 /**
Wolfgang Betz 132:51056160fa4a 631 * @brief Confirm an indication
Wolfgang Betz 132:51056160fa4a 632 * @note This command has to be sent when the application receives the event @ref EVT_BLUE_GATT_INDICATION.
Wolfgang Betz 132:51056160fa4a 633 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 634 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 635 */
Wolfgang Betz 132:51056160fa4a 636 tBleStatus aci_gatt_confirm_indication(uint16_t conn_handle);
Wolfgang Betz 132:51056160fa4a 637
Wolfgang Betz 132:51056160fa4a 638 /**
Wolfgang Betz 132:51056160fa4a 639 * @brief Allow or reject a write request from a client.
Wolfgang Betz 132:51056160fa4a 640 * @note This command has to be sent by the application when it receives the @ref EVT_BLUE_GATT_WRITE_PERMIT_REQ.
Wolfgang Betz 132:51056160fa4a 641 * If the write is allowed, then the status and error code has to be set to 0. If the write is not allowed,
Wolfgang Betz 132:51056160fa4a 642 * then the status has to be set to 1 and the error code has to be set to the error code that has to be
Wolfgang Betz 132:51056160fa4a 643 * passed to the client.
Wolfgang Betz 132:51056160fa4a 644 * @param conn_handle Connection handle for which the command is given
Wolfgang Betz 132:51056160fa4a 645 * @param attr_handle Handle of the attribute that was passed in the event @ref EVT_BLUE_GATT_WRITE_PERMIT_REQ.
Wolfgang Betz 132:51056160fa4a 646 * @param write_status 0x00: The value can be written to the attribute specified by attr_handle\n
Wolfgang Betz 132:51056160fa4a 647 * 0x01: The value cannot be written to the attribute specified by the attr_handle.
Wolfgang Betz 132:51056160fa4a 648 * @param err_code The error code that has to be passed to the client in case the write has to be rejected.
Wolfgang Betz 132:51056160fa4a 649 * @param att_val_len Length of the value to be written as passed in the event @ref EVT_BLUE_GATT_WRITE_PERMIT_REQ.
Wolfgang Betz 132:51056160fa4a 650 * @param att_val Value as passed in the event @ref EVT_BLUE_GATT_WRITE_PERMIT_REQ.
Wolfgang Betz 132:51056160fa4a 651 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 652 */
Wolfgang Betz 132:51056160fa4a 653 tBleStatus aci_gatt_write_response(uint16_t conn_handle,
Wolfgang Betz 132:51056160fa4a 654 uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 655 uint8_t write_status,
Wolfgang Betz 132:51056160fa4a 656 uint8_t err_code,
Wolfgang Betz 132:51056160fa4a 657 uint8_t att_val_len,
Wolfgang Betz 132:51056160fa4a 658 uint8_t *att_val);
Wolfgang Betz 132:51056160fa4a 659
Wolfgang Betz 132:51056160fa4a 660 /**
Wolfgang Betz 132:51056160fa4a 661 * @brief Allow the GATT server to send a response to a read request from a client.
Wolfgang Betz 132:51056160fa4a 662 * @note The application has to send this command when it receives the @ref EVT_BLUE_GATT_READ_PERMIT_REQ
Wolfgang Betz 132:51056160fa4a 663 * or @ref EVT_BLUE_GATT_READ_MULTI_PERMIT_REQ. This command indicates to the stack that the response
Wolfgang Betz 132:51056160fa4a 664 * can be sent to the client. So if the application wishes to update any of the attributes before
Wolfgang Betz 132:51056160fa4a 665 * they are read by the client, it has to update the characteristic values using the aci_gatt_update_char_value
Wolfgang Betz 132:51056160fa4a 666 * and then give this command. The application should perform the required operations within 30 seconds,
Wolfgang Betz 132:51056160fa4a 667 * otherwise the GATT procedure will go to timeout.
Wolfgang Betz 132:51056160fa4a 668 * @param conn_handle Connection handle for which the command is given.
Wolfgang Betz 132:51056160fa4a 669 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 670 */
Wolfgang Betz 132:51056160fa4a 671 tBleStatus aci_gatt_allow_read(uint16_t conn_handle);
Wolfgang Betz 132:51056160fa4a 672
Wolfgang Betz 132:51056160fa4a 673 /**
Wolfgang Betz 132:51056160fa4a 674 * @brief Set the security permission for the attribute handle specified.
Wolfgang Betz 132:51056160fa4a 675 * @note Currently the setting of security permission is allowed only for client configuration descriptor.
Wolfgang Betz 132:51056160fa4a 676 * @param service_handle Handle of the service which contains the attribute whose security
Wolfgang Betz 132:51056160fa4a 677 * permission has to be modified.
Wolfgang Betz 132:51056160fa4a 678 * @param attr_handle Handle of the attribute whose security permission has to be modified.
Wolfgang Betz 132:51056160fa4a 679 * @param security_permission Security permissions for the descriptor. See @ref Security_permissions "Security permissions".
Wolfgang Betz 132:51056160fa4a 680 * @arg ATTR_PERMISSION_NONE
Wolfgang Betz 132:51056160fa4a 681 * @arg ATTR_PERMISSION_AUTHEN_READ
Wolfgang Betz 132:51056160fa4a 682 * @arg ATTR_PERMISSION_AUTHOR_READ
Wolfgang Betz 132:51056160fa4a 683 * @arg ATTR_PERMISSION_ENCRY_READ
Wolfgang Betz 132:51056160fa4a 684 * @arg ATTR_PERMISSION_AUTHEN_WRITE
Wolfgang Betz 132:51056160fa4a 685 * @arg ATTR_PERMISSION_AUTHOR_WRITE
Wolfgang Betz 132:51056160fa4a 686 * @arg ATTR_PERMISSION_ENCRY_WRITE
Wolfgang Betz 132:51056160fa4a 687 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 688 */
Wolfgang Betz 132:51056160fa4a 689 tBleStatus aci_gatt_set_security_permission(uint16_t service_handle, uint16_t attr_handle,
Wolfgang Betz 132:51056160fa4a 690 uint8_t security_permission);
Wolfgang Betz 132:51056160fa4a 691
Wolfgang Betz 132:51056160fa4a 692 /**
Wolfgang Betz 132:51056160fa4a 693 * @brief This command sets the value of the descriptor specified by charDescHandle.
Wolfgang Betz 132:51056160fa4a 694 * @param servHandle Handle of the service which contains the descriptor.
Wolfgang Betz 132:51056160fa4a 695 * @param charHandle Handle of the characteristic which contains the descriptor.
Wolfgang Betz 132:51056160fa4a 696 * @param charDescHandle Handle of the descriptor whose value has to be set.
Wolfgang Betz 132:51056160fa4a 697 * @param charDescValOffset Offset from which the descriptor value has to be updated.
Wolfgang Betz 132:51056160fa4a 698 * @param charDescValueLen Length of the descriptor value
Wolfgang Betz 132:51056160fa4a 699 * @param[in] charDescValue descriptor value
Wolfgang Betz 132:51056160fa4a 700 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 701 */
Wolfgang Betz 132:51056160fa4a 702 tBleStatus aci_gatt_set_desc_value(uint16_t servHandle,
Wolfgang Betz 132:51056160fa4a 703 uint16_t charHandle,
Wolfgang Betz 132:51056160fa4a 704 uint16_t charDescHandle,
Wolfgang Betz 132:51056160fa4a 705 uint16_t charDescValOffset,
Wolfgang Betz 132:51056160fa4a 706 uint8_t charDescValueLen,
Wolfgang Betz 132:51056160fa4a 707 const uint8_t *charDescValue);
Wolfgang Betz 132:51056160fa4a 708
Wolfgang Betz 132:51056160fa4a 709 /**
Wolfgang Betz 132:51056160fa4a 710 * @brief Reads the value of the attribute handle specified from the local GATT database.
Wolfgang Betz 132:51056160fa4a 711 * @param attr_handle Handle of the attribute to read
Wolfgang Betz 132:51056160fa4a 712 * @param data_len Length of the data buffer.
Wolfgang Betz 132:51056160fa4a 713 * @param[in] data_len_out_p Length of the read attribute.
Wolfgang Betz 132:51056160fa4a 714 * @param[in] data Pointer to the buffer that will contain the read value.
Wolfgang Betz 132:51056160fa4a 715 * The buffer will be filled with the attribute value.
Wolfgang Betz 132:51056160fa4a 716 * The length will be the minimum between the provided data_len and the actual length of the
Wolfgang Betz 132:51056160fa4a 717 * attribute (in data_len_out_p).
Wolfgang Betz 132:51056160fa4a 718 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 719 */
Wolfgang Betz 132:51056160fa4a 720 tBleStatus aci_gatt_read_handle_value(uint16_t attr_handle, uint16_t data_len, uint16_t *data_len_out_p, uint8_t *data);
Wolfgang Betz 132:51056160fa4a 721
Wolfgang Betz 132:51056160fa4a 722 /**
Wolfgang Betz 132:51056160fa4a 723 * @brief Reads the value of the attribute handle specified from the local GATT database, starting from a given offset.
Wolfgang Betz 132:51056160fa4a 724 * @param attr_handle Handle of the attribute to read
Wolfgang Betz 132:51056160fa4a 725 * @param offset Offset from which the value needs to be read
Wolfgang Betz 132:51056160fa4a 726 * @param data_len Length of the data buffer.
Wolfgang Betz 132:51056160fa4a 727 * @param[in] data_len_out_p Length of the read attribute.
Wolfgang Betz 132:51056160fa4a 728 * @param[in] data Pointer to the buffer that will contain the read value.
Wolfgang Betz 132:51056160fa4a 729 * The buffer will be filled with the attribute value.
Wolfgang Betz 132:51056160fa4a 730 * The length will be the minimum between the provided data_len and the actual length of the
Wolfgang Betz 132:51056160fa4a 731 * attribute (in data_len_out_p).
Wolfgang Betz 132:51056160fa4a 732 * @return Value indicating success or error code.
Wolfgang Betz 132:51056160fa4a 733 */
Wolfgang Betz 132:51056160fa4a 734 tBleStatus aci_gatt_read_handle_value_offset_IDB05A1(uint16_t attr_handle, uint8_t offset, uint16_t data_len, uint16_t *data_len_out_p, uint8_t *data);
Wolfgang Betz 132:51056160fa4a 735
Wolfgang Betz 132:51056160fa4a 736 /**
Wolfgang Betz 132:51056160fa4a 737 * @}
Wolfgang Betz 132:51056160fa4a 738 */
Wolfgang Betz 132:51056160fa4a 739
Wolfgang Betz 132:51056160fa4a 740
Wolfgang Betz 132:51056160fa4a 741 /**
Wolfgang Betz 132:51056160fa4a 742 * @defgroup GATT_Events GATT events
Wolfgang Betz 132:51056160fa4a 743 * The structures are the data field of @ref evt_blue_aci.
Wolfgang Betz 132:51056160fa4a 744 * @{
Wolfgang Betz 132:51056160fa4a 745 */
Wolfgang Betz 132:51056160fa4a 746
Wolfgang Betz 132:51056160fa4a 747 /**
Wolfgang Betz 132:51056160fa4a 748 * This event is raised to the application by the GATT server when a client modifies any attribute on the server,
Wolfgang Betz 132:51056160fa4a 749 * if event is enabled (see @ref Gatt_Event_Mask "Gatt Event Mask").
Wolfgang Betz 132:51056160fa4a 750 * See @ref _evt_gatt_attr_modified_IDB04A1 or @ref _evt_gatt_attr_modified__IDB05A1.
Wolfgang Betz 132:51056160fa4a 751 */
Wolfgang Betz 132:51056160fa4a 752 #define EVT_BLUE_GATT_ATTRIBUTE_MODIFIED (0x0C01)
Wolfgang Betz 132:51056160fa4a 753 typedef __packed struct _evt_gatt_attr_modified_IDB05A1{
Wolfgang Betz 132:51056160fa4a 754 uint16_t conn_handle; /**< The connection handle which modified the attribute. */
Wolfgang Betz 132:51056160fa4a 755 uint16_t attr_handle; /**< Handle of the attribute that was modified. */
Wolfgang Betz 132:51056160fa4a 756 uint8_t data_length; /**< The length of the data */
Wolfgang Betz 132:51056160fa4a 757 uint16_t offset; /**< Offset from which the write has been performed by the peer device */
Wolfgang Betz 132:51056160fa4a 758 uint8_t att_data[VARIABLE_SIZE]; /**< The new value (length is data_length) */
Wolfgang Betz 132:51056160fa4a 759 } PACKED evt_gatt_attr_modified_IDB05A1;
Wolfgang Betz 132:51056160fa4a 760
Wolfgang Betz 132:51056160fa4a 761 typedef __packed struct _evt_gatt_attr_modified_IDB04A1{
Wolfgang Betz 132:51056160fa4a 762 uint16_t conn_handle; /**< The connection handle which modified the attribute. */
Wolfgang Betz 132:51056160fa4a 763 uint16_t attr_handle; /**< Handle of the attribute that was modified. */
Wolfgang Betz 132:51056160fa4a 764 uint8_t data_length; /**< The length of the data */
Wolfgang Betz 132:51056160fa4a 765 uint8_t att_data[VARIABLE_SIZE]; /**< The new value (length is data_length) */
Wolfgang Betz 132:51056160fa4a 766 } PACKED evt_gatt_attr_modified_IDB04A1;
Wolfgang Betz 132:51056160fa4a 767
Wolfgang Betz 132:51056160fa4a 768 /**
Wolfgang Betz 132:51056160fa4a 769 * This event is generated by the client/server to the application on a GATT timeout (30 seconds).
Wolfgang Betz 132:51056160fa4a 770 * See @ref _evt_gatt_procedure_timeout.
Wolfgang Betz 132:51056160fa4a 771 */
Wolfgang Betz 132:51056160fa4a 772 #define EVT_BLUE_GATT_PROCEDURE_TIMEOUT (0x0C02)
Wolfgang Betz 132:51056160fa4a 773 typedef __packed struct _evt_gatt_procedure_timeout{
Wolfgang Betz 132:51056160fa4a 774 uint16_t conn_handle; /**< The connection handle on which the GATT procedure has timed out */
Wolfgang Betz 132:51056160fa4a 775 } PACKED evt_gatt_procedure_timeout;
Wolfgang Betz 132:51056160fa4a 776
Wolfgang Betz 132:51056160fa4a 777 /**
Wolfgang Betz 132:51056160fa4a 778 * This event is generated in response to an Exchange MTU request. See aci_gatt_exchange_configuration().
Wolfgang Betz 132:51056160fa4a 779 * See @ref _evt_att_exchange_mtu_resp.
Wolfgang Betz 132:51056160fa4a 780 */
Wolfgang Betz 132:51056160fa4a 781 #define EVT_BLUE_ATT_EXCHANGE_MTU_RESP (0x0C03)
Wolfgang Betz 132:51056160fa4a 782 typedef __packed struct _evt_att_exchange_mtu_resp{
Wolfgang Betz 132:51056160fa4a 783 uint16_t conn_handle; /**< The connection handle related to the response */
Wolfgang Betz 132:51056160fa4a 784 uint8_t event_data_length; /**< Length of following data (always 1). */
Wolfgang Betz 132:51056160fa4a 785 uint16_t server_rx_mtu; /**< Attribute server receive MTU size */
Wolfgang Betz 132:51056160fa4a 786 } PACKED evt_att_exchange_mtu_resp;
Wolfgang Betz 132:51056160fa4a 787
Wolfgang Betz 132:51056160fa4a 788 /**
Wolfgang Betz 132:51056160fa4a 789 * This event is generated in response to a @a Find @a Information @a Request. See aci_att_find_information_req() and
Wolfgang Betz 132:51056160fa4a 790 * Find Information Response in Bluetooth Core v4.0 spec. See @ref _evt_att_find_information_resp.
Wolfgang Betz 132:51056160fa4a 791 */
Wolfgang Betz 132:51056160fa4a 792 #define EVT_BLUE_ATT_FIND_INFORMATION_RESP (0x0C04)
Wolfgang Betz 132:51056160fa4a 793 typedef __packed struct _evt_att_find_information_resp{
Wolfgang Betz 132:51056160fa4a 794 uint16_t conn_handle; /**< The connection handle related to the response */
Wolfgang Betz 132:51056160fa4a 795 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 796 uint8_t format; /**< The format of the handle_uuid_pair. @arg 1: 16-bit UUIDs @arg 2: 128-bit UUIDs */
Wolfgang Betz 132:51056160fa4a 797 /**
Wolfgang Betz 132:51056160fa4a 798 * A sequence of handle-uuid pairs.\n
Wolfgang Betz 132:51056160fa4a 799 * @li if format=1, each pair is:\n
Wolfgang Betz 132:51056160fa4a 800 * [2 octets for handle, 2 octets for UUIDs] \n
Wolfgang Betz 132:51056160fa4a 801 * @li if format=2, each pair is:\n
Wolfgang Betz 132:51056160fa4a 802 * [2 octets for handle, 16 octets for UUIDs]
Wolfgang Betz 132:51056160fa4a 803 */
Wolfgang Betz 132:51056160fa4a 804 uint8_t handle_uuid_pair[VARIABLE_SIZE];
Wolfgang Betz 132:51056160fa4a 805 } PACKED evt_att_find_information_resp;
Wolfgang Betz 132:51056160fa4a 806
Wolfgang Betz 132:51056160fa4a 807 /**
Wolfgang Betz 132:51056160fa4a 808 * This event is generated in response to a @a Find @a By @a Type @a Value @a Request. See
Wolfgang Betz 132:51056160fa4a 809 * Find By Type Value Response in Bluetooth Core v4.0 spec. See @ref _evt_att_find_by_type_val_resp.
Wolfgang Betz 132:51056160fa4a 810 */
Wolfgang Betz 132:51056160fa4a 811 #define EVT_BLUE_ATT_FIND_BY_TYPE_VAL_RESP (0x0C05)
Wolfgang Betz 132:51056160fa4a 812 typedef __packed struct _evt_att_find_by_type_val_resp{
Wolfgang Betz 132:51056160fa4a 813 uint16_t conn_handle; /**< The connection handle related to the response */
Wolfgang Betz 132:51056160fa4a 814 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 815 /**
Wolfgang Betz 132:51056160fa4a 816 * Handles Information List as defined in Bluetooth Core v4.0 spec.
Wolfgang Betz 132:51056160fa4a 817 * A sequence of handle pairs: [2 octets for Found Attribute Handle, 2 octets for Group End Handle]
Wolfgang Betz 132:51056160fa4a 818 */
Wolfgang Betz 132:51056160fa4a 819 uint8_t handles_info_list[VARIABLE_SIZE];
Wolfgang Betz 132:51056160fa4a 820 } PACKED evt_att_find_by_type_val_resp;
Wolfgang Betz 132:51056160fa4a 821
Wolfgang Betz 132:51056160fa4a 822 /**
Wolfgang Betz 132:51056160fa4a 823 * This event is generated in response to a @a Read @a By @a Type @a Request. See aci_gatt_find_included_services() and
Wolfgang Betz 132:51056160fa4a 824 * aci_gatt_disc_all_charac_of_serv().
Wolfgang Betz 132:51056160fa4a 825 * For more info see Read By Type Response in Bluetooth Core v4.0 spec. See @ref _evt_att_read_by_type_resp.
Wolfgang Betz 132:51056160fa4a 826 */
Wolfgang Betz 132:51056160fa4a 827 #define EVT_BLUE_ATT_READ_BY_TYPE_RESP (0x0C06)
Wolfgang Betz 132:51056160fa4a 828 typedef __packed struct _evt_att_read_by_type_resp{
Wolfgang Betz 132:51056160fa4a 829 uint16_t conn_handle; /**< The connection handle related to the response */
Wolfgang Betz 132:51056160fa4a 830 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 831 uint8_t handle_value_pair_length; /**< The size of each attribute handle-value pair */
Wolfgang Betz 132:51056160fa4a 832 /**
Wolfgang Betz 132:51056160fa4a 833 * Attribute Data List as defined in Bluetooth Core v4.0 spec.
Wolfgang Betz 132:51056160fa4a 834 * A sequence of handle-value pairs: [2 octets for Attribute Handle, (handle_value_pair_length - 2 octets) for Attribute Value]
Wolfgang Betz 132:51056160fa4a 835 */
Wolfgang Betz 132:51056160fa4a 836 uint8_t handle_value_pair[VARIABLE_SIZE];
Wolfgang Betz 132:51056160fa4a 837 } PACKED evt_att_read_by_type_resp;
Wolfgang Betz 132:51056160fa4a 838
Wolfgang Betz 132:51056160fa4a 839 /**
Wolfgang Betz 132:51056160fa4a 840 * This event is generated in response to a @a Read @a Request. See aci_gatt_read_charac_val().
Wolfgang Betz 132:51056160fa4a 841 * For more info see Read Response in Bluetooth Core v4.0 spec. See @ref _evt_att_read_resp.
Wolfgang Betz 132:51056160fa4a 842 */
Wolfgang Betz 132:51056160fa4a 843 #define EVT_BLUE_ATT_READ_RESP (0x0C07)
Wolfgang Betz 132:51056160fa4a 844 typedef __packed struct _evt_att_read_resp{
Wolfgang Betz 132:51056160fa4a 845 uint16_t conn_handle; /**< The connection handle related to the response. */
Wolfgang Betz 132:51056160fa4a 846 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 847 uint8_t attribute_value[VARIABLE_SIZE]; /**< The value of the attribute. */
Wolfgang Betz 132:51056160fa4a 848 } PACKED evt_att_read_resp;
Wolfgang Betz 132:51056160fa4a 849
Wolfgang Betz 132:51056160fa4a 850 /**
Wolfgang Betz 132:51056160fa4a 851 * This event is generated in response to a @a Read @a Blob @a Request. See aci_gatt_read_long_charac_val().
Wolfgang Betz 132:51056160fa4a 852 * For more info see Read Blob Response in Bluetooth Core v4.0 spec. See @ref _evt_att_read_blob_resp.
Wolfgang Betz 132:51056160fa4a 853 */
Wolfgang Betz 132:51056160fa4a 854 #define EVT_BLUE_ATT_READ_BLOB_RESP (0x0C08)
Wolfgang Betz 132:51056160fa4a 855 typedef __packed struct _evt_att_read_blob_resp{
Wolfgang Betz 132:51056160fa4a 856 uint16_t conn_handle; /**< The connection handle related to the response. */
Wolfgang Betz 132:51056160fa4a 857 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 858 uint8_t part_attribute_value[VARIABLE_SIZE]; /**< Part of the attribute value. */
Wolfgang Betz 132:51056160fa4a 859 } PACKED evt_att_read_blob_resp;
Wolfgang Betz 132:51056160fa4a 860
Wolfgang Betz 132:51056160fa4a 861 /**
Wolfgang Betz 132:51056160fa4a 862 * This event is generated in response to a @a Read @a Multiple @a Request.
Wolfgang Betz 132:51056160fa4a 863 * For more info see Read Multiple Response in Bluetooth Core v4.0 spec. See @ref _evt_att_read_mult_resp.
Wolfgang Betz 132:51056160fa4a 864 */
Wolfgang Betz 132:51056160fa4a 865 #define EVT_BLUE_ATT_READ_MULTIPLE_RESP (0x0C09)
Wolfgang Betz 132:51056160fa4a 866 typedef __packed struct _evt_att_read_mult_resp{
Wolfgang Betz 132:51056160fa4a 867 uint16_t conn_handle; /**< The connection handle related to the response. */
Wolfgang Betz 132:51056160fa4a 868 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 869 uint8_t set_of_values[VARIABLE_SIZE]; /**< A set of two or more values.*/
Wolfgang Betz 132:51056160fa4a 870 } PACKED evt_att_read_mult_resp;
Wolfgang Betz 132:51056160fa4a 871
Wolfgang Betz 132:51056160fa4a 872 /**
Wolfgang Betz 132:51056160fa4a 873 * This event is generated in response to a @a Read @a By @a Group @a Type @a Request. See aci_gatt_disc_all_prim_services().
Wolfgang Betz 132:51056160fa4a 874 * For more info see Read By Group type Response in Bluetooth Core v4.0 spec. See @ref _evt_att_read_by_group_resp.
Wolfgang Betz 132:51056160fa4a 875 */
Wolfgang Betz 132:51056160fa4a 876 #define EVT_BLUE_ATT_READ_BY_GROUP_TYPE_RESP (0x0C0A)
Wolfgang Betz 132:51056160fa4a 877 typedef __packed struct _evt_att_read_by_group_resp{
Wolfgang Betz 132:51056160fa4a 878 uint16_t conn_handle; /**< The connection handle related to the response. */
Wolfgang Betz 132:51056160fa4a 879 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 880 uint8_t attribute_data_length; /**< The size of each Attribute Data. */
Wolfgang Betz 132:51056160fa4a 881 /**
Wolfgang Betz 132:51056160fa4a 882 * A list of Attribute Data where the attribute data is composed by:
Wolfgang Betz 132:51056160fa4a 883 * @li 2 octets for Attribute Handle
Wolfgang Betz 132:51056160fa4a 884 * @li 2 octets for End Group Handle
Wolfgang Betz 132:51056160fa4a 885 * @li (attribute_data_length - 4) octets for Attribute Value
Wolfgang Betz 132:51056160fa4a 886 */
Wolfgang Betz 132:51056160fa4a 887 uint8_t attribute_data_list[VARIABLE_SIZE];
Wolfgang Betz 132:51056160fa4a 888 } PACKED evt_att_read_by_group_resp;
Wolfgang Betz 132:51056160fa4a 889
Wolfgang Betz 132:51056160fa4a 890 /**
Wolfgang Betz 132:51056160fa4a 891 * This event is generated in response to a @a Prepare @a Write @a Request.
Wolfgang Betz 132:51056160fa4a 892 * For more info see Prepare Write Response in Bluetooth Core v4.0 spec. See @ref _evt_att_prepare_write_resp.
Wolfgang Betz 132:51056160fa4a 893 */
Wolfgang Betz 132:51056160fa4a 894 #define EVT_BLUE_ATT_PREPARE_WRITE_RESP (0x0C0C)
Wolfgang Betz 132:51056160fa4a 895 typedef __packed struct _evt_att_prepare_write_resp{
Wolfgang Betz 132:51056160fa4a 896 uint16_t conn_handle; /**< The connection handle related to the response. */
Wolfgang Betz 132:51056160fa4a 897 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 898 uint16_t attribute_handle; /**< The handle of the attribute to be written. */
Wolfgang Betz 132:51056160fa4a 899 uint16_t offset; /**< The offset of the first octet to be written. */
Wolfgang Betz 132:51056160fa4a 900 uint8_t part_attr_value[VARIABLE_SIZE]; /**< The value of the attribute to be written. */
Wolfgang Betz 132:51056160fa4a 901 } PACKED evt_att_prepare_write_resp;
Wolfgang Betz 132:51056160fa4a 902
Wolfgang Betz 132:51056160fa4a 903 /**
Wolfgang Betz 132:51056160fa4a 904 * This event is generated in response to an @a Execute @a Write @a Request.
Wolfgang Betz 132:51056160fa4a 905 * For more info see Execute Write Response in Bluetooth Core v4.0 spec. See @ref _evt_att_exec_write_resp.
Wolfgang Betz 132:51056160fa4a 906 */
Wolfgang Betz 132:51056160fa4a 907 #define EVT_BLUE_ATT_EXEC_WRITE_RESP (0x0C0D)
Wolfgang Betz 132:51056160fa4a 908 typedef __packed struct _evt_att_exec_write_resp{
Wolfgang Betz 132:51056160fa4a 909 uint16_t conn_handle; /**< The connection handle related to the response. */
Wolfgang Betz 132:51056160fa4a 910 uint8_t event_data_length; /**< Always 0. */
Wolfgang Betz 132:51056160fa4a 911 } PACKED evt_att_exec_write_resp;
Wolfgang Betz 132:51056160fa4a 912
Wolfgang Betz 132:51056160fa4a 913 /**
Wolfgang Betz 132:51056160fa4a 914 * This event is generated when an indication is received from the server.
Wolfgang Betz 132:51056160fa4a 915 * For more info see Handle Value Indication in Bluetooth Core v4.0 spec. See @ref _evt_gatt_indication.
Wolfgang Betz 132:51056160fa4a 916 */
Wolfgang Betz 132:51056160fa4a 917 #define EVT_BLUE_GATT_INDICATION (0x0C0E)
Wolfgang Betz 132:51056160fa4a 918 typedef __packed struct _evt_gatt_indication{
Wolfgang Betz 132:51056160fa4a 919 uint16_t conn_handle; /**< The connection handle related to the event. */
Wolfgang Betz 132:51056160fa4a 920 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 921 uint16_t attr_handle; /**< The handle of the attribute. */
Wolfgang Betz 132:51056160fa4a 922 uint8_t attr_value[VARIABLE_SIZE]; /**< The current value of the attribute. */
Wolfgang Betz 132:51056160fa4a 923 } PACKED evt_gatt_indication;
Wolfgang Betz 132:51056160fa4a 924
Wolfgang Betz 132:51056160fa4a 925 /**
Wolfgang Betz 132:51056160fa4a 926 * This event is generated when a notification is received from the server.
Wolfgang Betz 132:51056160fa4a 927 * For more info see Handle Value Notification in Bluetooth Core v4.0 spec. See @ref _evt_gatt_notification.
Wolfgang Betz 132:51056160fa4a 928 */
Wolfgang Betz 132:51056160fa4a 929 #define EVT_BLUE_GATT_NOTIFICATION (0x0C0F)
Wolfgang Betz 132:51056160fa4a 930 typedef __packed struct _evt_gatt_notification{
Wolfgang Betz 132:51056160fa4a 931 uint16_t conn_handle; /**< The connection handle related to the event. */
Wolfgang Betz 132:51056160fa4a 932 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 933 uint16_t attr_handle; /**< The handle of the attribute. */
Wolfgang Betz 132:51056160fa4a 934 uint8_t attr_value[VARIABLE_SIZE]; /**< The current value of the attribute. */
Wolfgang Betz 132:51056160fa4a 935 } PACKED evt_gatt_attr_notification;
Wolfgang Betz 132:51056160fa4a 936
Wolfgang Betz 132:51056160fa4a 937 /**
Wolfgang Betz 132:51056160fa4a 938 * This event is generated when a GATT client procedure completes either with error or successfully.
Wolfgang Betz 132:51056160fa4a 939 * See @ref _evt_gatt_procedure_complete.
Wolfgang Betz 132:51056160fa4a 940 */
Wolfgang Betz 132:51056160fa4a 941 #define EVT_BLUE_GATT_PROCEDURE_COMPLETE (0x0C10)
Wolfgang Betz 132:51056160fa4a 942 typedef __packed struct _evt_gatt_procedure_complete{
Wolfgang Betz 132:51056160fa4a 943 uint16_t conn_handle; /**< The connection handle on which the GATT procedure has completed */
Wolfgang Betz 132:51056160fa4a 944 uint8_t data_length; /**< Length of error_code field (always 1). */
Wolfgang Betz 132:51056160fa4a 945 /**
Wolfgang Betz 132:51056160fa4a 946 * Indicates whether the procedure completed with error (BLE_STATUS_FAILED) or was successful (BLE_STATUS_SUCCESS).
Wolfgang Betz 132:51056160fa4a 947 */
Wolfgang Betz 132:51056160fa4a 948 uint8_t error_code;
Wolfgang Betz 132:51056160fa4a 949 } PACKED evt_gatt_procedure_complete;
Wolfgang Betz 132:51056160fa4a 950
Wolfgang Betz 132:51056160fa4a 951 /**
Wolfgang Betz 132:51056160fa4a 952 * This event is generated when an Error Response is received from the server. The error response can be given
Wolfgang Betz 132:51056160fa4a 953 * by the server at the end of one of the GATT discovery procedures. This does not mean that the procedure ended
Wolfgang Betz 132:51056160fa4a 954 * with an error, but this error event is part of the procedure itself. See @ref _evt_gatt_error_resp.
Wolfgang Betz 132:51056160fa4a 955 */
Wolfgang Betz 132:51056160fa4a 956 #define EVT_BLUE_GATT_ERROR_RESP (0x0C11)
Wolfgang Betz 132:51056160fa4a 957 typedef __packed struct _evt_gatt_error_resp{
Wolfgang Betz 132:51056160fa4a 958 uint16_t conn_handle; /**< The connection handle related to the event. */
Wolfgang Betz 132:51056160fa4a 959 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 960 uint8_t req_opcode; /**< The request that generated this error response. */
Wolfgang Betz 132:51056160fa4a 961 uint16_t attr_handle; /**< The attribute handle that generated this error response. */
Wolfgang Betz 132:51056160fa4a 962 uint8_t error_code; /**< The reason why the request has generated an error response. See Error Response in Bluetooth Core v4.0 spec. */
Wolfgang Betz 132:51056160fa4a 963 } PACKED evt_gatt_error_resp;
Wolfgang Betz 132:51056160fa4a 964
Wolfgang Betz 132:51056160fa4a 965 /**
Wolfgang Betz 132:51056160fa4a 966 * This event can be generated during a "Discover Characteristics By UUID" procedure or a "Read using
Wolfgang Betz 132:51056160fa4a 967 * Characteristic UUID" procedure.
Wolfgang Betz 132:51056160fa4a 968 * The attribute value will be a service declaration as defined in Bluetooth Core v4.0 spec (vol.3, Part G, ch. 3.3.1),
Wolfgang Betz 132:51056160fa4a 969 * when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a
Wolfgang Betz 132:51056160fa4a 970 * "Read using Characteristic UUID" has been performed. See @ref _evt_gatt_disc_read_char_by_uuid_resp.
Wolfgang Betz 132:51056160fa4a 971 */
Wolfgang Betz 132:51056160fa4a 972 #define EVT_BLUE_GATT_DISC_READ_CHAR_BY_UUID_RESP (0x0C12)
Wolfgang Betz 132:51056160fa4a 973 typedef __packed struct _evt_gatt_disc_read_char_by_uuid_resp{
Wolfgang Betz 132:51056160fa4a 974 uint16_t conn_handle; /**< The connection handle related to the event. */
Wolfgang Betz 132:51056160fa4a 975 uint8_t event_data_length; /**< Length of following data. */
Wolfgang Betz 132:51056160fa4a 976 uint16_t attr_handle; /**< The handle of the attribute. */
Wolfgang Betz 132:51056160fa4a 977 /**
Wolfgang Betz 132:51056160fa4a 978 * The attribute value will be a service declaration as defined in Bluetooth Core v4.0 spec (vol.3, Part G, ch. 3.3.1),
Wolfgang Betz 132:51056160fa4a 979 * when a "Discover Characteristics By UUID" has been started. It will be the value of the Characteristic if a
Wolfgang Betz 132:51056160fa4a 980 * "Read using Characteristic UUID" has been performed.
Wolfgang Betz 132:51056160fa4a 981 */
Wolfgang Betz 132:51056160fa4a 982 uint8_t attr_value[VARIABLE_SIZE];
Wolfgang Betz 132:51056160fa4a 983 } PACKED evt_gatt_disc_read_char_by_uuid_resp;
Wolfgang Betz 132:51056160fa4a 984
Wolfgang Betz 132:51056160fa4a 985 /**
Wolfgang Betz 132:51056160fa4a 986 * This event is given to the application when a write request, write command or signed write command
Wolfgang Betz 132:51056160fa4a 987 * is received by the server from the client. This event will be given to the application only if the
Wolfgang Betz 132:51056160fa4a 988 * event bit for this event generation is set when the characteristic was added.
Wolfgang Betz 132:51056160fa4a 989 * When this event is received, the application has to check whether the value being requested for write
Wolfgang Betz 132:51056160fa4a 990 * is allowed to be written and respond with the command aci_gatt_write_response().
Wolfgang Betz 132:51056160fa4a 991 * If the write is rejected by the application, then the value of the attribute will not be modified.
Wolfgang Betz 132:51056160fa4a 992 * In case of a write request, an error response will be sent to the client, with the error code as specified by the application.
Wolfgang Betz 132:51056160fa4a 993 * In case of write/signed write commands, no response is sent to the client but the attribute is not modified.
Wolfgang Betz 132:51056160fa4a 994 * See @ref evt_gatt_write_permit_req.
Wolfgang Betz 132:51056160fa4a 995 */
Wolfgang Betz 132:51056160fa4a 996 #define EVT_BLUE_GATT_WRITE_PERMIT_REQ (0x0C13)
Wolfgang Betz 132:51056160fa4a 997 typedef __packed struct _evt_gatt_write_permit_req{
Wolfgang Betz 132:51056160fa4a 998 uint16_t conn_handle; /**< Handle of the connection on which there was the request to write the attribute. */
Wolfgang Betz 132:51056160fa4a 999 uint16_t attr_handle; /**< The handle of the attribute for which the write request has been made by the client */
Wolfgang Betz 132:51056160fa4a 1000 uint8_t data_length; /**< Length of data field. */
Wolfgang Betz 132:51056160fa4a 1001 uint8_t data[VARIABLE_SIZE]; /**< The data that the client has requested to write */
Wolfgang Betz 132:51056160fa4a 1002 } PACKED evt_gatt_write_permit_req;
Wolfgang Betz 132:51056160fa4a 1003
Wolfgang Betz 132:51056160fa4a 1004 /**
Wolfgang Betz 132:51056160fa4a 1005 * This event is given to the application when a read request or read blob request is received by the server
Wolfgang Betz 132:51056160fa4a 1006 * from the client. This event will be given to the application only if the event bit for this event generation
Wolfgang Betz 132:51056160fa4a 1007 * is set when the characteristic was added.
Wolfgang Betz 132:51056160fa4a 1008 * On receiving this event, the application can update the value of the handle if it desires and when done
Wolfgang Betz 132:51056160fa4a 1009 * it has to use the aci_gatt_allow_read() command to indicate to the stack that it can send the response to the client.
Wolfgang Betz 132:51056160fa4a 1010 * See @ref evt_gatt_read_permit_req.
Wolfgang Betz 132:51056160fa4a 1011 *
Wolfgang Betz 132:51056160fa4a 1012 */
Wolfgang Betz 132:51056160fa4a 1013 #define EVT_BLUE_GATT_READ_PERMIT_REQ (0x0C14)
Wolfgang Betz 132:51056160fa4a 1014 typedef __packed struct _evt_gatt_read_permit_req{
Wolfgang Betz 132:51056160fa4a 1015 uint16_t conn_handle; /**< Handle of the connection on which there was the request to read the attribute. */
Wolfgang Betz 132:51056160fa4a 1016 uint16_t attr_handle; /**< The handle of the attribute for which the read request has been made by the client */
Wolfgang Betz 132:51056160fa4a 1017 uint8_t data_length; /**< Length of offset field. (always 1). */
Wolfgang Betz 132:51056160fa4a 1018 uint8_t offset; /**< Contains the offset from which the read has been requested */
Wolfgang Betz 132:51056160fa4a 1019 } PACKED evt_gatt_read_permit_req;
Wolfgang Betz 132:51056160fa4a 1020
Wolfgang Betz 132:51056160fa4a 1021 /**
Wolfgang Betz 132:51056160fa4a 1022 * This event is given to the application when a read multiple request or read by type request is received
Wolfgang Betz 132:51056160fa4a 1023 * by the server from the client. This event will be given to the application only if the event bit for this
Wolfgang Betz 132:51056160fa4a 1024 * event generation is set when the characteristic was added.
Wolfgang Betz 132:51056160fa4a 1025 * On receiving this event, the application can update the values of the handles if it desires and when done
Wolfgang Betz 132:51056160fa4a 1026 * it has to send the aci_gatt_allow_read command to indicate to the stack that it can send the response to the client.
Wolfgang Betz 132:51056160fa4a 1027 * See @ref evt_gatt_read_multi_permit_req.
Wolfgang Betz 132:51056160fa4a 1028 *
Wolfgang Betz 132:51056160fa4a 1029 */
Wolfgang Betz 132:51056160fa4a 1030 #define EVT_BLUE_GATT_READ_MULTI_PERMIT_REQ (0x0C15)
Wolfgang Betz 132:51056160fa4a 1031 typedef __packed struct _evt_gatt_read_multi_permit_req{
Wolfgang Betz 132:51056160fa4a 1032 uint16_t conn_handle; /**< Handle of the connection on which there was the request to read the attribute. */
Wolfgang Betz 132:51056160fa4a 1033 uint8_t data_length; /**< Length of data field. */
Wolfgang Betz 132:51056160fa4a 1034 uint8_t data[VARIABLE_SIZE]; /**< The handles of the attributes that have been requested by the client for a read. */
Wolfgang Betz 132:51056160fa4a 1035 } PACKED evt_gatt_read_multi_permit_req;
Wolfgang Betz 132:51056160fa4a 1036
Wolfgang Betz 132:51056160fa4a 1037 /**
Wolfgang Betz 132:51056160fa4a 1038 * @}
Wolfgang Betz 132:51056160fa4a 1039 */
Wolfgang Betz 132:51056160fa4a 1040
Wolfgang Betz 132:51056160fa4a 1041 /**
Wolfgang Betz 132:51056160fa4a 1042 * @}
Wolfgang Betz 132:51056160fa4a 1043 */
Wolfgang Betz 132:51056160fa4a 1044
Wolfgang Betz 132:51056160fa4a 1045 #endif /* __BLUENRG_GATT_ACI_H__ */