[ nRF52833 ] How to set Non-Connectable Advertizing using Advertising Library / Module

Hello,

In my experimentation to update advertising data during runtime, I am following the example @ 

 How to update advertising data dynamically using BLE Advertising library 

It is using the ble_advertising.h library module 

However I would like to set this advertising to non-connectable, non-scannable and non directed mode similar to 

static ble_gap_adv_params_t m_adv_params;  

m_adv_params.properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;

However, the data structure used for the advertising module 

ble_advertising_init_t init;

does not provide any provision to set the non connectable mode. 

May be the init.advdata.flags could be set ?  But does it have the values that I can set to non-connectable

Very similar question has already been asked previously but still open

 How to set non-connectable mode in BLE 

 

Can you please guide here ?

Thanks,

Abhi Ash

  • Hi Hung,

    Thanks for your response.

    My requirement is just sending out advertisements in non-connectable mode only. Connectable would be never needed.

    I have tried and used the beacon example however it directly uses the gap API and not the advertising library.
    I need to dynamically change the beacon contents.

    I inserted the line below in both fast and slow adv init functions
    p_adv_params->properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;

    However, sniffing the packet using the nRF Sniffer, the PDU Type is still shown as ADV_IND.
    and when I observe in the nRFConnect Android App, I can see the CONNECT option besides.

    May be something is still missing or going wrong

    Thanks
    Abhishek

  • Please attach your code where you do the modification. 

    I don't see a problem modifying the beacon example to stop advertising, update the advertising content and continue advertising. 

  • I reviewed my code once more.

    I was setting it at the beginning of the function and it was getting overwritten.

    It should be like given below

    // p_advertising->adv_params.properties.type =                BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED;
    p_adv_params->properties.type = BLE_GAP_ADV_TYPE_NONCONNECTABLE_NONSCANNABLE_UNDIRECTED;

    It works now and shows ADV_NONCONN_IND

    Thanks again,

    Abhi Ash

Related