BLE Common Events

group group_ble_common_api_events

The BLE Stack generates events to notify the application on various status alerts concerning the stack.

These can be generic stack events or can be specific to GAP, GATT or L2CAP layers. The service specific events are handled separately in BLE Service-Specific Events.

Enums

enum cy_en_ble_event_t

cy_en_ble_event_t: BLE stack events.

Values:

enumerator CY_BLE_EVT_INVALID

This event is triggered by the BLE stack when the BLE Stack is in a bad state.

Restarting the BLE Stack is the only way to get out of this state

enumerator CY_BLE_EVT_STACK_ON

This event is received when the BLE stack is initialized and turned ON by invoking the Cy_BLE_StackInit() function.

enumerator CY_BLE_EVT_TIMEOUT

This event is received when there is a timeout and the application must handle the event.

Event parameter is of type ‘cy_stc_ble_timeout_param_t’.

  • If reasonCode is ‘CY_BLE_GATT_RSP_TO’, then look for connHandle.

  • If reasonCode is ‘CY_BLE_GENERIC_APP_TO’, then look for timerHandle.

  • For all other cases connHandle or timerHandle is ignored

enumerator CY_BLE_EVT_STACK_BUSY_STATUS

This event is triggered by BLE Stack to indicate if the BLE stack is busy or not.

The Event Parameter corresponding to this event will indicate the state of BLE stack’s internal protocol buffers for the application to safely initiate data transactions (GATT, GAP Security, and L2CAP transactions) with the peer BLE device. Event parameter is of type cy_stc_ble_l2cap_state_info_t. cy_stc_ble_l2cap_state_info_t contains flowState and Bd handle as parameters flowState indicates the following state: CY_BLE_STACK_STATE_BUSY (0x01) = CY_BLE_STACK_STATE_BUSY indicates to the application that the BLE Stack’s internal buffers are about to be filled, and the remaining buffers are required to respond to the peer BLE device. After this event, the application shall not initiate GATT, GAP Security, or L2CAP data transactions. However, the application shall respond to peer initiated transactions to prevent BLE protocol timeouts. Application initiated data transactions can be resumed after the CY_BLE_EVT_STACK_BUSY_STATUS event with parameter ‘CY_BLE_STACK_STATE_FREE’ is received.

CY_BLE_STACK_STATE_FREE (0x00) = CY_BLE_STACK_STATE_FREE indicates to the application that pending transactions are completed and sufficient buffers are available to process application-initiated transactions. The ‘CY_BLE_EVT_STACK_BUSY_STATUS’ event with ‘CY_BLE_STACK_STATE_FREE’ indicates to the application whether the BLE Stack’s internal buffer state has transitioned from ‘CY_BLE_STACK_STATE_BUSY’ to ‘CY_BLE_STACK_STATE_FREE’.

Bd handle indicates connection. To increase the BLE Stack’s default queue depth(CY_BLE_L2CAP_STACK_Q_DEPTH_PER_CONN) and achieve better throughput for the attribute MTU greater than 32, use the AddQdepthPerConn parameter in the ‘Expression View’ of the Advanced tab in the BLE component GUI. To Access the ‘Expression View’, right click on the ‘Advanced’ tab in th BLE Component GUI and select the ‘Show Expression View’ option.

enumerator CY_BLE_EVT_MEMORY_REQUEST

This event is received when the BLE Stack wants the application to provide memory to process a remote request.

The event parameter is of type cy_stc_ble_memory_request_t. This event is automatically handled by the BLE Component for the CY_BLE_PREPARED_WRITE_REQUEST request. The BLE Component allocates sufficient memory for the long write request with the assumption that attribute MTU size is negotiated to the minimum possible value. The application could use dynamic memory allocation to save static RAM memory consumption. To enable this event for the application level, set the EnableExternalPrepWriteBuff parameter in the Expression view of the Advanced tab to be true.

enumerator CY_BLE_EVT_PENDING_FLASH_WRITE

This event is used to inform the application that a Flash write is pending.

This event is generated by the BLE Stack whenever its internal data structures are modified and require back up.

enumerator CY_BLE_EVT_FLASH_CORRUPT

This event is used to inform the application that persistent data stored in Flash memory is corrupted.

enumerator CY_BLE_EVT_HARDWARE_ERROR

This event indicates that some internal hardware error has occurred.

Reset of the hardware may be required. Event parameter returned with this event is of (uint8 *) type. The possible error codes for this event are defined in cy_ble_stack_host_error.h file.

enumerator CY_BLE_EVT_WRITE_AUTH_PAYLOAD_TO_COMPLETE

This event is triggered on successful setting of Authentication Payload timeout in the BLE Stack for LE_PING feature.

Refer to Bluetooth 4.1 core specification, Volume 6, Part B, section 4.6.5 for LE Ping operation. Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t *) to access the pointer to the bdHandle corresponding to this event. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_READ_AUTH_PAYLOAD_TO_COMPLETE

This event carries Authentication Payload timeout in the BLE Stack for the LE_PING feature.

Refer to Bluetooth 4.1 core specification, Volume 6, Part B, section 4.6.5 for LE Ping operation. Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_auth_payload_info_t*) to access the authentication payload information. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_GET_CHANNEL_MAP_COMPLETE

This event indicates a channel map corresponding to one connection.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_channel_map_info_t*) to access Channel Map Parameters Information. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_LE_SET_EVENT_MASK_COMPLETE

This event indicates completion of the Set LE event mask.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_LE_PING_AUTH_TIMEOUT

This event indicates that the peer device has not responded with the valid MIC packet within the application configured ping authentication time.

enumerator CY_BLE_EVT_SET_DATA_LENGTH_COMPLETE

This event indicates completion of the Set data length command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t *) to access the pointer to the bdHandle corresponding to this event. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_SET_SUGGESTED_DATA_LENGTH_COMPLETE

This event indicates completion of Set suggested data length command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_GET_DATA_LENGTH_COMPLETE

This event indicates completion of Cy_BLE_GetDataLength() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_data_length_param_t*) to access the locally suggested tx/rx octets and tx/rx time and the maximum supported tx/rx octets and tx/rx time. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_DATA_LENGTH_CHANGE

This event notifies the Host of a change to either the maximum Payload length or the maximum transmission time of Data Channel PDUs in either direction.

The values reported are the maximum that will actually be used on the connection following the change. The event parameter is of type ‘cy_stc_ble_data_length_change_event_param_t

enumerator CY_BLE_EVT_GET_PEER_RPA_COMPLETE

This event indicates peer resolvable private address currently used by the BLE Stack.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t*) to access the pointer to the peer resolvable address. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_GET_LOCAL_RPA_COMPLETE

This event indicates local resolvable private address currently used by the BLE Stack.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t*) to access the pointer to the local resolvable address. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_SET_RPA_TO_COMPLETE

This event indicates completion of the Set RPA timeout command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_SET_RPA_ENABLE_COMPLETE

This event indicates completion of Set RPA enable command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_SET_HOST_CHANNEL_COMPLETE

This event indicates completion of the Set host channel command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_ADD_DEVICE_TO_RPA_LIST_COMPLETE

This event indicates completion of the add device to Resolving List command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_REMOVE_DEVICE_FROM_RPA_LIST_COMPLETE

This event indicates completion of the remove device from Resolving List command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_ADD_DEVICE_TO_WHITE_LIST_COMPLETE

This event indicates completion of the add device to White List command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_REMOVE_DEVICE_FROM_WHITE_LIST_COMPLETE

This event indicates completion of the remove device from the White List command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_GET_PHY_COMPLETE

This event indicates completion of the Cy_BLE_GetPhy() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_phy_param_t*) type to access the TX and RX PHY Mask as well as the bdHandle corresponding to the connection for which this information is being returned. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_SET_DEFAULT_PHY_COMPLETE

This event indicates completion of the Cy_BLE_SetDefaultPhy() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_SET_PHY_COMPLETE

This event indicates completion of the Cy_BLE_SetPhy() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_PHY_UPDATE_COMPLETE

This event indicates that the Controller has changed the transmitter PHY or receiver PHY in use.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_phy_param_t*) type to access the TX and RX PHY Mask as well as the bdHandle corresponding to the connection for which this information is being returned. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_SET_PRIVACY_MODE_COMPLETE

This event indicates completion of the set privacy mode command.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_LL_CNTRL_PROC_PENDING_COMPLETE

This event indicates completion of the Cy_BLE_IsLlControlProcPending() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_ll_cntrl_proc_param_t*) type to access the status of the control procedure (cntrlProcStatus) as well as the bdHandle corresponding to the connection for which this information is being returned. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_SOFT_RESET_COMPLETE

This event indicates a soft reset completed successfully.

The event parameter is NULL.

enumerator CY_BLE_EVT_SET_DEVICE_ADDR_COMPLETE

This event indicates that the set device address command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_GET_DEVICE_ADDR_COMPLETE

This event indicates that the get device address command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_bd_addrs_t*) type to access the public and private Bluetooth Device Addresses. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_GET_RSSI_COMPLETE

This event indicates that the get RSSI command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_rssi_info_t*) type to access the RSSI value as well as the bdHandle corresponding to the connection for which this information is being returned. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_GET_TX_PWR_COMPLETE

This event indicates that the get Tx Power command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_tx_pwr_lvl_info_t*) type to access the TX power level eventParams is valid only if status is success (0x00) bdHandle is valid only if bleSsChId is CY_BLE_LL_CONN_CH_TYPE

enumerator CY_BLE_EVT_SET_TX_PWR_COMPLETE

This event indicates that the set Tx Power command has completed .

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_tx_pwr_config_param_t*) type to access the powerConfig. eventParams is valid only if status is success (0x00)

enumerator CY_BLE_EVT_GET_CLK_CONFIG_COMPLETE

This event indicates that the get clock config command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_bless_clk_cfg_params_t*) type to access the BLE clock configuration parameters. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_SET_CLK_CONFIG_COMPLETE

This event indicates that the set clock config command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_RANDOM_NUM_GEN_COMPLETE

This event indicates that the random number generation command has completed successfully.

The event parameter is Pointer to a buffer of size 8 bytes

enumerator CY_BLE_EVT_AES_ENCRYPT_COMPLETE

This event indicates that the AES encrypt command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t*) to access the pointer to the encrypted data (128-bit). eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_AES_CCM_ENCRYPT_COMPLETE

This event indicates that the AES CCM encrypt command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_aes_ccm_param_t*) type to access the AES CCM encrypted data information. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_AES_CCM_DECRYPT_COMPLETE

This event indicates that the AES CCM decrypt command has completed.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_aes_ccm_param_t*) type to access the AES CCM decrypted data information. eventParams is valid only if status is success(0x00).eventParams->mic to be ignored.

enumerator CY_BLE_EVT_SET_SLAVE_LATENCY_MODE_COMPLETE

This event is triggered for Cy_BLE_SetSlaveLatencyMode() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t *) to access the pointer to the bdHandle corresponding to this event. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_STACK_SHUTDOWN_COMPLETE

This event is used to inform the application that BLE Stack Shutdown is complete.

However, the application shall wait for at least 10ms, before calling the Cy_BLE_Start() API, after receiving this event. The event parameter returned along with this event is NULL.

enumerator CY_BLE_EVT_RADIO_TEMPERATURE

This event is used to inform the application of temperature data as measured.

Event parameter is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint16_t *) to access the pointer to the radio temparature level in degree Celsius.

enumerator CY_BLE_EVT_RADIO_VOLTAGE_LEVEL

This event is used to inform the application of voltage data as measured.

Event parameter is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint16_t *) to access the pointer to the radio voltage level in mV.

enumerator CY_BLE_EVT_AES_CMAC_GEN_COMPLETE

This event is used to inform the application that the AES CMAC generation is completed Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type.

There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored.

enumerator CY_BLE_EVT_SET_EVENT_MASK_COMPLETE

This event is triggered on completion of setting vendor event mask.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). status is valid, eventParams must be ignored

enumerator CY_BLE_EVT_SET_CE_LENGTH_COMPLETE

This event is triggered on completion of setting vendor event mask.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t *) to access the pointer to the bdHandle corresponding to this event. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_SET_CONN_PRIORITY_COMPLETE

This event is triggered on completion of setting vendor event mask.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (uint8_t *) to access the pointer to the bdHandle corresponding to this event. eventParams is valid only if status is success(0x00)

enumerator CY_BLE_EVT_HCI_PKT_RCVD

This event is used to inform application that an HCI event (or ACL packet) has been received from controller.

Event parameter returned with this event is pointer to a parameter of type ‘cy_stc_ble_hci_tx_packet_info_t’. This event will only be triggered when the application enables software transport mode for HCI by calling the Cy_BLE_SoftHciTransportEnable() API.

enumerator CY_BLE_EVT_GAPC_SCAN_PROGRESS_RESULT

This event is triggered every time a device is discovered.

A pointer to structure of type cy_stc_ble_gapc_adv_report_param_t is returned as the event parameter.

enumerator CY_BLE_EVT_GAP_AUTH_REQ

This event can be received by a device in Peripheral or Central role.

When it is received by a device in a Peripheral role, it must Call Cy_BLE_GAPP_AuthReqReply() to reply to the authentication request from Central. When this event is received by a device in a Central role, it means that the Peripheral has requested Central to initiate authentication procedure. The device must call Cy_BLE_GAP_AuthReq() to initiate the authentication procedure. A pointer to structure of type cy_stc_ble_gap_auth_info_t is returned as the event parameter.

enumerator CY_BLE_EVT_GAP_PASSKEY_ENTRY_REQUEST

This event indicates that the device must send a passkey to be used during the pairing procedure.

Cy_BLE_GAP_AuthPassKeyReply() is required to be called with valid parameters on receiving this event. cy_stc_ble_gap_auth_pk_info_t is returned as the event parameter. bdHandle is the only relevant parameter. Other parameters should be ignored.

enumerator CY_BLE_EVT_GAP_PASSKEY_DISPLAY_REQUEST

This event indicates that the device needs to display a passkey during the pairing procedure.

cy_stc_ble_gap_auth_pk_info_t is returned as the event parameter. bdHandle and passkey are relevant parameters. Other parameter(s) should be ignored. The passkey can be any 6-decimal-digit value.

enumerator CY_BLE_EVT_GAP_AUTH_COMPLETE

This event indicates that the authentication procedure is completed.

The event parameter contains the security information as defined by cy_stc_ble_gap_auth_info_t. This event is generated at the end of the following three operations:

  • Authentication is initiated with a newly connected device

  • Encryption is initiated with a connected device that is already bonded

  • Re-Encryption is initiated with a connected device with link already encrypted During encryption/re-encryption, the Encryption Information exchanged during the pairing process is used to encrypt/re-encrypt the link. As this does not modify any of the authentication parameters with which the devices were paired, this event is generated with NULL event data and the result of the encryption operation.

enumerator CY_BLE_EVT_GAP_AUTH_FAILED

This event indicates that the authentication process between two devices has failed .

cy_stc_ble_gap_auth_info_t is returned as the event parameter. bdHandle provides a handle for the failing device and authErr provides cy_en_ble_gap_auth_failed_reason_t indicates the reason for failure. Other parameters should be ignored.

enumerator CY_BLE_EVT_GAPP_ADVERTISEMENT_START_STOP

This event indicates that the GAP Peripheral device has started/stopped advertising.

The event parameter contains the HCI Status error code, which is of type ‘uint8_t’. If the data is ‘0x00’, it indicates ‘success’; anything else indicates ‘failure’.

enumerator CY_BLE_EVT_GAP_DEVICE_CONNECTED

This event is generated at the GAP Peripheral end after the connection is completed with a peer Central device.

For a GAP Central device, this event is generated as an acknowledgment of receiving connection request by calling ‘Cy_BLE_GAPC_InitConnection()’ successfully by the BLE Stack. After the connection is completed, no other event is generated but if connection establishment fails, ‘CY_BLE_EVT_GAP_DEVICE_DISCONNECTED’ is generated to the application. This event is generated only if Link Layer Privacy is not enabled in the BLE Component customizer. The event parameter is a pointer to a structure of type cy_stc_ble_gap_connected_param_t. The members of the event parameter’s structure are valid only if eventParams->status is success (0x00).

enumerator CY_BLE_EVT_GAP_DEVICE_DISCONNECTED

This event indicates that the device has disconnected from remote device or failed to establish connection.

Parameter is of type ‘cy_stc_ble_gap_disconnect_param_t

enumerator CY_BLE_EVT_GAP_ENCRYPT_CHANGE

This event indicated an encryption change event for an active connection.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be cast to (cy_stc_ble_gap_encrypt_change_param_t*) type to access the encryption state (ON/OFF) as well as the bdHandle corresponding to this event. eventParams->encryption is valid only if status is success(0x00) This is an informative event for the application when there is a change in encryption. The application may choose to ignore it.

enumerator CY_BLE_EVT_GAP_CONNECTION_UPDATE_COMPLETE

This event is generated at the GAP Central and the Peripheral end after a connection parameter update is requested from the host to the controller.

The event parameter is a pointer to a structure of type cy_stc_ble_gap_conn_param_updated_in_controller_t.

enumerator CY_BLE_EVT_GAPC_SCAN_START_STOP

This event indicates that the Central device has started/stopped scanning.

This event is generated after making a call to the Cy_BLE_GAPC_StartDiscovery() and Cy_BLE_GAPC_StopDiscovery() functions. The event parameter contains the HCI Status error code, which is of type ‘uint8_t’. If the data is ‘0x00’, it indicates ‘success’; anything else indicates ‘failure’.

enumerator CY_BLE_EVT_GAP_KEYINFO_EXCHNGE_CMPLT

This event indicates that the SMP keys exchange with a peer device is complete.

The event handler is expected to store the peer device keys, especially IRK, which is used to resolve the peer device after the connection establishment. The event parameter returns data of type cy_stc_ble_gap_sec_key_param_t containing the peer device keys.

enumerator CY_BLE_EVT_GAP_NUMERIC_COMPARISON_REQUEST

This event indicates that the device must display a passkey during the secure connection pairing procedure.

Cy_BLE_GAP_AuthPassKeyReply() is required to be called with valid parameters on receiving this event. Because no key is entered by the user for Numeric Comparison, the parameter passkey for the function Cy_BLE_GAP_AuthPassKeyReply() will be ignored. cy_stc_ble_gap_auth_pk_info_t is returned as the event parameter. bdHandle and passkey are relevant parameters. Other parameter(s) should be ignored. ‘passkey’ can be any 6-decimal-digit value.

enumerator CY_BLE_EVT_GAP_KEYPRESS_NOTIFICATION

This event is generated when keypress (Secure connections) is received from peer device.

cy_stc_ble_gap_sc_kp_notif_info_t is returned as event parameter.

enumerator CY_BLE_EVT_GAP_OOB_GENERATED_NOTIFICATION

This event is generated when OOB generation for Secure connections is complete.

The event parameter is of type ‘cy_stc_ble_gap_oob_data_param_t

enumerator CY_BLE_EVT_GAP_ENHANCE_CONN_COMPLETE

This event is generated at the GAP Peripheral end after the connection is completed with a peer Central device.

For a GAP Central device, this event is generated as an acknowledgment of receiving connection request by calling ‘Cy_BLE_GAPC_InitConnection()’ successfully by the BLE Stack. After the connection is completed, no other event is generated but if connection establishment fails, ‘CY_BLE_EVT_GAP_DEVICE_DISCONNECTED’ event is generated to the application. This event is generated only if Link Layer Privacy is enabled in the BLE Component customizer. The event parameter is a pointer to a structure of type cy_stc_ble_gap_enhance_conn_complete_param_t. The members of the event parameter’s structure are valid only if eventParams->status is success (0x00).

enumerator CY_BLE_EVT_GAPC_DIRECT_ADV_REPORT

This event indicates that directed advertisements have been received where the advertiser is using a resolvable private address for the InitA field in the ADV_DIRECT_IND PDU and the Scanning_Filter_Policy is equal to 0x02 or 0x03.

The event parameter is of type ‘cy_stc_ble_gapc_direct_adv_report_param_t

enumerator CY_BLE_EVT_GAP_SMP_NEGOTIATED_AUTH_INFO

This event is raised as soon as the SMP has completed pairing properties (feature exchange) negotiation.

The event parameter is cy_stc_ble_gap_auth_info_t. cy_stc_ble_gap_auth_info_t will have the negotiated parameter. The pairing should either pass with these negotiated parameters or may fail.

enumerator CY_BLE_EVT_GAP_DEVICE_ADDR_GEN_COMPLETE

This event indicates a new Bluetooth device address generated successfully as per an application requirement.

The event parameter is cy_stc_ble_bd_addr_t

enumerator CY_BLE_EVT_GAP_KEYS_GEN_COMPLETE

This event indicates security keys are generated successfully.

The event parameter is cy_stc_ble_gap_sec_key_param_t bdHandle in the parameter should be ignored

enumerator CY_BLE_EVT_GAP_RESOLVE_DEVICE_COMPLETE

This event is triggered on completion of Cy_BLE_GAPC_ResolveDevice() function.

The event parameter is (cy_stc_ble_events_param_generic_t*)

enumerator CY_BLE_EVT_GAP_GEN_SET_LOCAL_P256_KEYS_COMPLETE

This event is triggered on completion of the Cy_BLE_GAP_GenerateSetLocalP256Keys() function.

The event parameter is of pointer to cy_stc_ble_gap_smp_local_p256_keys_t that has generated P256 keys.

enumerator CY_BLE_EVT_GAP_CREATE_CONN_CANCEL_COMPLETE

This event is triggered on completion of the Cy_BLE_GAPC_CancelConnection() function.

Event parameter returned with this event is of (cy_stc_ble_events_param_generic_t*) type. There are two members of the structure pointed to by the event parameter: status (uint8_t) and eventParams (void *). eventParams must be ignored

enumerator CY_BLE_EVT_GAP_CONN_ESTB

This event is triggered on completion of connection establishment.

Event parameter is (cy_stc_ble_conn_estb_param_t*)

enumerator CY_BLE_EVT_GAPP_UPDATE_ADV_SCAN_DATA_COMPLETE

This event indicates that the GAP Peripheral device has started/stopped advertising.

This event is generated after making a call to the Cy_BLE_GAP_UpdateAdvScanData function. The event parameter contains the HCI Status error code, which is of type ‘uint8_t’. If the data is ‘0x00’, it indicates ‘success’; anything else indicates ‘failure’.

enumerator CY_BLE_EVT_GAP_ADV_TX

This event is triggered when an advertisement packet is sent over the air.

This event will only be triggered if the CY_BLE_ADV_TX_EVENT_MASK event mask is set using the Cy_BLE_SetCustomEventMask API. The event parameter returned with this event must be ignored.

enumerator CY_BLE_EVT_GATTC_ERROR_RSP

This event is received by the GATT Client when the GATT Server cannot perform the requested operation and sends out an error response.

The event parameter is a pointer to a structure of type cy_stc_ble_gatt_err_param_t.

enumerator CY_BLE_EVT_GATT_CONNECT_IND

This event is generated at the GAP Peripheral end after a connection is completed with a peer Central device.

For a GAP Central device, this event is generated as in acknowledgment of receiving this event successfully by the BLE Stack. After connection is complete, no other event is required but if connection establishment fails, ‘CY_BLE_EVT_GATT_DISCONNECT_IND’ event is passed to the application. The event parameter is a pointer to a structure of type cy_stc_ble_conn_handle_t.

enumerator CY_BLE_EVT_GATT_DISCONNECT_IND

This event indicates that the GATT is disconnected.

The event parameter is a pointer to a structure of type cy_stc_ble_conn_handle_t.

enumerator CY_BLE_EVT_GATTS_XCNHG_MTU_REQ

This event indicates that the ‘GATT MTU Exchange Request’ is received from GATT Client device.

The event parameter is of ‘cy_stc_ble_gatt_xchg_mtu_param_t’ type and contains the Client RX MTU size.

enumerator CY_BLE_EVT_GATTC_XCHNG_MTU_RSP

This event indicates that the ‘GATT MTU Exchange Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gatt_xchg_mtu_param_t and contains the Server RX MTU size.

enumerator CY_BLE_EVT_GATTC_READ_BY_GROUP_TYPE_RSP

This event indicates that the ‘Read by Group Type Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_read_by_grp_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_READ_BY_TYPE_RSP

This event indicates that the ‘Read by Type Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_read_by_type_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_FIND_INFO_RSP

This event indicates that the ‘Find Information Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type ‘cy_stc_ble_gattc_find_info_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_FIND_BY_TYPE_VALUE_RSP

This event indicates that the ‘Find by Type Value Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_find_by_type_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_READ_RSP

This event indicates that the ‘Read Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_read_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_READ_BLOB_RSP

This event indicates that the’Read Blob Response’ from GATT Server.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_read_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_READ_MULTI_RSP

This event indicates that the ‘Read Multiple Responses’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_read_rsp_param_t. The ‘actualLen’ field should be ignored as it is unused in this event response.

enumerator CY_BLE_EVT_GATTS_WRITE_REQ

This event indicates that the ‘Write Request’ is received from GATT Client device.

The event parameter is a pointer to a structure of type cy_stc_ble_gatt_write_param_t.

enumerator CY_BLE_EVT_GATTC_WRITE_RSP

This event indicates that the ‘Write Response’ is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_conn_handle_t.

enumerator CY_BLE_EVT_GATTS_WRITE_CMD_REQ

This event indicates that the ‘Write Command’ is received from GATT Client device.

The event parameter is a pointer to a structure of type cy_stc_ble_gatts_write_cmd_req_param_t.

enumerator CY_BLE_EVT_GATTS_PREP_WRITE_REQ

This event indicates that the ‘Prepare Write’ Request is received from GATT Client device.

The event parameter is a pointer to a structure of type cy_stc_ble_gatts_prep_write_req_param_t.

enumerator CY_BLE_EVT_GATTS_EXEC_WRITE_REQ

This event indicates that the ‘Execute Write’ request is received from GATT Client device.

The event parameter is a pointer to a structure of type ‘cy_stc_ble_gatts_exec_write_req_t’. This event will be triggered before GATT DB is modified. GATT DB will be updated only if there is no error condition provided by the application. In case of an error condition triggered during BLE Stack validation, a partial write will occur. The write will be cancelled from that handle where the error has occurred and an error response corresponding to that handle will be sent to the remote device. If at any point of time ‘CY_BLE_GATT_EXECUTE_WRITE_CANCEL_FLAG’ is received in execWriteFlag fields of ‘cy_stc_ble_gatts_exec_write_req_t’ structure, then all previous writes are cancelled. For execute cancel scenario, all elements of ‘cy_stc_ble_gatts_exec_write_req_t’ should be ignored except execWriteFlag and connHandle.

enumerator CY_BLE_EVT_GATTC_EXEC_WRITE_RSP

This event indicates that the ‘Execute Write’ response is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_exec_write_rsp_param_t.

enumerator CY_BLE_EVT_GATTC_HANDLE_VALUE_NTF

This event indicates that Notification data is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_handle_value_ntf_param_t.

enumerator CY_BLE_EVT_GATTC_HANDLE_VALUE_IND

This event indicates that Indication data is received from GATT Server device.

The event parameter is a pointer to a structure of type cy_stc_ble_gattc_handle_value_ind_param_t.

enumerator CY_BLE_EVT_GATTS_HANDLE_VALUE_CNF

This event indicates that an Indication Response is received from the GATT Client.

The event parameter is a pointer to a structure of type cy_stc_ble_conn_handle_t.

enumerator CY_BLE_EVT_GATTS_DATA_SIGNED_CMD_REQ

This event indicates that a ‘GATT Signed Write’ command is received from GATT Client.

The event parameter is a pointer to a structure of type cy_stc_ble_gatts_signed_write_cmd_req_param_t. If value.val parameter is set to Zero, then the signature is not matched and is ignored by the BLE Stack

enumerator CY_BLE_EVT_GATTC_STOP_CMD_COMPLETE

This event indicates that a GATT group procedure has stopped or completed.

This event occurs only if the application has called the Cy_BLE_GATTC_StopCmd() function. The parameter is a pointer to a structure of type cy_stc_ble_conn_handle_t.

enumerator CY_BLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ

This event is triggered on the GATT Server side when the GATT Client sends a read request and when characteristic has the CY_BLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT property set.

The event parameter is of ‘cy_stc_ble_gatts_char_val_read_req_t’ type. This event could be ignored by the application unless it needs to respond by an error response, which must be set in the gattErrorCode field of the event parameter.

enumerator CY_BLE_EVT_GATTC_LONG_PROCEDURE_END

This event indicates that the GATT long procedure has ended and the BLE Stack will not send any further requests to the peer.

The event parameter is of type ‘cy_stc_ble_gattc_long_procedure_end_param_t’. Either this event or ‘CY_BLE_EVT_GATTC_ERROR_RSP’ will be received by the application. This event may be triggered for the following GATT long procedures:

  1. Cy_BLE_GATTC_DiscoverAllPrimaryServices()

  2. Cy_BLE_GATTC_DiscoverPrimaryServiceByUuid()

  3. Cy_BLE_GATTC_FindIncludedServices()

  4. Cy_BLE_GATTC_DiscoverAllCharacteristics()

  5. Cy_BLE_GATTC_DiscoverCharacteristicByUuid()

  6. Cy_BLE_GATTC_DiscoverAllCharacteristicDescriptors()

  7. Cy_BLE_GATTC_ReadLongCharacteristicValues()

  8. Cy_BLE_GATTC_WriteLongCharacteristicValues()

  9. Cy_BLE_GATTC_ReliableWrites()

  10. Cy_BLE_GATTC_ReadLongCharacteristicDescriptors()

  11. Cy_BLE_GATTC_WriteLongCharacteristicDescriptors()

  12. Cy_BLE_GATTC_ReadByTypeReq() The event parameter is ATT opcode for the corresponding long GATT Procedure.

enumerator CY_BLE_EVT_L2CAP_CONN_PARAM_UPDATE_REQ

This event indicates the connection parameter update is received from the remote device.

The application is expected to reply to L2CAP using the Cy_BLE_L2CAP_LeConnectionParamUpdateResponse() function to respond to the remote device, whether parameters are accepted or rejected.

The event parameter pointer points to data of type ‘cy_stc_ble_gap_conn_update_param_info_t

enumerator CY_BLE_EVT_L2CAP_CONN_PARAM_UPDATE_RSP

This event indicates the connection parameter update response is received from the master.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_conn_update_rsp_param_t.

enumerator CY_BLE_EVT_L2CAP_COMMAND_REJ

This event indicates that the request to send over L2CAP signaling is rejected.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cmd_rej_param_t.

enumerator CY_BLE_EVT_L2CAP_CBFC_CONN_IND

This event is used to inform the application of the incoming L2CAP CBFC Connection Request.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cbfc_conn_ind_param_t.

enumerator CY_BLE_EVT_L2CAP_CBFC_CONN_CNF

This event is used to inform application of the L2CAP CBFC Connection Response/Confirmation.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cbfc_conn_cnf_param_t.

enumerator CY_BLE_EVT_L2CAP_CBFC_DISCONN_IND

This event is used to inform the application of the L2CAP CBFC Disconnection Request received from the Peer device.

The event parameter is a pointer to a Local CID of type uint16.

enumerator CY_BLE_EVT_L2CAP_CBFC_DISCONN_CNF

This event is used to inform the application of the L2CAP CBFC Disconnection confirmation/response received from the peer device.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cbfc_disconn_cnf_param_t.

enumerator CY_BLE_EVT_L2CAP_CBFC_DATA_READ

This event is used to inform the application of data received over the L2CAP CBFC channel.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cbfc_rx_param_t.

enumerator CY_BLE_EVT_L2CAP_CBFC_RX_CREDIT_IND

This event is generated when the Receive Credits have reached the low water mark for a CBFC channel.

After receiving L2CAP data/payload from a peer device for a CBFC channel, the available credits are calculated. If the credit count goes below the low water mark, this event is generated to inform the application of the condition. Now, if the application wants, it can send more credits to the peer device.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cbfc_low_rx_credit_param_t.

enumerator CY_BLE_EVT_L2CAP_CBFC_TX_CREDIT_IND

This event is generated when the BLE Stack receives Transmit Credits for a CBFC channel.

This event is called on receiving LE Flow Control Credit from a peer device.

The event parameter is a pointer to a structure of type cy_stc_ble_l2cap_cbfc_low_tx_credit_param_t.

If the ‘result’ field of the received data is non-zero, this indicates an error. If the sum of ‘credit’ field value of the received data and the previously available credit at the device exceeds 65535, it indicates a ‘credit overflow’ error.

If there is an error, the peer device receiving this event should initiate disconnection of the L2CAP channel by invoking the Cy_BLE_L2CAP_DisconnectReq() function.

enumerator CY_BLE_EVT_L2CAP_CBFC_DATA_WRITE_IND

This event is used to inform the application that L2CAP CBFC data transmission is scheduled for transmission in the BLE Stack.

The application can send the next data. The event parameter is of type ‘cy_stc_ble_l2cap_cbfc_rx_data_param_t’. The L2CAP CBFC application must wait for this event before transmitting the next CBFC L2CAP data. The application can send the next data only when the CY_BLE_EVT_L2CAP_CBFC_DATA_WRITE_IND event is received for previously sent data and CY_BLE_EVT_STACK_BUSY_STATUS is received with status CY_BLE_STACK_STATE_FREE.

enumerator CY_BLE_EVT_MAX

Maximum value of cy_en_ble_event_t type.