I want advertise the peripheral periodically only. i implement the logic it is working fine.but my doubt is once i connected to connected to central device advertise is no need.but after stopping the advertisement the device is disconnecting automatically.please can you explain the reason for disconnection.
here i am attaching the code
if(adv_start_time>ADVERTISE_START_INTERVAL)
{
if(adv_start_time==(ADVERTISE_START_INTERVAL+1))
{
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
}
adv_stop_time++;
}
if(adv_stop_time==ADVERTISE_STOP_INTERVAL)
{
advertising_stop();
adv_stop_time=0;
adv_start_time=0;
}