This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

How change data order in beacon examples

Hello, everybody

I got a problem that i add device name and advertising my specific data according to Beacon example in SDK 15.2.0, but the data order is not what i expected, as shown in below. I want to make the device name in front of Flags, how can i do it?

In the function of   advertising_init(),  i only change this

And add this function: sd_ble_gap_device_name_set(0, (uint8_t *)DeviceName, strlen(DeviceName));  after ble_stack_init()  in the main ()

the softdevice is s140_nrf52_6.1.0 and i use NRF52840.

Can anyone give me some information, thanks in advance.

Parents
  • Hi

    Sorry for the late reply! This is possible, but you have to "rebuild" the advertising packet yourself. Easiest way to do this is to modify the ble_advdata_encode function in ble_advdata.c. If you take a look at that function you can see that the name is at the bottom of the function. You can just move that to the top (or wherever in the packet you want it) of the function, and that should be it.

    Best regards,

    Simon

Reply
  • Hi

    Sorry for the late reply! This is possible, but you have to "rebuild" the advertising packet yourself. Easiest way to do this is to modify the ble_advdata_encode function in ble_advdata.c. If you take a look at that function you can see that the name is at the bottom of the function. You can just move that to the top (or wherever in the packet you want it) of the function, and that should be it.

    Best regards,

    Simon

Children
Related