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

How I can remove GATT service but not reset chip ?

Hi all, I use NRF52832.

I have a problem. I want when I connect to my chip and bond. After bond success, I insert new service. And when I disconnect from my chip, new service will be removed. This is to prevent others from reading my service. Now, I can insert new service but I can't remove service when I disconnect. But when disconnect, I don't want to reset entity chip. This is requirement.

So , Pls show me an solution !! Thank

Parents
  • Hi Giang,

    Why do you need to remove the service? Wouldn't adjusting the security parameters do just as well?

    Points to note:

    • Other devices can only accesses your services once they have connected. 
    • Service UUIDs are only included within the advertising packet if you specify it.
    • As you are bonding you can restrict all connections to bonded devices /whitelist only.
    • If you only allow one connection at a time then whilst a device is connected no others can read the data.
  • Can you show me How I can disable and reinit SD ?

    I follow step for disable SD : 

    err_code = sd_softdevice_disable();
    APP_ERROR_CHECK(err_code);
    sd_softdevice_is_enabled(&res);
    if(res)
    {
    NRF_LOG_INFO("SD is disabled");
    }
    else
    {
    NRF_LOG_INFO("SD is enabled");
    }

    But It printf "SD is disabled" but my chip still advertising. Why ? And when I reinit SD by funtion ble_stack_init(); It return error NRF_ERROR_INVALID_STATE ,  m_nrf_sdh_enabled = true .

    Thank

Reply
  • Can you show me How I can disable and reinit SD ?

    I follow step for disable SD : 

    err_code = sd_softdevice_disable();
    APP_ERROR_CHECK(err_code);
    sd_softdevice_is_enabled(&res);
    if(res)
    {
    NRF_LOG_INFO("SD is disabled");
    }
    else
    {
    NRF_LOG_INFO("SD is enabled");
    }

    But It printf "SD is disabled" but my chip still advertising. Why ? And when I reinit SD by funtion ble_stack_init(); It return error NRF_ERROR_INVALID_STATE ,  m_nrf_sdh_enabled = true .

    Thank

Children
No Data
Related