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

NRF8001 set Service data in advertisment packets

Hi, I need to set dynamic advertisement data with nRF8001. To achieve this with nRFgo Studio my idea was to set "Service Data" in "Selected fields to advertise" (ACI Bond for example) within GAP settings, create characteristic with property "Set pipe" then use "SetLocalData" to modify this characteristic data but how do I link this characteristic to be the "Service data" to be advertised ? I can't understand how advertisement packet bits "uuid lsb" and "uuid msb" have to be set/used. I saw similar question but none of them explain how to set it in nRFgo Studio (note: I can't set broadcast property...)

  • Hi Romain,

    It's been awhile since last time I used nRF8001. I quote here an answer from one of my coworker, could you try to follow and let me know if it works:

    =========

    The broadcasted data is sent as Service Data.

    You can change the Service Data during advertising.

    Steps in nRFgo studio:

    Select a broadcast property on one of the Characteristics that you want to Broadcast. (Make sure that the Characteristic is within a Service identified by a Bluetooth UUID and not a vendor UUID) [Choose the DIS as the Service or any other Service using a 16bit UUID]. In the GAP settings tab. Select the “Service data” in the “Selected fields to Advertise”, Make sure that the selection tab (Connect/Bond/Broadcast) corresponds to the ACI Commands that you are using to advertise. You can choose to put the Service Data in the Advertising packet or in the Scan Response. Steps in the Code:

    Use the ACI command OpenAdvPipe to enable the broadcasting of Service Data for the Broadcast pipe that was added in the nRFgo studio.
    Use the utility functions lib_aci_open_adv_pipe or lib_aci_open_adv_pipes Use the ACI commands (Connect/Bond/Broadcast) to start advertising as usual Use the ACI command SetLocalData on the broadcast pipe to update the data for the advertising
    Note: The bit mask that must be supplied is the structure as mentioned in Table 98 of the nRF8001_PS_v.1.0.pdf. (The same structure as in the PipeStatusEvent).

    There is are 2 utility functions to open the pipe in the sdk.

     lib_aci_open_adv_pipe(pipe_number_broadcast); //Open a single pipe
     
      lib_aci_open_adv_pipes(pipe bit mask); //Open multiple pipes
    

    Result

    You will see the Advertising tag “Service Data” with the UUID of the Service and the data used the SetLocalData in the advertising.

  • Hi Hung,

    Yes it works fine as you described. Thanks

Related