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

Bluetooth name set to N/A when in directed advertising

Hi,

I'm developing a BLE application for the nRF52 and I wish to use directed advertising and the whitelist.

I initialise the Bluetooth advertising using the following code :

static void advertising_init(void)
{
    // Build advertising data struct to pass into @ref ble_advertising_init.
    memset(&m_advdata, 0, sizeof(m_advdata));
    //Only set up adv_data. Options will be set depending on if advertising will be enabled or not.
    m_advdata.name_type               = BLE_ADVDATA_FULL_NAME;
    m_advdata.include_appearance      = false;
    m_advdata.flags                   = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    m_advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    m_advdata.uuids_complete.p_uuids  = m_adv_uuids;
}    

And

            advertising_init();

	        options.ble_adv_whitelist_enabled 		= false;
		options.ble_adv_directed_enabled  		= false;
		options.ble_adv_directed_slow_enabled 	= BLE_ADV_SLOW_DISABLED;
		options.ble_adv_directed_slow_interval  = APP_ADV_INTERVAL_SLOW;
		options.ble_adv_directed_slow_timeout	= APP_ADV_TIMEOUT_IN_SECONDS;
		options.ble_adv_fast_enabled			= BLE_ADV_FAST_ENABLED;
		options.ble_adv_fast_interval			= APP_ADV_INTERVAL_FAST;
		options.ble_adv_fast_timeout			= APP_ADV_TIMEOUT_IN_SECONDS;
		options.ble_adv_slow_enabled			= BLE_ADV_SLOW_ENABLED;
		options.ble_adv_slow_interval			= APP_ADV_INTERVAL_SLOW;
		options.ble_adv_slow_timeout			= 0;

		err_code = ble_advertising_init(&m_advdata, NULL, &options, on_adv_evt, NULL);
		APP_ERROR_CHECK(err_code);   

Then on reception of a command via Bluetooth, I modify the bluetooth settings using the following :

options.ble_adv_whitelist_enabled 		= true;
options.ble_adv_directed_enabled  		= true;
options.ble_adv_directed_slow_enabled 	= true;
options.ble_adv_directed_slow_interval  = APP_ADV_INTERVAL_SLOW;
options.ble_adv_directed_slow_timeout	= APP_ADV_TIMEOUT_IN_SECONDS;

err_code = ble_advertising_init(&m_advdata, NULL, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);

I recieve the message "Starting direct advertisement." via debug but on trying to connect I notice that the name of our device (it was "ESQ") has now changed to "N/A".

I looked at this post for guidance devzone.nordicsemi.com/.../

But after having placed some debug output functions within name_encode(), I note that it function is never sending the short name.

I've also tried changing the bluetooth device name to simply "E" but I still have the same problem.

Any ideas ? Thanks Lee

SDK 11.0.0 Softdevice 132

Related