Author: PY_21 Version: **
You can count the number of advertisement packets sent over the air using the Cy_BLE_SetCustomEventMask(uint32_t mask) API function in PSoC 6 BLE.
Refer to this API in the BLE middleware PDL Documentation. In PSoC Creator, right-click the BLE Component, and select Open PDL Documentation or go to C:/Program Files(x86)/Cypress/PDL/3.1.0/doc/ble_api_reference_manual/html/index.html)
After starting the BLE communication, in the CY_BLE_EVT_STACK_ON event, call Cy_BLE_SetCustomEVentMast(uint32_t mask) with a mask value of CY_BLE_ADV_TX_EVENT_MASK.
apiResult = Cy_BLE_GAPP_StartAdvertisement(CY_BLE_ADVERTISING_FAST, CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX);
Success of this function call will generate CY_BLE_EVT_SET_EVENT_MASK_COMPLETE in an event callback function.
With each ADV packet sent, the CY_BLE_EVT_GAP_ADV_TX event is generated during advertisement.
The number of CY_BLE_EVT_GAP_ADV_TX events occurred in an advertisement event depends on the number of advertisement channels selected.