Can I use the ble_advertising module for the BLE_GAP_PHY_CODED?
Currently my Coded PHY parameters without the module are defined as:
/**@brief Struct that contains pointers to the encoded advertising data. */
static ble_gap_adv_data_t m_adv_data =
{
.adv_data =
{
.p_data = m_enc_advdata,
.len = BLE_GAP_ADV_SET_DATA_SIZE_MAX
},
.scan_rsp_data =
{
.p_data = NULL,
.len = 0
}
};
static void advertising_init(void)
{
ret_code_t err_code;
ble_gap_adv_params_t adv_params =
{
.properties =
{
#ifdef USE_CODED_PHY
.type = BLE_GAP_ADV_TYPE_EXTENDED_CONNECTABLE_NONSCANNABLE_UNDIRECTED,
#else
.type = BLE_GAP_ADV_TYPE_CONNECTABLE_SCANNABLE_UNDIRECTED,
#endif
},
.p_peer_addr = NULL,
.filter_policy = BLE_GAP_ADV_FP_ANY,
.interval = APP_ADV_INTERVAL,
.duration = 0,
#ifdef USE_CODED_PHY
.primary_phy = BLE_GAP_PHY_CODED,
.secondary_phy = BLE_GAP_PHY_CODED,
#else
.primary_phy = BLE_GAP_PHY_1MBPS,
.secondary_phy = BLE_GAP_PHY_1MBPS,
#endif
.scan_req_notification = 1,
};
ble_advdata_t const adv_data =
{
.name_type = BLE_ADVDATA_FULL_NAME,
.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE,
.include_appearance = false,
};
err_code = ble_advdata_encode(&adv_data, m_adv_data.adv_data.p_data, &m_adv_data.adv_data.len);
APP_ERROR_CHECK(err_code);
err_code = sd_ble_gap_adv_set_configure(&m_adv_handle, &m_adv_data, &adv_params);
APP_ERROR_CHECK(err_code);
}
/**@brief Function for starting advertising.
*/
static void advertising_start(bool erase_bonds)
{
ret_code_t err_code;
// Supported tx_power values: -40dBm, -20dBm, -16dBm, -12dBm, -8dBm, -4dBm, 0dBm, +2dBm, +3dBm, +4dBm, +5dBm, +6dBm, +7dBm and +8dBm.
err_code = sd_ble_gap_tx_power_set(BLE_GAP_TX_POWER_ROLE_ADV, m_adv_handle, 8); //8db
APP_ERROR_CHECK(err_code);
err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
APP_ERROR_CHECK(err_code);
NRF_LOG_INFO("Advertising");
}Following the example at NordicPlayground-nrf52-ble-app-uart-long-range
This method of advertising works for both 1Mbps and CODED PHY.
However with this I am having trouble defining the on_adv_evt callback, which would normally allow me to go to low-power mode through BLE_ADV_EVT_IDLE when the APP_ADV_DURATION is over.
Is it possible to use the coded phy with the ble_advertising module so I can use the same callbacks and functions as the 1Mbps PHY?
Any input would be appreciated,
Jeff