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

Advertising parameters for long range

Hello,

I am trying to understand the parameters required for Coded PHY.  This is from my advertising_init function in main.c:

static void advertising_init(void)
{
    uint32_t               err_code;
    ble_advertising_init_t init;

    memset(&init, 0, sizeof(init));

    init.advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    init.advdata.include_appearance = false;
    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.config.ble_adv_fast_enabled      = true;
    init.config.ble_adv_fast_interval     = APP_ADV_INTERVAL;
    init.config.ble_adv_fast_timeout      = APP_ADV_DURATION;
    init.config.ble_adv_primary_phy       = BLE_GAP_PHY_CODED;
    init.config.ble_adv_secondary_phy     = BLE_GAP_PHY_CODED;
    init.config.ble_adv_extended_enabled  = true;
    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);
}


I have encountered this advertising_init function in main.c. I had seen this type parameter structure from some code examples in forum  :

static void advertising_init(void)
{
    ret_code_t    err_code;
    ble_advdata_t advdata;

    memset(&advdata, 0, sizeof(advdata));

    advdata.name_type          = BLE_ADVDATA_FULL_NAME;
    advdata.include_appearance = true;
    advdata.flags              = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;

    ble_gap_adv_params_t adv_params;

    memset(&adv_params, 0, sizeof(adv_params));

    adv_params.primary_phy     = BLE_GAP_PHY_CODED;
    adv_params.secondary_phy   = BLE_GAP_PHY_CODED;
    adv_params.duration        = APP_ADV_DURATION;
    adv_params.properties.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED;
    adv_params.p_peer_addr     = NULL;
    adv_params.scan_req_notification = 1;
    adv_params.filter_policy   = BLE_GAP_ADV_FP_ANY;
    adv_params.interval        = APP_ADV_INTERVAL;

    err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
    APP_ERROR_CHECK(err_code);
}


I have checked my advertising.c file and saw parameters above in uint32_t ble_advertising_init. I am confused a bit.

So what is the difference between them ? I am asking because I am told that the advertising type must be set to BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED for long range. Do I need to set advertising type in main.c  or in advertising.c ? 

Best Regards

Parents Reply Children
No Data
Related