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

Disable notification/permission to pair in NRF52

Hi,

In-app when you scan for device and after it is found you press the connect and then the notification/permission to pair pops out. Our app developers are saying that we must disable this notification in our firmware, but I can't find any similar settings in nRF SDK. If I connect to the device from nRF connect I don't see any notification/permission to pair. 

Can we disable notification/permission to pair in firmware or not? 

Thanks for help

Blaz

Parents
  • Hi, 

    Unfortunately, the BLE stack automatically pops up an alert view to prompt the user to confirm or cancel the pairing process. This is something that is happening on the OS BLE stack, so you won´t be able to prevent it from appearing from the application unless you don't use encrypted characteristics. The bonding process is triggered when you try to read an encrypted characteristic. 

    -Amanda H.

  • Dear Amanda,

    Thank you for your support. 

    Our application was developed from ble_app_bms example. Our BLE security settings were set to pair/no bonding. From your answers, I assume that we must set up BLE connection no pair no bonding?

    Form the instructions form your site it is written No pairing/bonding: NULL (or do not call pm_sec_params_set)

    I have disabled the pm_sec_params_set function and the app is still working. When I connect to the device after a few seconds I get time out message and disconnection of the BLE connection: BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION.

    I find timeouts with disconnection in ble_evt_handler:

    case BLE_GATTC_EVT_TIMEOUT:
    // Disconnect on GATT Client timeout event.
    NRF_LOG_DEBUG("GATT Client Timeout.");
    err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gattc_evt.conn_handle,
    BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    APP_ERROR_CHECK(err_code);
    break;

    case BLE_GATTS_EVT_TIMEOUT:
    // Disconnect on GATT Server timeout event.
    NRF_LOG_DEBUG("GATT Server Timeout.");
    err_code = sd_ble_gap_disconnect(p_ble_evt->evt.gatts_evt.conn_handle,
    BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);
    APP_ERROR_CHECK(err_code)

    But they are not the reason of diconnect.

    Can you please help me out where I can disable this timeout. 

    Regards, 

    Blaz 

  • Hi,

    Thank you for your replay. Which no paring no bonding example is best to check? 

    Regards, 

    Blaz

  • Hi, 

    You could try Heart Rate Application and do not call pm_sec_params_set for no pairing/bonding. 

    -Amanda H.

  • Hi, 

    From log TX report I see that problem is in pm_conn_secure():

    <debug> peer_manager_handler: Connected, securing connection. conn_handle: 0
    <info> app: Connected
    <error> peer_manager_handler: Asserting. pm_conn_secure() returned NRF_ERROR_NOT_FOUND on conn_handle 0.
    <error> app: Fatal error
    <warning> app: System reset
    <info> app: Device turned on
    <info> app: m_whitelist_peer_cnt 1, MAX_PEERS_WLIST 8
    <debug> app: pm_whitelist_get returns 0 addr in whitelist and 0 irk whitelist
    <info> app: Fast advertising.

    I don't know how to disable   Peer Manager event handler. Even if the function is empty the _conn_secure function starts in the background. 

    But if I don't initialize the peer_manager_init() then device won't start:

    <info> app: Device turned on
    <error> app: Fatal error
    <warning> app: System reset

    I see in Blinky example that the  peer_manager_init()  is not used and no paring no bonding is working fine. I don't understand why the device has: <error> app: Fatal error if the  peer_manager_init() is not initialized.

    This request to change come from the customer yesterday and we must start the mass production on Monday.  We are under enormous time pressure so please help me out. 

    Thank you for help,

    Regards, 

    Blaz 

  • If you don't use bond and pair, you do not need to use peer_manager. Blinky example is a good example without that. If you want to modify a bond example to no-bond, HRS example might help you know that. 

    What is your development purpose? 

    -Amanda H

  • The problem is that the whole project was build form the beginning for bonding and pairing. Now the customer has changed his requirements to no pairing no bonding. I don't have time to build the project from scratch this is why I am searching for a solution on how to disable peering and bonding in the existing projects. 

    Do you maybe now why this happens if I don't use peer_manager:

    <info> app: Device turned on
    <error> app: Fatal error
    <warning> app: System reset

    The device is in reset all the time. 

    If I disable the peer manager in sdk_config.h I get a lot of errors because of the functions used in a project were built-in.

    #ifndef PEER_MANAGER_ENABLED
    #define PEER_MANAGER_ENABLED 0

    The device is a massage gun with custom characteristics that can be controlled with mobile app. 

    Regards, 

    Blaz

Reply
  • The problem is that the whole project was build form the beginning for bonding and pairing. Now the customer has changed his requirements to no pairing no bonding. I don't have time to build the project from scratch this is why I am searching for a solution on how to disable peering and bonding in the existing projects. 

    Do you maybe now why this happens if I don't use peer_manager:

    <info> app: Device turned on
    <error> app: Fatal error
    <warning> app: System reset

    The device is in reset all the time. 

    If I disable the peer manager in sdk_config.h I get a lot of errors because of the functions used in a project were built-in.

    #ifndef PEER_MANAGER_ENABLED
    #define PEER_MANAGER_ENABLED 0

    The device is a massage gun with custom characteristics that can be controlled with mobile app. 

    Regards, 

    Blaz

Children
  • You don't need to remove or disable PEER_MANAGER.

    I tried to comment on peer_manager_init(); or  pm_sec_params_set() for no bonding in the HRS example, and it still can work. 

    -Amanda H.

  • Hi,

    I have copied the following functions from HRS to our APP:

    - on_adv_evt(ble_adv_evt_t ble_adv_evt)

    - ble_evt_handler(ble_evt_t const * p_ble_evt, void * p_context)

    -  pm_evt_handler(pm_evt_t const * p_evt)

    I delited the our delete_bonds() and whitelist_set() form the code. Now the app is working with no paring and no bondig the peer_manager_init(); is commented. 

    .

    Now I have a problem that our custom characteristics are not reacting to any commands. 

    I check in the code and I didn't find any connection between parring and custom characteristic.

    Do you have any advice, where should be the problem :) 

    Regards, 

    Blaz 

  • Hi Blaz, 

    Could you provide the error log on both sides?

    In the segger project, you can enable log in the sdk_cofig.h and compile with the debug mode.

      

    -Amanda H.

  • Dear Amanda,

    Thank you for your prompt support. Because of big changes in code, which will be very risky at this moment, the customer has decided that we go back to paring and bonding. 

    In the next version, we will implement no preparation, no bonding. In our custom characteristic, we have the following properties:

    RLX_VIBRATION_LEVEL_CHAR_UUID     0x456b    notify-read/write
    RLX_MOTOR_CURRENT_CHAR_UUID    0x456c    notify-read
    RLX_CHRG_CURRENT_CHAR_UUID       0x456d    notify-read
    RLX_TEMP_CHAR_UUID                           0x456e    notify-read
    RLX_BAT_VOLTAGE_UUID                        0x456f    notify-read
    RLX_TEST_CHAR_UUID                            0x4570   notify-read/write
    RLX_PRESSURE_LEVEL_CHAR_UUID    0x4571   notify-read

    From which example it will be the best to start if we want to build up the app from scratch wit no paring no bonding. Do you think the blinky example is most appropriate? 

    The current application was not built by us we got it from customer and some other developers were developing it. Now we would like to build it again the right way. 

    Regards, 

    Blaz 

  • Hi Blaz, 

    We usually suggest starting from the Template Application example which doesn't use encrypted characteristics, so the mobile won't pop up a window to ask pairing or bonding. Users could use service under bond or no-bond. The blinky example does not use the peer manager library and bond/pair. It might be a good example to fit your requirements. 

    -Amanda H.

Related