Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs

How to disable pairing after a certain timeout.

I am working on nRF52833 board (PCA10100).  I am pairing my peripheral device ( Nordic Board ) to the Mobile Application. I have to disable pairing after a certain timeout. I am not sure how to disable pairing, is there any specific API to do that.  I came across this specific from the document.

```

Optionally, call pm_sec_params_set to set the security parameters. If you do not call this function, pairing and bonding is not supported.

```

is this the only way method to disable pairing after certain timeout, since I doubt whether we have have to call the peer_manager_init() once again after the timeout without pm_sec_params_set().

static void peer_manager_init(void)
{
	ble_gap_sec_params_t sec_param;
	ret_code_t           err_code;


	err_code = pm_init();
	APP_ERROR_CHECK(err_code);

	memset(&sec_param, 0, sizeof(ble_gap_sec_params_t));

	// Security parameters to be used for all security procedures.
	sec_param.bond           = SEC_PARAM_BOND;
	sec_param.mitm           = SEC_PARAM_MITM;
	sec_param.lesc           = SEC_PARAM_LESC;
	sec_param.keypress       = SEC_PARAM_KEYPRESS;
	sec_param.io_caps        = SEC_PARAM_IO_CAPABILITIES;
	sec_param.oob            = SEC_PARAM_OOB;
	sec_param.min_key_size   = SEC_PARAM_MIN_KEY_SIZE;
	sec_param.max_key_size   = SEC_PARAM_MAX_KEY_SIZE;
	sec_param.kdist_own.enc  = 1;
	sec_param.kdist_own.id   = 1;
	sec_param.kdist_peer.enc = 1;
	sec_param.kdist_peer.id  = 1;

	err_code = pm_sec_params_set(&sec_param);
	APP_ERROR_CHECK(err_code);

	err_code = pm_register(pm_evt_handler);
	APP_ERROR_CHECK(err_code);
}

Specifications:

SDK - nRF5_SDK_17.1.0

Related