- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The content of the advertising message is set up statically in the BLE component configuration. in PSoC Creator 4.3 We need to change two bytes dynamically in one field. The start and stop of the advertising is controlled in the CY_BLE_EVT_GAPP_ADVERTISEMENT_START_STOP event but I do not see a pointer to the message content to be able to change it.
Could someone tell me where the message data is located or how this could be done?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a solution not even needing Cy_BLE_GAPP_UpdateAdvScanData().
The advertising packet bytes are at cy_ble_config.discoveryModeInfo[cy_ble_advIndex].advData as a byte array. For my application only 2 bytes need to be dynamically variable. So, just setting the bytes in this array seems to be working fine. The structure of the advertising message does not have to be changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
Please refer to the Cy_BLE_GAPP_UpdateAdvScanData() API in the BLE component datasheet. This function is used by GAP Peripheral application to set Advertisement and/or Scan Response data. This function can be used during active advertisement as well. Application should ensure the validity of the data content. On completion of this operation, GAP Peripheral application receives CY_BLE_EVT_GAPP_UPDATE_ADV_SCAN_DATA_COMPLETE event.
Thanks,
P Yugandhar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OK. Thanks.
From my perspective I never would have guessed by the name of the function that it could also modify the advertising data. The documentation could be a lot more clear.
Now, the next problem is getting access to the advertising packet byte array that was assembled statically. First how can it be accessed and second, how is it put into the cy_stc_ble_gapp_disc_mode_info_t structure needed by the UpdateAdvScanData function?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I found a solution not even needing Cy_BLE_GAPP_UpdateAdvScanData().
The advertising packet bytes are at cy_ble_config.discoveryModeInfo[cy_ble_advIndex].advData as a byte array. For my application only 2 bytes need to be dynamically variable. So, just setting the bytes in this array seems to be working fine. The structure of the advertising message does not have to be changed.