This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

experimental_ble_app_multiperipheral example ble advertising UUID re-setting &restart (connecting)

Hi. Thank you for your interest in my writing.
I'm working on the IOS and the Multiple Connection project at the experimental_ble_app_multiperial example.
My current project is to implement (Peripheral) 1 : N (IOS) Connection.

You must reset the adaptive uuid while maintaining the connection state.
Sometimes you reset the UUID and start the ble_advertising_start, and the result is NRF_ERROR_INVALID_STATE.
The reason is that we're already performing inverting, but we're guessing that the error is caused by conducting the inverting start again.

What I want to know now is "check the BLE Advertising State" and I need a BLE Advertising Watchman.
And you need the "advertising stop command".

I tried sd_ble_gap_adv_stop to stop it.
Run result err_code : 0 is last stopped.
What's the solution?

1. BLE Advertising State watchdog
2. BLE Advertising State Check
3. BLE Advertising Stop Command

Chip : nRF52832
Softdevice : s132_nrf52_4.0.2_softdevice
SDK : nRF5_SDK_13.0.0_04a0bfd

example source : experimental_ble_app_multiperipheral

Thank you for reading the long story.
Please

  • Hi

    The INVALID_STATE error when you start advertising points to the device thinking it still is in a connection or already is advertising. It also could be that the advertising module is not initialized, which seems most likely here, since you say you stop advertising like this. In our examples, when we'd like to update the advertising data, we generally do it like this:

    void advertising_update(void)
    {
        NRF_LOG_INFO("advertising_update\n");
        ret_code_t err_code;
    
        /* Stop Advertising, so as to enable it to be updated */
        err_code = sd_ble_gap_adv_stop(m_adv_handle);
        APP_ERROR_CHECK(err_code);
      
        /* Init Advertising data */ 
        advertising_init();
    
        /* Restart Advertising */
        err_code = sd_ble_gap_adv_start(m_adv_handle, APP_BLE_CONN_CFG_TAG);
        APP_ERROR_CHECK(err_code);
    }

    Can you provide a snippet of code showing your advertising stop, reinitializing and advertising start functions?

    Best regards,

    Simon

Related