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

Unable to adverstise scanned data again using ble_app_hrs_rscs_relay example.

Hi,
I am using nrf5832 sdk 14.2 where I am trying to scan the data and advertise same data with some modifications. I have used Central and Peripheral example ble_app_hrs_rscs_relay. Here I am able to scan the data from other advertising device and collecting it into a buffer but unable to advertise the buffer again. I have tried updating manufacturing specific data as well scanned-response data but fail to do so. Although My device is advertising as a beacon without buffer data.
TIA

  • Hi,

    Can you post the code you used to update the advertising data?

    Are you getting any error codes when trying to update the advertising data?

    Best regards,
    Jørgen

  • Hi Jorgen, I am using the following api for advertising and in my case advertising is also happening but the data is not visible when I tried in NRF Connect App just like when we flash the beacon example code. Beside that I am not getting any error.

    static void advertising_init(void)
    {
    ret_code_t err_code;
    ble_advertising_init_t init;
    memset(&init, 0, sizeof(init));

    init.advdata.name_type = BLE_ADVDATA_NO_NAME;
    init.advdata.include_appearance = true;
    init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
    init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
    init.advdata.uuids_complete.p_uuids = m_adv_uuids;
    init.advdata.p_manuf_specific_data->data.p_data = (uint8_t *) m_beacon_info;
    init.advdata.p_manuf_specific_data->data.size = APP_BEACON_INFO_LENGTH;
    // init.srdata.p_service_data_array->data.p_data = Data_str;
    // init.srdata.p_service_data_array->data.size = sizeof(Data_str)/sizeof(uint8_t);
    init.config.ble_adv_fast_enabled = true;
    init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS;

    init.evt_handler = on_adv_evt;

    err_code = ble_advertising_init(&m_advertising, &init);
    APP_ERROR_CHECK(err_code);

    ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG);
    }

  • Do you call advertising_init each time you update the buffer? The advertising data is copied into an internal buffer. Simply updating your data in m_beacon_info will not affect the data being advertised until you call the correct functions to update the data.

  • To update the buffer I have different functions which I am calling.

    Here in the above snippet only static data using m_beacon_info I am trying to advertise by calling advertising_init   every 50ms in main() after scan.

  • Could you maybe post the full project? That would make it easier to get the full overview of what you are doing to update the data, and also to reproduce/debug the issue. If you do not want to post the project in public, I can convert the case to private.

Related