I'm migrating a project from SDK 14.2.0 to SDK 15.3.0. I use gcc. I have three advertising modes and the first of them is working fine. For the second one, the same
ble_advertising_init_t that I passed to ble_advertising_init() in SDK 14.2.0 successfully no longer works with SDK 15.3.0. The only change I've made in the course of migrating SDKs is that I noticed the timeouts are now specified in 10ms units, not seconds.
Here's the code up to ble_advertising_init(). BTS_UUID_SERVICE is our custom service.
void ble_advertise_on_motion(void)
{
ret_code_t err_code = 0;
ble_advertising_init_t init;
memset(&init, 0, sizeof(init));
// As above
ble_uuid_t adv_uuids[] = {{BTS_UUID_SERVICE, m_bts.uuid_type}};
// As above
init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
init.advdata.include_appearance = false;
init.advdata.flags = BLE_GAP_ADV_FLAG_BR_EDR_NOT_SUPPORTED; // non-discoverable
init.advdata.uuids_complete.uuid_cnt = 1;
init.advdata.uuids_complete.p_uuids = adv_uuids;
// We do NOT want connections from unbonded centrals.
init.config.ble_adv_whitelist_enabled = true;
// Diasabled advertising modes.
init.config.ble_adv_directed_high_duty_enabled = false;
init.config.ble_adv_directed_enabled = false; // Would only last for 1.28s, so useless with a low power scan.
init.config.ble_adv_fast_enabled = false;
// Enabled advertising modes. Directed slow advertising at first looks appropriate here, but in testing, we never get a connection from our Android app. Just use slow (undirected) advertising, which gets us an immediate connection.
init.config.ble_adv_slow_enabled = true;
init.config.ble_adv_slow_interval = 32; // 32 * 0.625ms = 20 ms (minimum)
init.config.ble_adv_slow_timeout = 15 * 100; // 15s, in units of 10ms
// As above.
init.evt_handler = on_adv_evt;
// TODO (P1): Fix. Currently throwing:
// "E error Code 0x7 (NRF_ERROR_INVALID_PARAM), ../ble_periph.c line 1206"
err_code = ble_advertising_init(&m_advertising, &init);
APP_ERROR_CHECK(err_code);
// ...
}
I was sure there used to be decent SDM migration guides from Nordic, but I don't see one in the SDK's documentation directory. Maybe it was only for SD releases.