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

ble adverting include mac address

I have set the advdata.include_ble_device_address = true in advertising_init function. However, the mac address data is not shown in mobile APP.

Is it due to the fact that I have already include some data in advdata.manu_specific_data?

  • what is your application? Show me a adv_init function.

  • It is based on ble_app_uart

    /**@brief Function for initializing the Advertising functionality.
     */
    void advertising_init(void)
    {
        uint32_t               err_code;
        ble_advdata_t          advdata;
        ble_advdata_t          scanrsp;
        ble_adv_modes_config_t options;
    //     uint8_t m_addl_adv_manuf_data[] = {0x08, 0xFF, 0x11, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06};
    
        ble_advdata_manuf_data_t   manuf_data;
        manuf_data.data.size = 6;
        manuf_data.data.p_data = MfgSpecData;
        manuf_data.company_identifier = 0xff00;
        
        // Build advertising data struct to pass into @ref ble_advertising_init.
        memset(&advdata, 0, sizeof(advdata));
        advdata.name_type          = BLE_ADVDATA_FULL_NAME;
        advdata.include_appearance = false;
     //   advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
        advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    
        memset(&scanrsp, 0, sizeof(scanrsp));
        scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
        scanrsp.uuids_complete.p_uuids  = m_adv_uuids;
    
        memset(&options, 0, sizeof(options));
        options.ble_adv_fast_enabled  = true;
        options.ble_adv_fast_interval = APP_ADV_INTERVAL;
        options.ble_adv_fast_timeout  = APP_ADV_TIMEOUT_IN_SECONDS;
        
    
        advdata.p_manuf_specific_data = &manuf_data;
        
        advdata.include_ble_device_addr = true;
        
        
     //   strcpy((char *)(scanrsp.p_manuf_specific_data->data),(const char*)MfgSpecData);
        
        err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
        APP_ERROR_CHECK(err_code);   
       /* 
        memcpy(m_addl_adv_manuf_data+4,MfgSpecData,6);
        err_code = sd_ble_gap_adv_data_set(m_addl_adv_manuf_data, sizeof(m_addl_adv_manuf_data), NULL, 0);
        APP_ERROR_CHECK(err_code);
        */
    }
    
  • What App are you using to view the advertising data. I thought the MAC address was always sent but most Apps don't show you the whole advertising packet

Related