Skip to content

Commit 0d6a557

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 1976e39 commit 0d6a557

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

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

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ BT_CONN_CB_DEFINE(conn_callbacks) = {
3131
bt_conn_auth_cb Nrf::NUSService::sConnAuthCallbacks = {
3232
.passkey_display = AuthPasskeyDisplay,
3333
.cancel = AuthCancel,
34+
.app_passkey = AuthAppPasskey,
3435
};
3536
bt_conn_auth_info_cb Nrf::NUSService::sConnAuthInfoCallbacks = {
3637
.pairing_complete = PairingComplete,
@@ -71,11 +72,6 @@ bool NUSService::Init(uint8_t priority, uint16_t minInterval, uint16_t maxInterv
7172
LOG_DBG("NUS BLE advertising stopped");
7273
};
7374

74-
#if defined(CONFIG_BT_FIXED_PASSKEY)
75-
if (bt_passkey_set(CONFIG_CHIP_NUS_FIXED_PASSKEY) != 0)
76-
return false;
77-
#endif
78-
7975
return true;
8076
}
8177

@@ -234,6 +230,11 @@ void NUSService::AuthPasskeyDisplay(bt_conn *conn, unsigned int passkey)
234230
LOG_INF("PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: %d", passkey);
235231
}
236232

233+
uint32_t NUSService::AuthAppPasskey(bt_conn *conn)
234+
{
235+
return CONFIG_CHIP_NUS_FIXED_PASSKEY;
236+
}
237+
237238
void NUSService::AuthCancel(bt_conn *conn)
238239
{
239240
LOG_INF("NUS BT Pairing cancelled: %s", LogAddress(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)