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