NUS service

The Door Lock Nordic UART Service (NUS) wrapper is built on the nRF Connect SDK Nordic UART Service (NUS) GATT service. It receives commands over Bluetooth LE and dispatches them to registered callbacks, providing a UART-style command channel for proprietary remote lock control.

For transport context and how NUS fits alongside other Bluetooth LE services, see Nordic UART Service (NUS). For step-by-step pairing and command testing, see Bluetooth LE Nordic UART Service (NUS) (Aliro Access Control Application) and Bluetooth LE Nordic UART Service (NUS) (Matter and Aliro Door Lock Application).

Source

The module is located in the subsys/nus_service/ directory. The public API is declared in the subsys/nus_service/include/nus_service/nus_service.h file.

Security

The reference applications start NUS advertising during application initialization and register Lock and Unlock commands for remote bolt control. This path is independent of Aliro authentication and Matter network membership.

The service uses the default Bluetooth identity. NUS cannot run concurrently with Matter commissioning or SMP DFU on that identity. See Nordic UART Service (NUS) for connection limits and the CONFIG_BT_MAX_CONN Kconfig option for further guidance.

Pairing is required. Incoming commands are processed only when the connection security level is L2 or higher.

The module uses the advertising arbiter when multiple Bluetooth LE services share the default identity.

When the lock state changes, the reference applications can send short status strings (for example locked or unlocked) back to the connected NUS client.

Kconfig options

Configure the NUS service through Kconfig options in prj.conf as listed below. The bt_nus snippet sets the wrapper options and the Bluetooth LE manager authentication options in snippets/bt_nus/bt_nus.conf.

Kconfig option

Description

CONFIG_DOOR_LOCK_NUS_SERVICE

Enables the Door Lock NUS service wrapper.

CONFIG_DOOR_LOCK_NUS_SERVICE_MAX_COMMANDS

Maximum number of registered commands (default 2).

CONFIG_DOOR_LOCK_NUS_SERVICE_MAX_COMMAND_LEN

Maximum length of a single command token in bytes (default 10).

CONFIG_DOOR_LOCK_NUS_SERVICE_LOG_LEVEL

Log level for the module.

Option definitions and defaults are in subsys/nus_service/Kconfig.

Usage

Enable the module by building the application with the bt_nus snippet.

Pass the snippet to west build using the application-specific symbol:

west build -p -b <build_target> applications/aliro-access-control-app -- \
    -Daliro-access-control-app_SNIPPET=bt_nus

west build -p -b <build_target> applications/matter-aliro-door-lock-app -- \
    -Dmatter-aliro-door-lock-app_SNIPPET=bt_nus

To combine with other snippets, separate their names with semicolons, for example:

-Daliro-access-control-app_SNIPPET='uwb_qm35;bt_nus'

After flashing, pair with the device and send commands using the steps in Bluetooth LE Nordic UART Service (NUS) or Bluetooth LE Nordic UART Service (NUS).