i got problem wher program cant go in while loop in main while advertising is running. Im using ble uart template. So was thinking to stop advertising when button is pressed but i didnt find solution noowher how to stop advertising. In beacon mode i can acces to while loop in main.
Here is my funtion to start advertising.
uint32_t err_code = ble_advertising_start(&m_advertising, BLE_ADV_MODE_FAST );
Kev said:program cant go in while loop in main while advertising is running
What, exactly, do you mean by that.
It doesn't seem to make much sense - pretty much all of the SDK examples enter their main while loop while they are advertising!
To Stop (and re-start) advertising, see:
static void advertising_init(void)
memset(&init, 0, sizeof(init));
init.advdata.name_type = BLE_ADVDATA_FULL_NAME;
init.advdata.include_appearance = false;
init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_LIMITED_DISC_MODE;
init.srdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids);
init.srdata.uuids_complete.p_uuids = m_adv_uuids;
init.config.ble_adv_fast_enabled = true;
init.config.ble_adv_fast_interval = APP_ADV_INTERVAL;
init.config.ble_adv_fast_timeout = APP_ADV_DURATION;
init.evt_handler = on_adv_evt;
err_code = ble_advertising_init(&m_advertising, &init);
Here is my advertising_init function.