from this post link text i have again doubt
i define #define APP_ADV_TIMEOUT_IN_SECONDS 10. now my advertising stops after 10 sec.but i want to restart it again then??
from this post link text i have again doubt
i define #define APP_ADV_TIMEOUT_IN_SECONDS 10. now my advertising stops after 10 sec.but i want to restart it again then??
You can at any time call sd_ble_gap_adv_start again to restart advertisement. (in advertising_start() in most of the examples)
You can at any time call sd_ble_gap_adv_start again to restart advertisement. (in advertising_start() in most of the examples)
my function is like that
static void advertising_init(void)
{
uint32_t err_code;
ble_advdata_t advdata;
ble_advdata_t scanrsp;
// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_FULL_NAME;
advdata.include_appearance = false;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
memset(&scanrsp, 0, sizeof(scanrsp));
scanrsp.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
scanrsp.uuids_complete.p_uuids = m_adv_uuids;
ble_adv_modes_config_t options = {0};
options.ble_adv_fast_enabled = BLE_ADV_FAST_ENABLED;
options.ble_adv_fast_interval = APP_ADV_INTERVAL;
options.ble_adv_fast_timeout = APP_ADV_TIMEOUT_IN_SECONDS;
err_code = ble_advertising_init(&advdata, &scanrsp, &options, on_adv_evt, NULL);
APP_ERROR_CHECK(err_code);
}
int main(void) { uint32_t err_code; bool erase_bonds; uint8_t start_string[] = START_STRING;
// Initialize.
APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
uart_init();
buttons_leds_init(&erase_bonds);
ble_stack_init();
gap_params_init();
services_init();
advertising_init();
conn_params_init();
printf("%s",start_string);
err_code = ble_advertising_start(BLE_ADV_MODE_FAST);
APP_ERROR_CHECK(err_code);
// Enter main loop.
for (;;)
{
power_manage();
}
}
APP_ADV_TIMEOUT_IN_SECONDS is 10 second. once advertisement starts then i want to put it in sleep mode after 10 second then i want to make it advertise again. how it is possible. my one problem is aalso that if i don't define advertisement time out, power_manage() function don't stop advertising