This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

how to update broadcast content dynamically?

Other Parts Discussed in Thread: CC2540

Hello,

My CC2540 plays a peripheral role. Now I want to update the broadcast content dynamically,I have read some articles in this community which also shows adding the function 

GAP_UpdateAdvertisingData( gapRole_TaskID,
TRUE, gapRole_AdvertDataLen, gapRole_AdvertData );

I have added it according to the article.what's more, when I start change the content of advData , first I stop broadcast; second modify the content; finally enable the broadcast.But It still does not work. 

My advertise type is default type ,that is GAP_ADTYPE_ADV_IND.

when having a test , I find that when I connect the CC2540 with a phone running "BLE Reader" APP, the content of broadcast can be modified. Each connection makes content modified .what I really want is the content will be modified without the connected. I have added this function 

GAPRole_SetParameter( GAPROLE_PARAM_UPDATE_ENABLE, sizeof( uint8 ), &enable_update_request );

in my project.

I have two question:

1) when in peripheral role , whether is the broadcast content modified dynamically or not?

2) can we change the advertise type among GAP_ADTYPE_ADV_IND,GAP_ADTYPE_ADV_SCAN_IND,GAP_ADTYPE_ADV_NONCONN_IND ? which type support updating broadcast dynamically?

  • Hi,

    All the modes allow changing the data dynamically. You don't have to stop and start advertising to do this.

    You can do this via GAPRole_SetParameter(GAPROLE_ADVERT_DATA, yourLen, yourAdvArray);.

    If you want to broadcast non-connectable advertisements, you can in BLE SDK v1.4.1 call GAPRole_SetParameter(GAPROLE_ADV_NONCONN_ENABLED, 1, &uint8True);. This must happen after disabling normal advertisements.

    PARAM_UPDATE_ENABLE relates to whether the peripheral should send a request for changed connection parameters after a connection is established.

    BR,
    Aslak