Nordic UART Service (NUS) Client
The Nordic UART Service is a simple GATT-based service with TX and RX characteristics.
Overview
The service is used to send and receive ASCII text strings to and from the peer. Data is received from the peer through notifications, and data is sent directly using the API.
Configuration
Set the CONFIG_BLE_NUS_CLIENT Kconfig option to enable the service.
Initialization
Declare the service instance using the BLE_NUS_CLIENT_DEF macro, specifying the name of the instance.
Call the ble_nus_client_init() function to initialize the service.
See the ble_nus_client_config structure for configuration details.
Usage
Call the ble_nus_client_on_db_disc_evt() function on callback events from the Database Discovery library.
This function sends the BLE_NUS_CLIENT_EVT_DISCOVERY_COMPLETE event to the application if the Nordic UART Service is discovered in the peer’s database.
The application must call the ble_nus_client_handles_assign() function to associate the link with the NUS Client instance.
Events from the service are forwarded through the event handler specified during initialization.
For a full list of events, see the ble_nus_client_evt_type enumeration.
The application can send data to the peer by calling the ble_nus_client_string_send() function.
Dependencies
This library has the following Bare Metal dependencies:
SoftDevice (central role) -
CONFIG_SOFTDEVICE_CENTRALSoftDevice handler (BLE) -
CONFIG_NRF_SDH_BLEBluetooth: Database Discovery library -
CONFIG_BLE_DB_DISCOVERY
The service is typically used with the Bluetooth: Scan Bare Metal library - CONFIG_BLE_SCAN.
API documentation
include/bm/bluetooth/services/ble_nus_client.hsubsys/bluetooth/services/ble_nus_client/