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

Turn of Bonding for the GLS Example

Support,

I am using the ble_app_gls_pac19956_140 example on the nRF 52840 DK.  I wish to use this application as a foundation for my new sensor.

I wanted to disable the bonding requirement.  I have had difficulty doing so.  Can you help me?

Thanks,

Rich

  • Hi Rich,

    Do you just want to remove bonding and keep pairing? Or remove security altogether? If you want to remove bonding, then simply set the SEC_PARAM_BOND to define to 0.

    If you want to remove security altogether you can do that by removing the call to peer_manager_init() (and other calls to the peer manager to be clean). In this case, you also need to modify the security level for the Glucose service characteristics, by replacing any instance of SEC_JUST_WORKS with SEC_OPEN. The diff below shows the bare minimum modifications needed for the GLS example in SDK 16, but you should remove all peer manager related code in this case:

    diff --git a/examples/ble_peripheral/ble_app_gls/main.c b/examples/ble_peripheral/ble_app_gls/main.c
    index 6a6f104..eb6ac08 100644
    --- a/examples/ble_peripheral/ble_app_gls/main.c
    +++ b/examples/ble_peripheral/ble_app_gls/main.c
    @@ -430,10 +430,10 @@ static void services_init(void)
         gls_init.is_context_supported = false;
     
         // Here the sec level for the Glucose Service can be changed/increased.
    -    gls_init.gl_meas_cccd_wr_sec = SEC_JUST_WORKS;
    -    gls_init.gl_feature_rd_sec   = SEC_JUST_WORKS;
    -    gls_init.racp_cccd_wr_sec    = SEC_JUST_WORKS;
    -    gls_init.racp_wr_sec         = SEC_JUST_WORKS;
    +    gls_init.gl_meas_cccd_wr_sec = SEC_OPEN;
    +    gls_init.gl_feature_rd_sec   = SEC_OPEN;
    +    gls_init.racp_cccd_wr_sec    = SEC_OPEN;
    +    gls_init.racp_wr_sec         = SEC_OPEN;
     
         err_code = ble_gls_init(&m_gls, &gls_init);
         APP_ERROR_CHECK(err_code);
    @@ -608,7 +608,7 @@ static void ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)
     {
         ret_code_t err_code;
     
    -    pm_handler_secure_on_connection(p_ble_evt);
    +    //pm_handler_secure_on_connection(p_ble_evt);
     
         switch (p_ble_evt->header.evt_id)
         {
    @@ -945,7 +945,7 @@ int main(void)
         services_init();
         sensor_simulator_init();
         conn_params_init();
    -    peer_manager_init();
    +    //peer_manager_init();
     
         // Start execution.
         NRF_LOG_INFO("Glucose example started.");
    

    Einar

Related