Hi,
I'm trying to reinitialize my ANT stack, after update of parameters which is done by BT. To be exact, I'm setting the ANT ID of the ANT device that will send data to my device using an external app connected via BT to my device. For now the NRF Connect BLE acts as this exteral app.
So it should work like this:
1. I update the ANT ID in the external APP - done
2. I send the ANT ID to my device via BT - done
3. The device reinitializes ANT stack and searches for a new device with received ANT ID - 50/50 - it works but also dsiconnects BT, which I don't want
The way I'm doing this is the following:
// here I will reinitialize my ant stack
uint32_t err_code;
app_trace_log("new ant_id - reconnect\n");
err_code = ant_hrm_reset();
APP_ERROR_CHECK(err_code);
nrf_delay_ms(500);
// this line is initially called from main, while initializing BT
SOFTDEVICE_HANDLER_INIT(NRF_CLOCK_LFCLKSRC_XTAL_20_PPM, NULL);
softdevice_setup();
ant_state_indicator_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
profile_setup();
The individual functions are here (mostly standard from the ANT_HRM_DEMO (SDK10).
static void softdevice_setup(void)
{
uint32_t err_code;
err_code = softdevice_ant_evt_handler_set(ant_evt_dispatch);
APP_ERROR_CHECK(err_code);
// comment the next 2 lines - ble_stack_init calls SOFTDEVICE_HANDLER_INIT
//err_code = softdevice_handler_init(NRF_CLOCK_LFCLKSRC, NULL, 0, NULL);
//APP_ERROR_CHECK(err_code);
err_code = ant_stack_static_config();
APP_ERROR_CHECK(err_code);
err_code = ant_plus_key_set(ANTPLUS_NETWORK_NUMBER);
APP_ERROR_CHECK(err_code);
}
static void profile_setup(void)
{
/** @snippet [ANT HRM RX Profile Setup] */
uint32_t err_code;
err_code = ant_hrm_disp_init(&m_ant_hrm,
HRM_DISP_CHANNEL_CONFIG(m_ant_hrm),
ant_hrm_evt_handler);
APP_ERROR_CHECK(err_code);
err_code = ant_hrm_disp_open(&m_ant_hrm);
APP_ERROR_CHECK(err_code);
err_code = ant_state_indicator_channel_opened();
APP_ERROR_CHECK(err_code);
/** @snippet [ANT HRM RX Profile Setup] */
}
What can/should I do, to restart ANT without restarting BLE?
PS: using SD310 and SDK10
Thanks