Counting the Number of ADV Packets Sent Over the Air During Advertisement in PSoC6 BLE – KBA228410
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Author: PY_21 Version: **
Translation - Japanese: PSoC6 BLEでアドバタイズメント中に無線送信されるADVパケットの数をカウントする- KBA228410- Community Translated (JA)
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)
Usage:
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.
case CY_BLE_EVT_STACK_ON:
apiResult = Cy_BLE_GAPP_StartAdvertisement(CY_BLE_ADVERTISING_FAST, CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX);
apiResult=Cy_BLE_SetCustomEventMask(CY_BLE_ADV_TX_EVENT_MASK);
break;
Success of this function call will generate CY_BLE_EVT_SET_EVENT_MASK_COMPLETE in an event callback function.
case CY_BLE_EVT_SET_EVENT_MASK_COMPLETE:
break;
With each ADV packet sent, the CY_BLE_EVT_GAP_ADV_TX event is generated during advertisement.
case CY_BLE_EVT_GAP_ADV_TX:
break;
Note:
The number of CY_BLE_EVT_GAP_ADV_TX events occurred in an advertisement event depends on the number of advertisement channels selected.