1 /****************************************************************************** 2 * @file ble_events.h 3 * @author MCD Application Team 4 * @date 19 July 2019 5 * @brief Header file for STM32WB (Event callbacks) 6 * Auto-generated file: do not edit! 7 ****************************************************************************** 8 * @attention 9 * 10 * <h2><center>© Copyright (c) 2019 STMicroelectronics. 11 * All rights reserved.</center></h2> 12 * 13 * This software component is licensed by ST under Ultimate Liberty license 14 * SLA0044, the "License"; You may not use this file except in compliance with 15 * the License. You may obtain a copy of the License at: 16 * www.st.com/SLA0044 17 * 18 ****************************************************************************** 19 */ 20 21 #ifndef BLE_EVENTS_H__ 22 #define BLE_EVENTS_H__ 23 24 25 26 #include "ble_types.h" 27 28 typedef struct 29 { 30 uint16_t evt_code; 31 void (*process)(uint8_t *buffer_in); 32 } hci_event_table_t; 33 34 #define HCI_EVENT_TABLE_SIZE 7 35 #define HCI_LE_META_EVENT_TABLE_SIZE 11 36 #define HCI_VENDOR_SPECIFIC_EVENT_TABLE_SIZE 42 37 extern const hci_event_table_t hci_event_table[HCI_EVENT_TABLE_SIZE]; 38 extern const hci_event_table_t hci_le_meta_event_table[HCI_LE_META_EVENT_TABLE_SIZE]; 39 extern const hci_event_table_t hci_vendor_specific_event_table[HCI_VENDOR_SPECIFIC_EVENT_TABLE_SIZE]; 40 /** 41 *@defgroup HCI_events HCI events 42 *@brief HCI events layer. 43 *@{ 44 */ 45 /* HCI events */ 46 /** 47 * @brief The Disconnection Complete event occurs when a connection is terminated. 48 The status parameter indicates if the disconnection was successful or not. The 49 reason parameter indicates the reason for the disconnection if the disconnection 50 was successful. If the disconnection was not successful, the value of the 51 reason parameter can be ignored by the Host. For example, this can be the 52 case if the Host has issued the Disconnect command and there was a parameter 53 error, or the command was not presently allowed, or a Connection_Handle 54 that didn't correspond to a connection was given. 55 * @param Status Status error code. 56 * @param Connection_Handle Connection_Handle which was disconnected. 57 * Values: 58 - 0x0000 ... 0x0EFF 59 * @param Reason Reason for disconnection. 60 * Values: 61 - 0x00: Success 62 - 0x01: Unknown HCI Command 63 - 0x02: Unknown Connection Identifier 64 - 0x03: Hardware Failure 65 - 0x05: Authentication Failure 66 - 0x06: PIN or Key Missing 67 - 0x07: Memory Capacity Exceeded 68 - 0x08: Connection Timeout 69 - 0x09: Connection Limit Exceeded 70 - 0x0B: ACL Connection Already Exists 71 - 0x0C: Command Disallowed 72 - 0x0D: Connection Rejected Due To Limited Resources 73 - 0x0E: Connection Rejected Due To Security Reasons 74 - 0x0F: Connection Rejected due to Unacceptable BD_ADDR 75 - 0x10: Connection Accept Timeout Exceeded 76 - 0x11: Unsupported Feature Or Parameter Value 77 - 0x12: Invalid HCI Command Parameters 78 - 0x13: Remote User Terminated Connection 79 - 0x14: Remote Device Terminated Connection due to Low Resources 80 - 0x15: Remote Device Terminated Connection due to Power Off 81 - 0x16: Connection Terminated By Local Host 82 - 0x17: Repeated Attempts 83 - 0x18: Pairing Not Allowed 84 - 0x19: Unknown LMP PDU 85 - 0x1A: Unsupported Remote Feature / Unsupported LMP Feature 86 - 0x1E: Invalid LMP Parameters 87 - 0x1F: Unspecified Error 88 - 0x20: Unsupported LMP Parameter Value 89 - 0x21: Role Change Not Allowed 90 - 0x22: LMP Response Timeout / LL Response Timeout 91 - 0x23: LMP Error Transaction Collision 92 - 0x24: LMP PDU Not Allowed 93 - 0x25: Encryption Mode Not Acceptable 94 - 0x26: Link Key cannot be Changed 95 - 0x28: Instant Passed 96 - 0x29: Pairing With Unit Key Not Supported 97 - 0x2A: Different Transaction Collision 98 - 0x2E: Channel Assessment Not Supported 99 - 0x2F: Insufficient Security 100 - 0x30: Parameter Out Of Mandatory Range 101 - 0x32: Role Switch Pending 102 - 0x34: Reserved Slot Violation 103 - 0x35: Role Switch Failed 104 - 0x37: Secure Simple Pairing Not Supported by Host 105 - 0x38: Host Busy - Pairing 106 - 0x39: Connection Rejected due to No Suitable Channel Found 107 - 0x3A: Controller Busy 108 - 0x3B: Unacceptable Connection Interval 109 - 0x3C: Directed Advertising Timeout 110 - 0x3D: Connection Terminated Due to MIC Failure 111 - 0x3E: Connection Failed to be Established 112 - 0x41: Failed 113 - 0x42: Invalid parameters 114 - 0x43: Busy 115 - 0x44: Invalid length 116 - 0x45: Pending 117 - 0x46: Not allowed 118 - 0x47: GATT error 119 - 0x48: Address not resolved 120 - 0x50: Invalid CID 121 - 0x5A: CSRK not found 122 - 0x5B: IRK not found 123 - 0x5C: Device not found in DB 124 - 0x5D: Security DB full 125 - 0x5E: Device not bonded 126 - 0x5F: Device in blacklist 127 - 0x60: Invalid handle 128 - 0x61: Invalid parameter 129 - 0x62: Out of handles 130 - 0x63: Invalid operation 131 - 0x64: Insufficient resources 132 - 0x65: Insufficient encryption key size 133 - 0x66: Characteristic already exist 134 - 0x82: No valid slot 135 - 0x83: Short window 136 - 0x84: New interval failed 137 - 0x85: Too large interval 138 - 0x86: Slot length failed 139 * @retval None 140 */ 141 WEAK_FUNCTION(void hci_disconnection_complete_event(uint8_t Status, 142 uint16_t Connection_Handle, 143 uint8_t Reason)); 144 /** 145 * @brief The Encryption Change event is used to indicate that the change of the encryption 146 mode has been completed. The Connection_Handle will be a Connection_Handle 147 for an ACL connection. The Encryption_Enabled event parameter 148 specifies the new Encryption_Enabled parameter for the Connection_Handle 149 specified by the Connection_Handle event parameter. This event will occur on 150 both devices to notify the Hosts when Encryption has changed for the specified 151 Connection_Handle between two devices. Note: This event shall not be generated 152 if encryption is paused or resumed; during a role switch, for example. 153 The meaning of the Encryption_Enabled parameter depends on whether the 154 Host has indicated support for Secure Connections in the Secure_Connections_Host_Support 155 parameter. When Secure_Connections_Host_Support is 156 'disabled' or the Connection_Handle refers to an LE link, the Controller shall 157 only use Encryption_Enabled values 0x00 (OFF) and 0x01 (ON). 158 (See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.7.8) 159 * @param Status Status error code. 160 * @param Connection_Handle Connection handle for which the command is given. 161 * Values: 162 - 0x0000 ... 0x0EFF 163 * @param Encryption_Enabled Link Level Encryption. 164 * Values: 165 - 0x00: Link Level Encryption OFF 166 - 0x01: Link Level Encryption is ON with AES-CCM 167 * @retval None 168 */ 169 WEAK_FUNCTION(void hci_encryption_change_event(uint8_t Status, 170 uint16_t Connection_Handle, 171 uint8_t Encryption_Enabled)); 172 /** 173 * @brief The Read Remote Version Information Complete event is used to indicate the 174 completion of the process obtaining the version information of the remote Controller 175 specified by the Connection_Handle event parameter. The Connection_Handle 176 shall be for an ACL connection. 177 The Version event parameter defines the specification version of the LE Controller. 178 The Manufacturer_Name event parameter indicates the manufacturer 179 of the remote Controller. The Subversion event parameter is controlled 180 by the manufacturer and is implementation dependent. The Subversion 181 event parameter defines the various revisions that each version of the Bluetooth 182 hardware will go through as design processes change and errors are 183 fixed. This allows the software to determine what Bluetooth hardware is being 184 used and, if necessary, to work around various bugs in the hardware. 185 When the Connection_Handle is associated with an LE-U logical link, the Version 186 event parameter shall be Link Layer VersNr parameter, the Manufacturer_Name 187 event parameter shall be the CompId parameter, and the Subversion 188 event parameter shall be the SubVersNr parameter. 189 (See Bluetooth Specification v.5.0, Vol. 2, Part E, 7.7.12) 190 * @param Status Status error code. 191 * @param Connection_Handle Connection handle for which the command is given. 192 * Values: 193 - 0x0000 ... 0x0EFF 194 * @param Version Version of the Current LMP in the remote Controller 195 * @param Manufacturer_Name Manufacturer Name of the remote Controller 196 * @param Subversion Subversion of the LMP in the remote Controller 197 * @retval None 198 */ 199 WEAK_FUNCTION(void hci_read_remote_version_information_complete_event(uint8_t Status, 200 uint16_t Connection_Handle, 201 uint8_t Version, 202 uint16_t Manufacturer_Name, 203 uint16_t Subversion)); 204 /** 205 * @brief The Hardware Error event is used to indicate some implementation specific type of hardware failure for the controller. This event is used to notify the Host that a hardware failure has occurred in the Controller. 206 * @param Hardware_Code Hardware Error Event code. 207 Error code 0 is not used. 208 Error code 1 is bluecore act2 error detected. 209 Error code 2 is bluecore time overrun error detected. 210 Error code 3 is internal FIFO full. 211 * Values: 212 - 0x00: Not used 213 - 0x01: event_act2 error 214 - 0x02: event_time_overrun error 215 - 0x03: event_fifo_full error 216 * @retval None 217 */ 218 WEAK_FUNCTION(void hci_hardware_error_event(uint8_t Hardware_Code)); 219 /** 220 * @brief 'The Number Of Completed Packets event is used by the Controller to indicate 221 to the Host how many HCI Data Packets have been completed (transmitted or 222 flushed) for each Connection_Handle since the previous Number Of Completed 223 Packets event was sent to the Host. This means that the corresponding 224 buffer space has been freed in the Controller. Based on this information, and 225 the HC_Total_Num_ACL_Data_Packets and HC_Total_Num_Synchronous_- 226 Data_Packets return parameter of the Read_Buffer_Size command, the Host 227 can determine for which Connection_Handles the following HCI Data Packets 228 should be sent to the Controller. The Number Of Completed Packets event 229 must not be sent before the corresponding Connection Complete event. While 230 the Controller has HCI data packets in its buffer, it must keep sending the Number 231 Of Completed Packets event to the Host at least periodically, until it finally 232 reports that all the pending ACL Data Packets have been transmitted or 233 flushed. 234 * @param Number_of_Handles The number of Connection_Handles and Num_HCI_Data_Packets parameters pairs contained in this event 235 * @param Handle_Packets_Pair_Entry See @ref Handle_Packets_Pair_Entry_t 236 * @retval None 237 */ 238 WEAK_FUNCTION(void hci_number_of_completed_packets_event(uint8_t Number_of_Handles, 239 Handle_Packets_Pair_Entry_t Handle_Packets_Pair_Entry[])); 240 /** 241 * @brief 'This event is used to indicate that the Controller's data buffers have been overflowed. 242 This can occur if the Host has sent more packets than allowed. The 243 Link_Type parameter is used to indicate that the overflow was caused by ACL data. 244 * @param Link_Type On wich type of channel overflow has occurred. 245 * Values: 246 - 0x01: ACL Buffer Overflow 247 * @retval None 248 */ 249 WEAK_FUNCTION(void hci_data_buffer_overflow_event(uint8_t Link_Type)); 250 /** 251 * @brief 'The Encryption Key Refresh Complete event is used to indicate to the Host 252 that the encryption key was refreshed on the given Connection_Handle any 253 time encryption is paused and then resumed. 254 If the Encryption Key Refresh Complete event was generated due to an 255 encryption pause and resume operation embedded within a change connection 256 link key procedure, the Encryption Key Refresh Complete event shall be sent 257 prior to the Change Connection Link Key Complete event. 258 If the Encryption Key Refresh Complete event was generated due to an 259 encryption pause and resume operation embedded within a role switch procedure, 260 the Encryption Key Refresh Complete event shall be sent prior to the 261 Role Change event. 262 * @param Status Status error code. 263 * @param Connection_Handle Connection handle for which the command is given. 264 * Values: 265 - 0x0000 ... 0x0EFF 266 * @retval None 267 */ 268 WEAK_FUNCTION(void hci_encryption_key_refresh_complete_event(uint8_t Status, 269 uint16_t Connection_Handle)); 270 /** 271 * @} 272 */ 273 /** 274 *@defgroup HCI_LE_meta_events HCI LE meta events 275 *@brief HCI LE meta events layer. 276 *@{ 277 */ 278 /* HCI LE meta events */ 279 /** 280 * @brief The LE Connection Complete event indicates to both of the Hosts forming the 281 connection that a new connection has been created. Upon the creation of the 282 connection a Connection_Handle shall be assigned by the Controller, and 283 passed to the Host in this event. If the connection establishment fails this event 284 shall be provided to the Host that had issued the LE_Create_Connection command. 285 This event indicates to the Host which issued a LE_Create_Connection 286 command and received a Command Status event if the connection 287 establishment failed or was successful. 288 The Master_Clock_Accuracy parameter is only valid for a slave. On a master, 289 this parameter shall be set to 0x00. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.1 290 * @param Status Status error code. 291 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 292 * Values: 293 - 0x0000 ... 0x0EFF 294 * @param Role Role of the local device in the connection. 295 * Values: 296 - 0x00: Master 297 - 0x01: Slave 298 * @param Peer_Address_Type The address type of the peer device. 299 * Values: 300 - 0x00: Public Device Address 301 - 0x01: Random Device Address 302 * @param Peer_Address Public Device Address or Random Device Address of the peer 303 device 304 * @param Conn_Interval Connection interval used on this connection. 305 Time = N * 1.25 msec 306 * Values: 307 - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) 308 * @param Conn_Latency Slave latency for the connection in number of connection events. 309 * Values: 310 - 0x0000 ... 0x01F3 311 * @param Supervision_Timeout Supervision timeout for the LE Link. 312 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. 313 Time = N * 10 msec. 314 * Values: 315 - 0x000A (100 ms) ... 0x0C80 (32000 ms) 316 * @param Master_Clock_Accuracy Master clock accuracy. Only valid for a slave. 317 * Values: 318 - 0x00: 500 ppm 319 - 0x01: 250 ppm 320 - 0x02: 150 ppm 321 - 0x03: 100 ppm 322 - 0x04: 75 ppm 323 - 0x05: 50 ppm 324 - 0x06: 30 ppm 325 - 0x07: 20 ppm 326 * @retval None 327 */ 328 WEAK_FUNCTION(void hci_le_connection_complete_event(uint8_t Status, 329 uint16_t Connection_Handle, 330 uint8_t Role, 331 uint8_t Peer_Address_Type, 332 uint8_t Peer_Address[6], 333 uint16_t Conn_Interval, 334 uint16_t Conn_Latency, 335 uint16_t Supervision_Timeout, 336 uint8_t Master_Clock_Accuracy)); 337 /** 338 * @brief The LE Advertising Report event indicates that a Bluetooth device or multiple 339 Bluetooth devices have responded to an active scan or received some information 340 during a passive scan. The Controller may queue these advertising reports 341 and send information from multiple devices in one LE Advertising Report event. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.2 342 * @param Num_Reports Number of responses in this event. 343 * Values: 344 - 0x01 345 * @param Advertising_Report See @ref Advertising_Report_t 346 * @retval None 347 */ 348 WEAK_FUNCTION(void hci_le_advertising_report_event(uint8_t Num_Reports, 349 Advertising_Report_t Advertising_Report[])); 350 /** 351 * @brief The LE Connection Update Complete event is used to indicate that the Controller 352 process to update the connection has completed. 353 On a slave, if no connection parameters are updated, then this event shall not be issued. 354 On a master, this event shall be issued if the Connection_Update command was sent. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.3 355 * @param Status Status error code. 356 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 357 * Values: 358 - 0x0000 ... 0x0EFF 359 * @param Conn_Interval Connection interval used on this connection. 360 Time = N * 1.25 msec 361 * Values: 362 - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) 363 * @param Conn_Latency Slave latency for the connection in number of connection events. 364 * Values: 365 - 0x0000 ... 0x01F3 366 * @param Supervision_Timeout Supervision timeout for the LE Link. 367 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. 368 Time = N * 10 msec. 369 * Values: 370 - 0x000A (100 ms) ... 0x0C80 (32000 ms) 371 * @retval None 372 */ 373 WEAK_FUNCTION(void hci_le_connection_update_complete_event(uint8_t Status, 374 uint16_t Connection_Handle, 375 uint16_t Conn_Interval, 376 uint16_t Conn_Latency, 377 uint16_t Supervision_Timeout)); 378 /** 379 * @brief The LE Read Remote Used Features Complete event is used to indicate the 380 completion of the process of the Controller obtaining the used features of the 381 remote Bluetooth device specified by the Connection_Handle event parameter.See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.4 382 * @param Status Status error code. 383 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 384 * Values: 385 - 0x0000 ... 0x0EFF 386 * @param LE_Features Bit Mask List of used LE features. For details see LE Link Layer specification. 387 * @retval None 388 */ 389 WEAK_FUNCTION(void hci_le_read_remote_used_features_complete_event(uint8_t Status, 390 uint16_t Connection_Handle, 391 uint8_t LE_Features[8])); 392 /** 393 * @brief The LE Long Term Key Request event indicates that the master device is 394 attempting to encrypt or re-encrypt the link and is requesting the Long Term 395 Key from the Host. (See [Vol 6] Part B, Section 5.1.3)and Bluetooth spec 5.0 vol 2 [part E] 7.7.65.5 396 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 397 * Values: 398 - 0x0000 ... 0x0EFF 399 * @param Random_Number 64-bit random number 400 * @param Encrypted_Diversifier 16-bit encrypted diversifier 401 * @retval None 402 */ 403 WEAK_FUNCTION(void hci_le_long_term_key_request_event(uint16_t Connection_Handle, 404 uint8_t Random_Number[8], 405 uint16_t Encrypted_Diversifier)); 406 /** 407 * @brief The LE Data Length Change event notifies the Host of a change to either the 408 maximum Payload length or the maximum transmission time of packets in 409 either direction. The values reported are the maximum that will actually be 410 used on the connection following the change, except that on the LE Coded 411 PHY a packet taking up to 2704 us to transmit may be sent even though the 412 corresponding parameter has a lower value. 413 See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.7 414 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 415 * Values: 416 - 0x0000 ... 0x0EFF 417 * @param MaxTxOctets The maximum number of payload octets in a Link Layer packet that the 418 local Controller will send on this connection(connEffectiveMaxTxOctets defined in [Vol 6] Part B, Section 4.5.10). 419 * Values: 420 - 0x001B ... 0x00FB 421 * @param MaxTxTime The maximum time that the local Controller will take to send a Link 422 Layer packet on this connection (connEffectiveMaxTxTime defined in[Vol 6] Part B, Section 4.5.10). 423 * Values: 424 - 0x0148 ... 0x4290 425 * @param MaxRxOctets The maximum number of payload octets in a Link Layer packet that the 426 local Controller expects to receive on this connection(connEffectiveMaxRxOctets defined in [Vol 6] Part B, Section 4.5.10). 427 * Values: 428 - 0x001B ... 0x00FB 429 * @param MaxRxTime The maximum time that the local Controller expects to take to receive a 430 Link Layer packet on this connection (connEffectiveMaxRxTime defined in [Vol 6] Part B, Section 4.5.10). 431 * Values: 432 - 0x0148 ... 0x4290 433 * @retval None 434 */ 435 WEAK_FUNCTION(void hci_le_data_length_change_event(uint16_t Connection_Handle, 436 uint16_t MaxTxOctets, 437 uint16_t MaxTxTime, 438 uint16_t MaxRxOctets, 439 uint16_t MaxRxTime)); 440 /** 441 * @brief This event is generated when local P-256 key generation is complete. 442 See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.8 443 * @param Status Status error code. 444 * @param Local_P256_Public_Key Local P-256 public key. 445 * @retval None 446 */ 447 WEAK_FUNCTION(void hci_le_read_local_p256_public_key_complete_event(uint8_t Status, 448 uint8_t Local_P256_Public_Key[64])); 449 /** 450 * @brief This event indicates that LE Diffie Hellman key generation has been completed 451 by the Controller. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.9 452 * @param Status Status error code. 453 * @param DHKey Diffie Hellman Key 454 * @retval None 455 */ 456 WEAK_FUNCTION(void hci_le_generate_dhkey_complete_event(uint8_t Status, 457 uint8_t DHKey[32])); 458 /** 459 * @brief The LE Enhanced Connection Complete event indicates to both of the Hosts 460 forming the connection that a new connection has been created. Upon the 461 creation of the connection a Connection_Handle shall be assigned by the 462 Controller, and passed to the Host in this event. If the connection establishment 463 fails, this event shall be provided to the Host that had issued the 464 LE_Create_Connection command. 465 If this event is unmasked and LE Connection Complete event is unmasked, 466 only the LE Enhanced Connection Complete event is sent when a new 467 connection has been completed. 468 This event indicates to the Host that issued a LE_Create_Connection 469 command and received a Command Status event if the connection 470 establishment failed or was successful. 471 The Master_Clock_Accuracy parameter is only valid for a slave. On a master, 472 this parameter shall be set to 0x00. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.10 473 * @param Status Status error code. 474 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 475 * Values: 476 - 0x0000 ... 0x0EFF 477 * @param Role Role of the local device in the connection. 478 * Values: 479 - 0x00: Master 480 - 0x01: Slave 481 * @param Peer_Address_Type 0x00 Public Device Address 482 0x01 Random Device Address 483 0x02 Public Identity Address (Corresponds to Resolved Private Address) 484 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) 485 * Values: 486 - 0x00: Public Device Address 487 - 0x01: Random Device Address 488 - 0x02: Public Identity Address 489 - 0x03: Random (Static) Identity Address 490 * @param Peer_Address Public Device Address, Random Device Address, Public Identity 491 Address or Random (static) Identity Address of the device to be connected. 492 * @param Local_Resolvable_Private_Address Resolvable Private Address being used by the local device for this connection. 493 This is only valid when the Own_Address_Type is set to 0x02 or 0x03. For other Own_Address_Type values, 494 the Controller shall return all zeros. 495 * @param Peer_Resolvable_Private_Address Resolvable Private Address being used by the peer device for this connection. 496 This is only valid for Peer_Address_Type 0x02 and 0x03. For 497 other Peer_Address_Type values, the Controller shall return all zeros. 498 * @param Conn_Interval Connection interval used on this connection. 499 Time = N * 1.25 msec 500 * Values: 501 - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) 502 * @param Conn_Latency Slave latency for the connection in number of connection events. 503 * Values: 504 - 0x0000 ... 0x01F3 505 * @param Supervision_Timeout Supervision timeout for the LE Link. 506 It shall be a multiple of 10 ms and larger than (1 + connSlaveLatency) * connInterval * 2. 507 Time = N * 10 msec. 508 * Values: 509 - 0x000A (100 ms) ... 0x0C80 (32000 ms) 510 * @param Master_Clock_Accuracy Master clock accuracy. Only valid for a slave. 511 * Values: 512 - 0x00: 500 ppm 513 - 0x01: 250 ppm 514 - 0x02: 150 ppm 515 - 0x03: 100 ppm 516 - 0x04: 75 ppm 517 - 0x05: 50 ppm 518 - 0x06: 30 ppm 519 - 0x07: 20 ppm 520 * @retval None 521 */ 522 WEAK_FUNCTION(void hci_le_enhanced_connection_complete_event(uint8_t Status, 523 uint16_t Connection_Handle, 524 uint8_t Role, 525 uint8_t Peer_Address_Type, 526 uint8_t Peer_Address[6], 527 uint8_t Local_Resolvable_Private_Address[6], 528 uint8_t Peer_Resolvable_Private_Address[6], 529 uint16_t Conn_Interval, 530 uint16_t Conn_Latency, 531 uint16_t Supervision_Timeout, 532 uint8_t Master_Clock_Accuracy)); 533 /** 534 * @brief The LE Direct Advertising Report event indicates that directed advertisements 535 have been received where the advertiser is using a resolvable private address 536 for the InitA field in the ADV_DIRECT_IND PDU and the 537 Scanning_Filter_Policy is equal to 0x02 or 0x03, see HCI_LE_Set_Scan_Parameters. 538 Direct_Address_Type and Direct_Addres is the address the directed 539 advertisements are being directed to. Address_Type and Address is the 540 address of the advertiser sending the directed advertisements. See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.11 541 * @param Num_Reports Number of responses in this event. 542 * Values: 543 - 0x01 544 * @param Direct_Advertising_Report See @ref Direct_Advertising_Report_t 545 * @retval None 546 */ 547 WEAK_FUNCTION(void hci_le_direct_advertising_report_event(uint8_t Num_Reports, 548 Direct_Advertising_Report_t Direct_Advertising_Report[])); 549 /** 550 * @brief The LE PHY Update Complete Event is used to indicate that the Controller has 551 changed the transmitter PHY or receiver PHY in use. 552 If the Controller changes the transmitter PHY, the receiver PHY, or both PHYs, 553 this event shall be issued. 554 If an LE_Set_PHY command was sent and the Controller determines that 555 neither PHY will change as a result, it issues this event immediately. 556 See See Bluetooth spec 5.0 vol 2 [part E] 7.7.65.12 557 * @param Status Status error code. 558 * @param Connection_Handle Connection handle to be used to identify the connection with the peer device. 559 * Values: 560 - 0x0000 ... 0x0EFF 561 * @param TX_PHY Transmitter PHY in use 562 * Values: 563 - 0x01: The transmitter PHY for the connection is LE 1M 564 - 0x02: The transmitter PHY for the connection is LE 2M 565 - 0x03: The transmitter PHY for the connection is LE Coded (Not Supported by STM32WB) 566 * @param RX_PHY Receiver PHY in use 567 * Values: 568 - 0x01: The receiver PHY for the connection is LE 1M 569 - 0x02: The receiver PHY for the connection is LE 2M 570 - 0x03: The receiver PHY for the connection is LE Coded (Not Supported by STM32WB) 571 * @retval None 572 */ 573 WEAK_FUNCTION(void hci_le_phy_update_complete_event(uint8_t Status, 574 uint16_t Connection_Handle, 575 uint8_t TX_PHY, 576 uint8_t RX_PHY)); 577 /** 578 * @} 579 */ 580 /** 581 *@defgroup ACI_GAP_events ACI GAP events 582 *@brief ACI GAP events layer. 583 *@{ 584 */ 585 /* ACI GAP events */ 586 /** 587 * @brief This event is generated by the controller when the limited discoverable mode ends due to 588 timeout. The timeout is 180 seconds. 589 * @retval None 590 */ 591 WEAK_FUNCTION(void aci_gap_limited_discoverable_event(void)); 592 /** 593 * @brief This event is generated when the pairing process has completed successfully or a pairing 594 procedure timeout has occurred or the pairing has failed. This is to notify the application that 595 we have paired with a remote device so that it can take further actions or to notify that a 596 timeout has occurred so that the upper layer can decide to disconnect the link. 597 * @param Connection_Handle Connection handle on which the pairing procedure completed 598 * @param Status Pairing status 599 * Values: 600 - 0x00: Success 601 - 0x01: Timeout 602 - 0x02: Failed 603 * @param Reason Pairing reason error code 604 * Values: 605 - 0x00 606 - 0x01: PASSKEY_ENTRY_FAILED 607 - 0x02: OOB_NOT_AVAILABLE 608 - 0x03: AUTH_REQ_CANNOT_BE_MET 609 - 0x04: CONFIRM_VALUE_FAILED 610 - 0x05: PAIRING_NOT_SUPPORTED 611 - 0x06: INSUFF_ENCRYPTION_KEY_SIZE 612 - 0x07: CMD_NOT_SUPPORTED 613 - 0x08: UNSPECIFIED_REASON 614 - 0x09: VERY_EARLY_NEXT_ATTEMPT 615 - 0x0A: SM_INVALID_PARAMS 616 - 0x0B: SMP_SC_DHKEY_CHECK_FAILED 617 - 0x0C: SMP_SC_NUMCOMPARISON_FAILED 618 * @retval None 619 */ 620 WEAK_FUNCTION(void aci_gap_pairing_complete_event(uint16_t Connection_Handle, 621 uint8_t Status, 622 uint8_t Reason)); 623 /** 624 * @brief This event is generated by the Security manager to the application when a passkey is 625 required for pairing. When this event is received, the application has to respond with the 626 @ref aci_gap_pass_key_resp command. 627 * @param Connection_Handle Connection handle for which the passkey has been requested. 628 * @retval None 629 */ 630 WEAK_FUNCTION(void aci_gap_pass_key_req_event(uint16_t Connection_Handle)); 631 /** 632 * @brief This event is generated by the Security manager to the application when the application has 633 set that authorization is required for reading/writing of attributes. This event will be 634 generated as soon as the pairing is complete. When this event is received, 635 @ref aci_gap_authorization_resp command should be used to respond by the application. 636 * @param Connection_Handle Connection handle for which authorization has been requested. 637 * @retval None 638 */ 639 WEAK_FUNCTION(void aci_gap_authorization_req_event(uint16_t Connection_Handle)); 640 /** 641 * @brief This event is generated when the slave security request is successfully sent to the master. 642 * @retval None 643 */ 644 WEAK_FUNCTION(void aci_gap_slave_security_initiated_event(void)); 645 /** 646 * @brief This event is generated when a pairing request is issued in response to a slave security 647 request from a master which has previously bonded with the slave. When this event is 648 received, the upper layer has to issue the command @ref aci_gap_allow_rebond in order to 649 allow the slave to continue the pairing process with the master. 650 * @retval None 651 */ 652 WEAK_FUNCTION(void aci_gap_bond_lost_event(void)); 653 /** 654 * @brief This event is sent by the GAP to the upper layers when a procedure previously started has 655 been terminated by the upper layer or has completed for any other reason 656 * @param Procedure_Code Terminated procedure. 657 * Values: 658 - 0x01: GAP_LIMITED_DISCOVERY_PROC 659 - 0x02: GAP_GENERAL_DISCOVERY_PROC 660 - 0x04: GAP_NAME_DISCOVERY_PROC 661 - 0x08: GAP_AUTO_CONNECTION_ESTABLISHMENT_PROC 662 - 0x10: GAP_GENERAL_CONNECTION_ESTABLISHMENT_PROC 663 - 0x20: GAP_SELECTIVE_CONNECTION_ESTABLISHMENT_PROC 664 - 0x40: GAP_DIRECT_CONNECTION_ESTABLISHMENT_PROC 665 - 0x80: GAP_OBSERVATION_PROC 666 * @param Status Status error code. 667 * @param Data_Length Length of Data in octets 668 * @param Data Procedure Specific Data: 669 - For Name Discovery Procedure: the name of the peer device if the procedure completed successfully. 670 * @retval None 671 */ 672 WEAK_FUNCTION(void aci_gap_proc_complete_event(uint8_t Procedure_Code, 673 uint8_t Status, 674 uint8_t Data_Length, 675 uint8_t Data[])); 676 /** 677 * @brief This event is sent only by a privacy enabled Peripheral. The event is sent to the 678 upper layers when the peripheral is unsuccessful in resolving the resolvable 679 address of the peer device after connecting to it. 680 * @param Connection_Handle Connection handle for which the private address could not be 681 resolved with any of the stored IRK's. 682 * @retval None 683 */ 684 WEAK_FUNCTION(void aci_gap_addr_not_resolved_event(uint16_t Connection_Handle)); 685 /** 686 * @brief This event is sent only during SC v.4.2 Pairing, when Numeric Comparison Association model is selected, in order to show the Numeric Value generated, and to ask for Confirmation to the User. When this event is received, the application has to respond with the 687 @ref aci_gap_numeric_comparison_resp command. 688 * @param Connection_Handle Connection handle related to the underlying Pairing 689 * @param Numeric_Value 690 * @retval None 691 */ 692 WEAK_FUNCTION(void aci_gap_numeric_comparison_value_event(uint16_t Connection_Handle, 693 uint32_t Numeric_Value)); 694 /** 695 * @brief This event is sent only during SC v.4.2 Pairing, when Keypress Notifications are supported, in order to show the input type signalled by the peer device, having Keyboard only I/O capabilities. When this event is received, no action is required to the User. 696 * @param Connection_Handle Connection handle related to the underlying Pairing 697 * @param Notification_Type Type of Keypress input notified/signaled by peer device (having Keyboard only I/O capabilities 698 * @retval None 699 */ 700 WEAK_FUNCTION(void aci_gap_keypress_notification_event(uint16_t Connection_Handle, 701 uint8_t Notification_Type)); 702 /** 703 * @} 704 */ 705 /** 706 *@defgroup ACI_GATT_ATT_events ACI GATT/ATT events 707 *@brief ACI GATT/ATT events layer. 708 *@{ 709 */ 710 /* ACI GATT/ATT events */ 711 /** 712 * @brief This event is generated to the application by the GATT server when a client modifies any 713 attribute on the server, as consequence of one of the following GATT procedures: 714 - write without response 715 - signed write without response 716 - write characteristic value 717 - write long characteristic value 718 - reliable write. 719 * @param Connection_Handle The connection handle which modified the attribute. 720 * @param Attr_Handle Handle of the attribute that was modified. 721 * @param Offset Bits 14-0: offset from which the write has been performed by the peer device. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). 722 * @param Attr_Data_Length Length of Attr_Data in octets 723 * @param Attr_Data The modified value 724 * @retval None 725 */ 726 WEAK_FUNCTION(void aci_gatt_attribute_modified_event(uint16_t Connection_Handle, 727 uint16_t Attr_Handle, 728 uint16_t Offset, 729 uint16_t Attr_Data_Length, 730 uint8_t Attr_Data[])); 731 /** 732 * @brief This event is generated by the client/server to the application on a GATT timeout (30 733 seconds). This is a critical event that should not happen during normal operating conditions. It is an indication of either a major disruption in the communication link or a mistake in the application which does not provide a reply to GATT procedures. After this event, the GATT channel is closed and no more GATT communication can be performed. The applications is exptected to issue an @ref aci_gap_terminate to disconnect from the peer device. It is important to leave an 100 ms blank window before sending the @ref aci_gap_terminate, since immediately after this event, system could save important information in non volatile memory. 734 * @param Connection_Handle Connection handle on which the GATT procedure has timed out 735 * @retval None 736 */ 737 WEAK_FUNCTION(void aci_gatt_proc_timeout_event(uint16_t Connection_Handle)); 738 /** 739 * @brief This event is generated in response to an Exchange MTU request. See 740 @ref aci_gatt_exchange_config. 741 * @param Connection_Handle Connection handle related to the response. 742 * Values: 743 - 0x0000 ... 0x0EFF 744 * @param Server_RX_MTU Attribute server receive MTU size 745 * @retval None 746 */ 747 WEAK_FUNCTION(void aci_att_exchange_mtu_resp_event(uint16_t Connection_Handle, 748 uint16_t Server_RX_MTU)); 749 /** 750 * @brief This event is generated in response to a Find Information Request. See 751 @ref aci_att_find_info_req and Find Information Response in Bluetooth Core v5.0 752 spec. This event is also generated in response to @ref aci_gatt_disc_all_char_desc 753 * @param Connection_Handle Connection handle related to the response. 754 * Values: 755 - 0x0000 ... 0x0EFF 756 * @param Format Format of the hanndle-uuid pairs 757 * @param Event_Data_Length Length of Handle_UUID_Pair in octets 758 * @param Handle_UUID_Pair A sequence of handle-uuid pairs. if format=1, each pair is:[2 octets for handle, 2 octets for UUIDs], if format=2, each pair is:[2 octets for handle, 16 octets for UUIDs] 759 * @retval None 760 */ 761 WEAK_FUNCTION(void aci_att_find_info_resp_event(uint16_t Connection_Handle, 762 uint8_t Format, 763 uint8_t Event_Data_Length, 764 uint8_t Handle_UUID_Pair[])); 765 /** 766 * @brief This event is generated in response to a @ref aci_att_find_by_type_value_req 767 * @param Connection_Handle Connection handle related to the response. 768 * Values: 769 - 0x0000 ... 0x0EFF 770 * @param Num_of_Handle_Pair Number of attribute, group handle pairs 771 * @param Attribute_Group_Handle_Pair See @ref Attribute_Group_Handle_Pair_t 772 * @retval None 773 */ 774 WEAK_FUNCTION(void aci_att_find_by_type_value_resp_event(uint16_t Connection_Handle, 775 uint8_t Num_of_Handle_Pair, 776 Attribute_Group_Handle_Pair_t Attribute_Group_Handle_Pair[])); 777 /** 778 * @brief This event is generated in response to a @ref aci_att_read_by_type_req. See 779 @ref aci_gatt_find_included_services and @ref aci_gatt_disc_all_char_desc. 780 * @param Connection_Handle Connection handle related to the response. 781 * Values: 782 - 0x0000 ... 0x0EFF 783 * @param Handle_Value_Pair_Length The size of each attribute handle-value pair 784 * @param Data_Length Length of Handle_Value_Pair_Data in octets 785 * @param Handle_Value_Pair_Data Attribute Data List as defined in Bluetooth Core v5.0 spec. A sequence of handle-value pairs: [2 octets for Attribute Handle, (Handle_Value_Pair_Length - 2 octets) for Attribute Value] 786 * @retval None 787 */ 788 WEAK_FUNCTION(void aci_att_read_by_type_resp_event(uint16_t Connection_Handle, 789 uint8_t Handle_Value_Pair_Length, 790 uint8_t Data_Length, 791 uint8_t Handle_Value_Pair_Data[])); 792 /** 793 * @brief This event is generated in response to a Read Request. See @ref aci_gatt_read_char_value. 794 * @param Connection_Handle Connection handle related to the response. 795 * Values: 796 - 0x0000 ... 0x0EFF 797 * @param Event_Data_Length Length of following data 798 * @param Attribute_Value The value of the attribute. 799 * @retval None 800 */ 801 WEAK_FUNCTION(void aci_att_read_resp_event(uint16_t Connection_Handle, 802 uint8_t Event_Data_Length, 803 uint8_t Attribute_Value[])); 804 /** 805 * @brief This event can be generated during a read long characteristic value procedure. See @ref aci_gatt_read_long_char_value. 806 * @param Connection_Handle Connection handle related to the response. 807 * Values: 808 - 0x0000 ... 0x0EFF 809 * @param Event_Data_Length Length of following data 810 * @param Attribute_Value Part of the attribute value. 811 * @retval None 812 */ 813 WEAK_FUNCTION(void aci_att_read_blob_resp_event(uint16_t Connection_Handle, 814 uint8_t Event_Data_Length, 815 uint8_t Attribute_Value[])); 816 /** 817 * @brief This event is generated in response to a Read Multiple Request. 818 * @param Connection_Handle Connection handle related to the response. 819 * Values: 820 - 0x0000 ... 0x0EFF 821 * @param Event_Data_Length Length of following data 822 * @param Set_Of_Values A set of two or more values. 823 A concatenation of attribute values for each of the attribute handles in the request in the order that they were requested. 824 * @retval None 825 */ 826 WEAK_FUNCTION(void aci_att_read_multiple_resp_event(uint16_t Connection_Handle, 827 uint8_t Event_Data_Length, 828 uint8_t Set_Of_Values[])); 829 /** 830 * @brief This event is generated in response to a Read By Group Type Request. See 831 @ref aci_gatt_disc_all_primary_services. 832 * @param Connection_Handle Connection handle related to the response. 833 * Values: 834 - 0x0000 ... 0x0EFF 835 * @param Attribute_Data_Length The size of each attribute data 836 * @param Data_Length Length of Attribute_Data_List in octets 837 * @param Attribute_Data_List Attribute Data List as defined in Bluetooth Core v5.0 spec. A sequence of attribute handle, end group handle, attribute value tuples: [2 octets for Attribute Handle, 2 octets End Group Handle, (Attribute_Data_Length - 4 octets) for Attribute Value] 838 * @retval None 839 */ 840 WEAK_FUNCTION(void aci_att_read_by_group_type_resp_event(uint16_t Connection_Handle, 841 uint8_t Attribute_Data_Length, 842 uint8_t Data_Length, 843 uint8_t Attribute_Data_List[])); 844 /** 845 * @brief This event is generated in response to a @ref aci_att_prepare_write_req. 846 * @param Connection_Handle Connection handle related to the response. 847 * Values: 848 - 0x0000 ... 0x0EFF 849 * @param Attribute_Handle The handle of the attribute to be written 850 * @param Offset The offset of the first octet to be written. 851 * @param Part_Attribute_Value_Length Length of Part_Attribute_Value in octets 852 * @param Part_Attribute_Value The value of the attribute to be written 853 * @retval None 854 */ 855 WEAK_FUNCTION(void aci_att_prepare_write_resp_event(uint16_t Connection_Handle, 856 uint16_t Attribute_Handle, 857 uint16_t Offset, 858 uint8_t Part_Attribute_Value_Length, 859 uint8_t Part_Attribute_Value[])); 860 /** 861 * @brief This event is generated in response to an Execute Write Request. 862 * @param Connection_Handle Connection handle related to the response. 863 * Values: 864 - 0x0000 ... 0x0EFF 865 * @retval None 866 */ 867 WEAK_FUNCTION(void aci_att_exec_write_resp_event(uint16_t Connection_Handle)); 868 /** 869 * @brief This event is generated when an indication is received from the server. 870 * @param Connection_Handle Connection handle related to the response. 871 * Values: 872 - 0x0000 ... 0x0EFF 873 * @param Attribute_Handle The handle of the attribute 874 * @param Attribute_Value_Length Length of Attribute_Value in octets 875 * @param Attribute_Value The current value of the attribute 876 * @retval None 877 */ 878 WEAK_FUNCTION(void aci_gatt_indication_event(uint16_t Connection_Handle, 879 uint16_t Attribute_Handle, 880 uint8_t Attribute_Value_Length, 881 uint8_t Attribute_Value[])); 882 /** 883 * @brief This event is generated when a notification is received from the server. 884 * @param Connection_Handle Connection handle related to the response. 885 * Values: 886 - 0x0000 ... 0x0EFF 887 * @param Attribute_Handle The handle of the attribute 888 * @param Attribute_Value_Length Length of Attribute_Value in octets 889 * @param Attribute_Value The current value of the attribute 890 * @retval None 891 */ 892 WEAK_FUNCTION(void aci_gatt_notification_event(uint16_t Connection_Handle, 893 uint16_t Attribute_Handle, 894 uint8_t Attribute_Value_Length, 895 uint8_t Attribute_Value[])); 896 /** 897 * @brief This event is generated when a GATT client procedure completes either with error or 898 successfully. 899 * @param Connection_Handle Connection handle related to the response. 900 * Values: 901 - 0x0000 ... 0x0EFF 902 * @param Error_Code Indicates whether the procedure completed with an error or was successful 903 * Values: 904 - 0x00: Success 905 - 0x01: Unknown HCI Command 906 - 0x02: Unknown Connection Identifier 907 - 0x03: Hardware Failure 908 - 0x05: Authentication Failure 909 - 0x06: PIN or Key Missing 910 - 0x07: Memory Capacity Exceeded 911 - 0x08: Connection Timeout 912 - 0x09: Connection Limit Exceeded 913 - 0x0B: ACL Connection Already Exists 914 - 0x0C: Command Disallowed 915 - 0x0D: Connection Rejected Due To Limited Resources 916 - 0x0E: Connection Rejected Due To Security Reasons 917 - 0x0F: Connection Rejected due to Unacceptable BD_ADDR 918 - 0x10: Connection Accept Timeout Exceeded 919 - 0x11: Unsupported Feature Or Parameter Value 920 - 0x12: Invalid HCI Command Parameters 921 - 0x13: Remote User Terminated Connection 922 - 0x14: Remote Device Terminated Connection due to Low Resources 923 - 0x15: Remote Device Terminated Connection due to Power Off 924 - 0x16: Connection Terminated By Local Host 925 - 0x17: Repeated Attempts 926 - 0x18: Pairing Not Allowed 927 - 0x19: Unknown LMP PDU 928 - 0x1A: Unsupported Remote Feature / Unsupported LMP Feature 929 - 0x1E: Invalid LMP Parameters 930 - 0x1F: Unspecified Error 931 - 0x20: Unsupported LMP Parameter Value 932 - 0x21: Role Change Not Allowed 933 - 0x22: LMP Response Timeout / LL Response Timeout 934 - 0x23: LMP Error Transaction Collision 935 - 0x24: LMP PDU Not Allowed 936 - 0x25: Encryption Mode Not Acceptable 937 - 0x26: Link Key cannot be Changed 938 - 0x28: Instant Passed 939 - 0x29: Pairing With Unit Key Not Supported 940 - 0x2A: Different Transaction Collision 941 - 0x2E: Channel Assessment Not Supported 942 - 0x2F: Insufficient Security 943 - 0x30: Parameter Out Of Mandatory Range 944 - 0x32: Role Switch Pending 945 - 0x34: Reserved Slot Violation 946 - 0x35: Role Switch Failed 947 - 0x37: Secure Simple Pairing Not Supported by Host 948 - 0x38: Host Busy - Pairing 949 - 0x39: Connection Rejected due to No Suitable Channel Found 950 - 0x3A: Controller Busy 951 - 0x3B: Unacceptable Connection Interval 952 - 0x3C: Directed Advertising Timeout 953 - 0x3D: Connection Terminated Due to MIC Failure 954 - 0x3E: Connection Failed to be Established 955 - 0x41: Failed 956 - 0x42: Invalid parameters 957 - 0x43: Busy 958 - 0x44: Invalid length 959 - 0x45: Pending 960 - 0x46: Not allowed 961 - 0x47: GATT error 962 - 0x48: Address not resolved 963 - 0x50: Invalid CID 964 - 0x5A: CSRK not found 965 - 0x5B: IRK not found 966 - 0x5C: Device not found in DB 967 - 0x5D: Security DB full 968 - 0x5E: Device not bonded 969 - 0x5F: Device in blacklist 970 - 0x60: Invalid handle 971 - 0x61: Invalid parameter 972 - 0x62: Out of handles 973 - 0x63: Invalid operation 974 - 0x64: Insufficient resources 975 - 0x65: Insufficient encryption key size 976 - 0x66: Characteristic already exist 977 - 0x82: No valid slot 978 - 0x83: Short window 979 - 0x84: New interval failed 980 - 0x85: Too large interval 981 - 0x86: Slot length failed 982 * @retval None 983 */ 984 WEAK_FUNCTION(void aci_gatt_proc_complete_event(uint16_t Connection_Handle, 985 uint8_t Error_Code)); 986 /** 987 * @brief This event is generated when an Error Response is received from the server. The error 988 response can be given by the server at the end of one of the GATT discovery procedures. 989 This does not mean that the procedure ended with an error, but this error event is part of the 990 procedure itself. 991 * @param Connection_Handle Connection handle related to the response. 992 * Values: 993 - 0x0000 ... 0x0EFF 994 * @param Req_Opcode The request that generated this error response 995 * @param Attribute_Handle The attribute handle that generated this error response 996 * @param Error_Code The reason why the request has generated an error response (ATT error codes) 997 * Values: 998 - 0x01: Invalid handle 999 - 0x02: Read not permitted 1000 - 0x03: Write not permitted 1001 - 0x04: Invalid PDU 1002 - 0x05: Insufficient authentication 1003 - 0x06: Request not supported 1004 - 0x07: Invalid offset 1005 - 0x08: Insufficient authorization 1006 - 0x09: Prepare queue full 1007 - 0x0A: Attribute not found 1008 - 0x0B: Attribute not long 1009 - 0x0C: Insufficient encryption key size 1010 - 0x0D: Invalid attribute value length 1011 - 0x0E: Unlikely error 1012 - 0x0F: Insufficient encryption 1013 - 0x10: Unsupported group type 1014 - 0x11: Insufficient resources 1015 * @retval None 1016 */ 1017 WEAK_FUNCTION(void aci_gatt_error_resp_event(uint16_t Connection_Handle, 1018 uint8_t Req_Opcode, 1019 uint16_t Attribute_Handle, 1020 uint8_t Error_Code)); 1021 /** 1022 * @brief This event can be generated during a "Discover Characteristics By UUID" procedure or a 1023 "Read using Characteristic UUID" procedure. 1024 The attribute value will be a service declaration as defined in Bluetooth Core v5.0.spec 1025 (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. It will 1026 be the value of the Characteristic if a* "Read using Characteristic UUID" has been 1027 performed. 1028 * @param Connection_Handle Connection handle related to the response. 1029 * Values: 1030 - 0x0000 ... 0x0EFF 1031 * @param Attribute_Handle The handle of the attribute 1032 * @param Attribute_Value_Length Length of Attribute_Value in octets 1033 * @param Attribute_Value The attribute value will be a service declaration as defined in Bluetooth Core v5.0 spec 1034 (vol.3, Part G, ch. 3.3.1), when a "Discover Characteristics By UUID" has been started. 1035 It will be the value of the Characteristic if a "Read using Characteristic UUID" has been performed. 1036 * @retval None 1037 */ 1038 WEAK_FUNCTION(void aci_gatt_disc_read_char_by_uuid_resp_event(uint16_t Connection_Handle, 1039 uint16_t Attribute_Handle, 1040 uint8_t Attribute_Value_Length, 1041 uint8_t Attribute_Value[])); 1042 /** 1043 * @brief This event is given to the application when a write request, write command or signed write 1044 command is received by the server from the client. This event will be given to the application 1045 only if the event bit for this event generation is set when the characteristic was added. 1046 When this event is received, the application has to check whether the value being requested 1047 for write can be allowed to be written and respond with the command @ref aci_gatt_write_resp. 1048 The details of the parameters of the command can be found. Based on the response from 1049 the application, the attribute value will be modified by the stack. If the write is rejected by the 1050 application, then the value of the attribute will not be modified. In case of a write REQ, an 1051 error response will be sent to the client, with the error code as specified by the application. 1052 In case of write/signed write commands, no response is sent to the client but the attribute is 1053 not modified. 1054 * @param Connection_Handle Handle of the connection on which there was the request to write the attribute 1055 * @param Attribute_Handle The handle of the attribute 1056 * @param Data_Length Length of Data field 1057 * @param Data The data that the client has requested to write 1058 * @retval None 1059 */ 1060 WEAK_FUNCTION(void aci_gatt_write_permit_req_event(uint16_t Connection_Handle, 1061 uint16_t Attribute_Handle, 1062 uint8_t Data_Length, 1063 uint8_t Data[])); 1064 /** 1065 * @brief This event is given to the application when a read request or read blob request is received 1066 by the server from the client. This event will be given to the application only if the event bit 1067 for this event generation is set when the characteristic was added. 1068 On receiving this event, the application can update the value of the handle if it desires and 1069 when done, it has to send the @ref aci_gatt_allow_read command to indicate to the stack that it 1070 can send the response to the client. 1071 * @param Connection_Handle Connection handle related to the response. 1072 * Values: 1073 - 0x0000 ... 0x0EFF 1074 * @param Attribute_Handle The handle of the attribute 1075 * @param Offset Contains the offset from which the read has been requested 1076 * @retval None 1077 */ 1078 WEAK_FUNCTION(void aci_gatt_read_permit_req_event(uint16_t Connection_Handle, 1079 uint16_t Attribute_Handle, 1080 uint16_t Offset)); 1081 /** 1082 * @brief This event is given to the application when a read multiple request or read by type request is 1083 received by the server from the client. This event will be given to the application only if the 1084 event bit for this event generation is set when the characteristic was added. 1085 On receiving this event, the application can update the values of the handles if it desires and 1086 when done, it has to send the @ref aci_gatt_allow_read command to indicate to the stack that it 1087 can send the response to the client. 1088 * @param Connection_Handle Handle of the connection which requested to read the attribute 1089 * @param Number_of_Handles 1090 * @param Handle_Item See @ref Handle_Item_t 1091 * @retval None 1092 */ 1093 WEAK_FUNCTION(void aci_gatt_read_multi_permit_req_event(uint16_t Connection_Handle, 1094 uint8_t Number_of_Handles, 1095 Handle_Item_t Handle_Item[])); 1096 /** 1097 * @brief Each time BLE FW stack raises the error code 1098 BLE_STATUS_INSUFFICIENT_RESOURCES (0x64), the 1099 @ref aci_gatt_tx_pool_available_event event is generated as soon as there are at least two 1100 buffers available for notifications or write commands. 1101 * @param Connection_Handle Connection handle related to the request 1102 * @param Available_Buffers Number of buffers available 1103 * @retval None 1104 */ 1105 WEAK_FUNCTION(void aci_gatt_tx_pool_available_event(uint16_t Connection_Handle, 1106 uint16_t Available_Buffers)); 1107 /** 1108 * @brief This event is generated when the client has sent the confirmation to a previously sent indication 1109 * @param Connection_Handle Connection handle related to the event 1110 * @retval None 1111 */ 1112 WEAK_FUNCTION(void aci_gatt_server_confirmation_event(uint16_t Connection_Handle)); 1113 /** 1114 * @brief This event is given to the application when a prepare write request 1115 is received by the server from the client. This event will be given to the application 1116 only if the event bit for this event generation is set when the characteristic was added. 1117 When this event is received, the application has to check whether the value being requested 1118 for write can be allowed to be written and respond with the command @ref aci_gatt_write_resp. 1119 Based on the response from the application, the attribute value will be modified by the stack. 1120 If the write is rejected by the application, then the value of the attribute will not be modified 1121 and an error response will be sent to the client, with the error code as specified by the application. 1122 * @param Connection_Handle Handle of the connection on which there was the request to write the attribute 1123 * @param Attribute_Handle The handle of the attribute 1124 * @param Offset The offset from which the prepare write has been requested 1125 * @param Data_Length Length of Data field 1126 * @param Data The data that the client has requested to write 1127 * @retval None 1128 */ 1129 WEAK_FUNCTION(void aci_gatt_prepare_write_permit_req_event(uint16_t Connection_Handle, 1130 uint16_t Attribute_Handle, 1131 uint16_t Offset, 1132 uint8_t Data_Length, 1133 uint8_t Data[])); 1134 /** 1135 * @brief When it is enabled with ACI_GATT_SET_EVENT_MASK and when an indication is received from the server, this event is generated instead of ACI_GATT_INDICATION_EVENT. 1136 This event should be used instead of ACI_GATT_INDICATION_EVENT when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) 1137 i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value. 1138 1139 * @param Connection_Handle Connection handle related to the response. 1140 * Values: 1141 - 0x0000 ... 0x0EFF 1142 * @param Attribute_Handle The handle of the attribute 1143 * @param Offset Bits 14-0: offset in octets from which Attribute_Value data starts. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). 1144 * @param Attribute_Value_Length Length of Attribute_Value in octets 1145 * @param Attribute_Value The current value of the attribute 1146 * @retval None 1147 */ 1148 WEAK_FUNCTION(void aci_gatt_indication_ext_event(uint16_t Connection_Handle, 1149 uint16_t Attribute_Handle, 1150 uint16_t Offset, 1151 uint16_t Attribute_Value_Length, 1152 uint8_t Attribute_Value[])); 1153 /** 1154 * @brief When it is enabled with ACI_GATT_SET_EVENT_MASK and when a notification is received from the server, this event is generated instead of ACI_GATT_NOTIFICATION_EVENT. 1155 This event should be used instead of ACI_GATT_NOTIFICATION_EVENT when ATT_MTU > (BLE_EVT_MAX_PARAM_LEN - 4) 1156 i.e. ATT_MTU > 251 for BLE_EVT_MAX_PARAM_LEN default value. 1157 1158 * @param Connection_Handle Connection handle related to the response. 1159 * Values: 1160 - 0x0000 ... 0x0EFF 1161 * @param Attribute_Handle The handle of the attribute 1162 * @param Offset Bits 14-0: offset in octets from which Attribute_Value data starts. Bit 15 is used as flag: when set to 1 it indicates that more data are to come (fragmented event in case of long attribute data). 1163 * @param Attribute_Value_Length Length of Attribute_Value in octets 1164 * @param Attribute_Value The current value of the attribute 1165 * @retval None 1166 */ 1167 WEAK_FUNCTION(void aci_gatt_notification_ext_event(uint16_t Connection_Handle, 1168 uint16_t Attribute_Handle, 1169 uint16_t Offset, 1170 uint16_t Attribute_Value_Length, 1171 uint8_t Attribute_Value[])); 1172 /** 1173 * @} 1174 */ 1175 /** 1176 *@defgroup ACI_L2CAP_events ACI L2CAP events 1177 *@brief ACI L2CAP events layer. 1178 *@{ 1179 */ 1180 /* ACI L2CAP events */ 1181 /** 1182 * @brief This event is generated when the master responds to the connection update request packet 1183 with a connection update response packet. 1184 * @param Connection_Handle Connection handle referring to the COS Channel where the Disconnection has been received. 1185 * @param Result 1186 * @retval None 1187 */ 1188 WEAK_FUNCTION(void aci_l2cap_connection_update_resp_event(uint16_t Connection_Handle, 1189 uint16_t Result)); 1190 /** 1191 * @brief This event is generated when the master does not respond to the connection update 1192 request packet with a connection update response packet or a command reject packet 1193 within 30 seconds. 1194 * @param Connection_Handle Handle of the connection related to this L2CAP procedure. 1195 * @param Data_Length Length of following data 1196 * @param Data 1197 * @retval None 1198 */ 1199 WEAK_FUNCTION(void aci_l2cap_proc_timeout_event(uint16_t Connection_Handle, 1200 uint8_t Data_Length, 1201 uint8_t Data[])); 1202 /** 1203 * @brief The event is given by the L2CAP layer when a connection update request is received from 1204 the slave. The upper layer which receives this event has to respond by sending a 1205 @ref aci_l2cap_connection_parameter_update_resp command. 1206 * @param Connection_Handle Handle of the connection related to this L2CAP procedure. 1207 * @param Identifier This is the identifier which associate the request to the response. 1208 * @param L2CAP_Length Length of the L2CAP connection update request. 1209 * @param Interval_Min Minimum value for the connection event interval. This shall be less 1210 than or equal to Conn_Interval_Max. 1211 Time = N * 1.25 msec. 1212 * Values: 1213 - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) 1214 * @param Interval_Max Maximum value for the connection event interval. This shall be 1215 greater than or equal to Conn_Interval_Min. 1216 Time = N * 1.25 msec. 1217 * Values: 1218 - 0x0006 (7.50 ms) ... 0x0C80 (4000.00 ms) 1219 * @param Slave_Latency Slave latency for the connection in number of connection events. 1220 * Values: 1221 - 0x0000 ... 0x01F3 1222 * @param Timeout_Multiplier Defines connection timeout parameter in the following manner: Timeout Multiplier * 10ms. 1223 * @retval None 1224 */ 1225 WEAK_FUNCTION(void aci_l2cap_connection_update_req_event(uint16_t Connection_Handle, 1226 uint8_t Identifier, 1227 uint16_t L2CAP_Length, 1228 uint16_t Interval_Min, 1229 uint16_t Interval_Max, 1230 uint16_t Slave_Latency, 1231 uint16_t Timeout_Multiplier)); 1232 /** 1233 * @brief This event is generated when the master responds to the connection update request packet 1234 with a command reject packet. 1235 * @param Connection_Handle Connection handle referring to the COS Channel where the Disconnection has been received. 1236 * @param Identifier This is the identifier which associate the request to the response. 1237 * @param Reason Reason 1238 * @param Data_Length Length of following data 1239 * @param Data Data field associated with Reason 1240 * @retval None 1241 */ 1242 WEAK_FUNCTION(void aci_l2cap_command_reject_event(uint16_t Connection_Handle, 1243 uint8_t Identifier, 1244 uint16_t Reason, 1245 uint8_t Data_Length, 1246 uint8_t Data[])); 1247 /** 1248 * @} 1249 */ 1250 /** 1251 *@defgroup ACI_HAL_events ACI HAL events 1252 *@brief ACI HAL events layer. 1253 *@{ 1254 */ 1255 /* ACI HAL events */ 1256 /** 1257 * @brief 'This event is generated when the device completes a radio activity and provide information when a new radio acitivity will be performed. 1258 Informtation provided includes type of radio activity and absolute time in system ticks when a new radio acitivity is schedule, if any. Application can use this information to schedule user activities synchronous to selected radio activitities. A command @ref aci_hal_set_radio_activity_mask is provided to enable radio activity events of user interests, by default no events are enabled. 1259 User should take into account that enablinng radio events in application with intense radio activity could lead to a fairly high rate of events generated. 1260 Application use cases includes synchronizing notification with connection interval, switiching antenna at the end of advertising or performing flash erase operation while radio is idle. 1261 * @param Last_State Completed radio events 1262 * Values: 1263 - 0x00: Idle 1264 - 0x01: Advertising 1265 - 0x02: Connection event slave 1266 - 0x03: Scanning 1267 - 0x04: Connection request 1268 - 0x05: Connection event slave 1269 - 0x06: TX test mode 1270 - 0x07: RX test mode 1271 * @param Next_State Incoming radio events 1272 * Values: 1273 - 0x00: Idle 1274 - 0x01: Advertising 1275 - 0x02: Connection event slave 1276 - 0x03: Scanning 1277 - 0x04: Connection request 1278 - 0x05: Connection event slave 1279 - 0x06: TX test mode 1280 - 0x07: RX test mode 1281 * @param Next_State_SysTime 32bit absolute current time expressed in internal time units. 1282 * @retval None 1283 */ 1284 WEAK_FUNCTION(void aci_hal_end_of_radio_activity_event(uint8_t Last_State, 1285 uint8_t Next_State, 1286 uint32_t Next_State_SysTime)); 1287 /** 1288 * @brief This event is reported to the application after a scan request is received and a scan reponse 1289 is scheduled to be transmitted. 1290 * @param RSSI N Size: 1 Octet (signed integer) 1291 Units: dBm 1292 * Values: 1293 - 127: RSSI not available 1294 - -127 ... 20 1295 * @param Peer_Address_Type 0x00 Public Device Address 1296 0x01 Random Device Address 1297 0x02 Public Identity Address (Corresponds to Resolved Private Address) 1298 0x03 Random (Static) Identity Address (Corresponds to Resolved Private Address) 1299 * Values: 1300 - 0x00: Public Device Address 1301 - 0x01: Random Device Address 1302 - 0x02: Public Identity Address 1303 - 0x03: Random (Static) Identity Address 1304 * @param Peer_Address Public Device Address or Random Device Address of the peer device 1305 * @retval None 1306 */ 1307 WEAK_FUNCTION(void aci_hal_scan_req_report_event(uint8_t RSSI, 1308 uint8_t Peer_Address_Type, 1309 uint8_t Peer_Address[6])); 1310 /** 1311 * @brief This event is generated to report firmware error informations. 1312 * @param FW_Error_Type FW Error type 1313 * Values: 1314 - 0x01: L2CAP recombination failure 1315 - 0x02: GATT UNEXPECTED RESPONSE ERROR 1316 - 0x03: NVM LEVEL WARNING 1317 * @param Data_Length Length of Data in octets 1318 * @param Data The error event info 1319 * @retval None 1320 */ 1321 WEAK_FUNCTION(void aci_hal_fw_error_event(uint8_t FW_Error_Type, 1322 uint8_t Data_Length, 1323 uint8_t Data[])); 1324 /** 1325 * @} 1326 */ 1327 1328 #endif /* ! BLE_EVENTS_H__ */ 1329