Skip to content

Commit d30f085

Browse files
sample: matter: Door Lock sample uses BT_APP_PASSKEY
BT_FIXED_APPKEY is deprecated. Signed-off-by: alperen sener <[email protected]>
1 parent 2521bf9 commit d30f085

File tree

4 files changed

+15
-6
lines changed

4 files changed

+15
-6
lines changed

doc/nrf/releases_and_maturity/releases/release-notes-changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -571,6 +571,7 @@ Matter samples
571571

572572
* Added a callback for the auto-relock feature.
573573
This resolves the :ref:`known issue <known_issues>` KRKNWK-20691.
574+
* Updated to use the :kconfig:option:`CONFIG_BT_APP_PASSKEY` option instead of the deprecated :kconfig:option:`CONFIG_BT_FIXED_PASSKEY` option.
574575

575576
Networking samples
576577
------------------

samples/matter/common/src/bt_nus/bt_nus_service.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
3131
bt_conn_auth_cb Nrf::NUSService::sConnAuthCallbacks = {
3232
.passkey_display = AuthPasskeyDisplay,
3333
.cancel = AuthCancel,
34+
#if defined(CONFIG_BT_APP_PASSKEY)
35+
.app_passkey = AuthAppPasskey,
36+
#endif /* CONFIG_BT_APP_PASSKEY */
3437
};
3538
bt_conn_auth_info_cb Nrf::NUSService::sConnAuthInfoCallbacks = {
3639
.pairing_complete = PairingComplete,
@@ -71,11 +74,6 @@ bool NUSService::Init(uint8_t priority, uint16_t minInterval, uint16_t maxInterv
7174
LOG_DBG("NUS BLE advertising stopped");
7275
};
7376

74-
#if defined(CONFIG_BT_FIXED_PASSKEY)
75-
if (bt_passkey_set(CONFIG_CHIP_NUS_FIXED_PASSKEY) != 0)
76-
return false;
77-
#endif
78-
7977
return true;
8078
}
8179

@@ -234,6 +232,13 @@ void NUSService::AuthPasskeyDisplay(bt_conn *conn, unsigned int passkey)
234232
LOG_INF("PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: %d", passkey);
235233
}
236234

235+
#if defined(CONFIG_BT_APP_PASSKEY)
236+
uint32_t NUSService::AuthAppPasskey(bt_conn *conn)
237+
{
238+
return CONFIG_CHIP_NUS_FIXED_PASSKEY;
239+
}
240+
#endif /* CONFIG_BT_APP_PASSKEY */
241+
237242
void NUSService::AuthCancel(bt_conn *conn)
238243
{
239244
LOG_INF("NUS BT Pairing cancelled: %s", LogAddress(conn));

samples/matter/common/src/bt_nus/bt_nus_service.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ class NUSService {
8282
static void RxCallback(struct bt_conn *conn, const uint8_t *const data, uint16_t len);
8383
static void AuthPasskeyDisplay(struct bt_conn *conn, unsigned int passkey);
8484
static void AuthCancel(struct bt_conn *conn);
85+
#if defined(CONFIG_BT_APP_PASSKEY)
86+
static uint32_t AuthAppPasskey(struct bt_conn *conn);
87+
#endif /* CONFIG_BT_APP_PASSKEY */
8588
static void PairingComplete(struct bt_conn *conn, bool bonded);
8689
static void PairingFailed(struct bt_conn *conn, enum bt_security_err reason);
8790
static char* LogAddress(struct bt_conn *conn);

samples/matter/lock/sample.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ tests:
124124
build_only: true
125125
extra_args:
126126
- CONFIG_CHIP_NUS=y
127-
- CONFIG_BT_FIXED_PASSKEY=y
127+
- CONFIG_BT_APP_PASSKEY=y
128128
- CONFIG_CHIP_NUS_FIXED_PASSKEY=112233
129129
integration_platforms:
130130
- nrf52840dk/nrf52840

0 commit comments

Comments
 (0)