You can call the CyBle_GapUpdateAdvData API after the CYBLE_STACK_ON event to update the advertisement data.
Please refer the BLE Component Datasheet for more details on this API
Thanks Madhu. I will give that a try.
@Madhu I am attempting to use CyBle_GapUpdateAdvData to update manufacturer data dynamically. First I have this simple test:
#define MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX (28u) /* index of the dynamic data in the ADV packet */ uint8 someValue = 0x7; (cyBle_discoveryModeInfo.advData->advData)[MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX] = someValue; CyBle_GapUpdateAdvData(cyBle_discoveryModeInfo.advData, cyBle_discoveryModeInfo.scanRspData);
However, I am not seeing the value change in the advertising packet. I did try the Dynamic Broadcaster example, which worked great. Our project is in the Peripheral role, but my understanding was that CyBle_GapUpdateAdvData would still work. No?
1 of 1 people found this helpful
I was able to figure this out. The problem for me was the
MANUFACTURER_SPECIFIC_DYNAMIC_DATA_INDEX I was using was beyond the bounds of the advertising packet! For me the bytes happened to be indexes 20-23. Once I fixed that, I was able to dynamically update the manufacturer data.
I try to do the same job but I find this error in BLE PSoC® Creator™ Component Datasheet manual page 114 Revised December 22, 2015:
This function allows setting the ADV data and SCAN response data while advertising is ongoing. Application
shall preserve Bluetooth Spec 4.1 mandated AD flags fields corresponding to the type of discovery mode the
device is in and only change the rest of the data. This API must be called when API CyBle_GetBleSsState()
returns CYBLE_BLESS_STATE_EVENT_CLOSE state. If API is called in any of the BLESS Low Power Modes,
it will force exit BLESS from Low Power Mode state to update ADV Data.
In contrast the demo project Dynamic_Broadcaster show in the function void DynamicADVPayloadUpdate(void) the condition:
if(CyBle_GetBleSsState() == CYBLE_BLESS_STATE_ACTIVE)
This create misunderstanding.
In my case I can't setup one time the Manufactored Specific Data and must keep the function call DynamicADVPayloadUpdate() into infinite while loop.
I'm trying to move at inizialization this procedure to do only one time.