Skip to content

Commit 27124bd

Browse files
ArekBalysNordicm-alperen-sener
authored andcommitted
samples: matter: Align Matter NUS to APP_PASSKEY
CONFIG_BT_FIXED_PASSKEY has been deprecated. We switched to CONFIG_BT_APP_PASSKEY and added a migration guide entry. Signed-off-by: Arkadiusz Balys <[email protected]>
1 parent fb96d79 commit 27124bd

File tree

6 files changed

+37
-3
lines changed

6 files changed

+37
-3
lines changed

doc/nrf/releases_and_maturity/migration/migration_guide_3.2.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,24 @@ Matter
8989

9090
To build your custom board with Wi-Fi support, set both the :kconfig:option:`CONFIG_CHIP_WIFI` and :kconfig:option:`CONFIG_WIFI_NRF70` Kconfig options to ``y``.
9191

92+
* :ref:`matter_lock_sample` sample:
93+
94+
* The :kconfig:option:`CONFIG_BT_FIXED_PASSKEY` kconfig option has been deprecated, replace it with the :kconfig:option:`CONFIG_BT_APP_PASSKEY` kconfig option.
95+
Now, if you want to use a fixed passkey for the Matter Lock NUS service, register the ``app_passkey`` callback in the ``bt_conn_auth_cb`` structure.
96+
97+
For example:
98+
99+
.. code-block:: c
100+
101+
static uint32_t AuthAppPasskey(struct bt_conn *conn)
102+
{
103+
return 123456;
104+
}
105+
106+
static struct bt_conn_auth_cb sConnAuthCallbacks = {
107+
.app_passkey = AuthAppPasskey,
108+
};
109+
92110
Serial LTE modem
93111
----------------
94112

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

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

576576
* Added a callback for the auto-relock feature.
577577
This resolves the :ref:`known issue <known_issues>` KRKNWK-20691.
578+
* Updated the NUS service to use the :kconfig:option:`CONFIG_BT_APP_PASSKEY` Kconfig option instead of the deprecated :kconfig:option:`CONFIG_BT_FIXED_PASSKEY` Kconfig option.
578579

579580
Networking samples
580581
------------------

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

Lines changed: 13 additions & 1 deletion
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 /* defined(CONFIG_BT_APP_PASSKEY) */
3437
};
3538
bt_conn_auth_info_cb Nrf::NUSService::sConnAuthInfoCallbacks = {
3639
.pairing_complete = PairingComplete,
@@ -40,7 +43,8 @@ bt_nus_cb Nrf::NUSService::sNusCallbacks = {
4043
.received = RxCallback,
4144
};
4245

43-
namespace Nrf {
46+
namespace Nrf
47+
{
4448

4549
NUSService NUSService::sInstance;
4650

@@ -234,6 +238,14 @@ void NUSService::AuthPasskeyDisplay(bt_conn *conn, unsigned int passkey)
234238
LOG_INF("PROVIDE THE FOLLOWING CODE IN YOUR MOBILE APP: %d", passkey);
235239
}
236240

241+
#if defined(CONFIG_BT_APP_PASSKEY)
242+
uint32_t NUSService::AuthAppPasskey(bt_conn *conn)
243+
{
244+
return CONFIG_CHIP_NUS_FIXED_PASSKEY;
245+
}
246+
#endif /* defined(CONFIG_BT_APP_PASSKEY) */
247+
248+
237249
void NUSService::AuthCancel(bt_conn *conn)
238250
{
239251
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
@@ -85,6 +85,9 @@ class NUSService {
8585
static void PairingComplete(struct bt_conn *conn, bool bonded);
8686
static void PairingFailed(struct bt_conn *conn, enum bt_security_err reason);
8787
static char* LogAddress(struct bt_conn *conn);
88+
#if defined(CONFIG_BT_APP_PASSKEY)
89+
static uint32_t AuthAppPasskey(struct bt_conn *conn);
90+
#endif /* defined(CONFIG_BT_APP_PASSKEY) */
8891

8992
static struct bt_conn_auth_cb sConnAuthCallbacks;
9093
static struct bt_conn_auth_info_cb sConnAuthInfoCallbacks;

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

west.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ manifest:
156156
- name: matter
157157
repo-path: sdk-connectedhomeip
158158
path: modules/lib/matter
159-
revision: e5f2a2ff99493d9862a3aa5e370681287cf53cf0
159+
revision: pull/653/head
160160
west-commands: scripts/west/west-commands.yml
161161
submodules:
162162
- name: nlio

0 commit comments

Comments
 (0)