read modify write current advertisement packet?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
alca_3047856
Level 1
Level 1
10 sign-ins 5 questions asked 5 sign-ins

I have been reading on how to change the advertising packet at runtime.  My goal is to change the "manufacturer data" so that a unique device name will be shown during scanning of the peripheral.

It seems the way to do this is to call the below function. 

Is there a simple way to get the current advertisement packet, so that I can simply modify the "manufacturer data" in the packet?  Or do I have to first see what the advertisement packet is through the ble module configuration through the schematic, hardcode the data that I do not want to update, then call the update function?

Cy_BLE_GAPP_UpdateAdvScanData()

0 Likes
1 Solution
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

You can use Cy_BLE_GAPP_UpdateAdvScanData() during advertising is on. Before calling this function, you need do below steps:

1)define the data array of new advertising packet by yourself -- advdata. You can get the array in BLE_config.c (-- cy_ble_discoveryData), by setting in BLE customizer accordingly.

2)pass the array address to target struct to be configured:

cy_ble_configPtr- >discoveryModeInfo[CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX].advData = &advdata

View solution in original post

0 Likes
1 Reply
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

You can use Cy_BLE_GAPP_UpdateAdvScanData() during advertising is on. Before calling this function, you need do below steps:

1)define the data array of new advertising packet by yourself -- advdata. You can get the array in BLE_config.c (-- cy_ble_discoveryData), by setting in BLE customizer accordingly.

2)pass the array address to target struct to be configured:

cy_ble_configPtr- >discoveryModeInfo[CY_BLE_PERIPHERAL_CONFIGURATION_0_INDEX].advData = &advdata

0 Likes