Go to the source code of this file.
|
struct | bt_nus_cb |
| Callbacks for getting notified on NUS Service occurrences. More...
|
|
|
#define | BT_UUID_NUS_SRV_VAL BT_UUID_128_ENCODE(0x6e400001, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e) |
| UUIDs of Nordic UART GATT Service.
|
|
#define | BT_UUID_NUS_RX_CHAR_VAL BT_UUID_128_ENCODE(0x6e400002, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e) |
|
#define | BT_UUID_NUS_TX_CHAR_VAL BT_UUID_128_ENCODE(0x6e400003, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e) |
|
#define | BT_NUS_INST_DEFINE(_name) Z_INTERNAL_BT_NUS_INST_DEFINE(_name) |
| Macro to define instance of NUS Service.
|
|
◆ BT_NUS_INST_DEFINE
#define BT_NUS_INST_DEFINE |
( |
|
_name | ) |
Z_INTERNAL_BT_NUS_INST_DEFINE(_name) |
Macro to define instance of NUS Service.
It allows users to define multiple NUS instances, analogous to Serial endpoints, and use each one for different purposes. A default NUS instance may be defined through Kconfig.
◆ BT_UUID_NUS_RX_CHAR_VAL
#define BT_UUID_NUS_RX_CHAR_VAL BT_UUID_128_ENCODE(0x6e400002, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e) |
◆ BT_UUID_NUS_SRV_VAL
#define BT_UUID_NUS_SRV_VAL BT_UUID_128_ENCODE(0x6e400001, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e) |
UUIDs of Nordic UART GATT Service.
Service: 6e400001-b5a3-f393-e0a9-e50e24dcca9e RX Char: 6e400002-b5a3-f393-e0a9-e50e24dcca9e TX Char: 6e400003-b5a3-f393-e0a9-e50e24dcca9e
◆ BT_UUID_NUS_TX_CHAR_VAL
#define BT_UUID_NUS_TX_CHAR_VAL BT_UUID_128_ENCODE(0x6e400003, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e) |
◆ bt_nus_cb_register()
static int bt_nus_cb_register |
( |
struct bt_nus_cb * |
cb, |
|
|
void * |
ctx |
|
) |
| |
|
inlinestatic |
NUS server callback register.
- Parameters
-
cb | Pointer to callbacks structure. Must be valid throughout the lifetime of the application. |
ctx | User context to be provided through the callback. |
- Returns
- 0 on success, negative error code if failed.
-
-EINVAL in case
cb
is NULL
◆ bt_nus_inst_cb_register()
NUS server Instance callback register.
This function registers callbacks that will be called in certain events related to NUS.
- Parameters
-
inst | Pointer to instance of NUS service. NULL if using default instance. |
cb | Pointer to callbacks structure. Must be valid throughout the lifetime of the application. |
ctx | User context to be provided through the callback. |
- Returns
- 0 on success
-
-EINVAL in case
cb
is NULL
◆ bt_nus_inst_send()
int bt_nus_inst_send |
( |
struct bt_conn * |
conn, |
|
|
struct bt_nus_inst * |
inst, |
|
|
const void * |
data, |
|
|
uint16_t |
len |
|
) |
| |
Send Data to NUS Instance.
- Note
- This API sends the data to the specified peer.
- Parameters
-
conn | Connection object to send data to. NULL if notifying all peers. |
inst | Pointer to instance of NUS service. NULL if using default instance. |
data | Pointer to buffer with bytes to send. |
len | Length in bytes of data to send. |
- Returns
- 0 on success, negative error code if failed.
-
-EAGAIN when Bluetooth stack has not been enabled.
-
-ENOTCONN when either no connection has been established or no peers have subscribed.
◆ bt_nus_send()
static int bt_nus_send |
( |
struct bt_conn * |
conn, |
|
|
const void * |
data, |
|
|
uint16_t |
len |
|
) |
| |
|
inlinestatic |
Send Data over NUS.
- Note
- This API sends the data to the specified peer.
- Parameters
-
conn | Connection object to send data to. NULL if notifying all peers. |
data | Pointer to buffer with bytes to send. |
len | Length in bytes of data to send. |
- Returns
- 0 on success, negative error code if failed.
-
-EAGAIN when Bluetooth stack has not been enabled.
-
-ENOTCONN when either no connection has been established or no peers have subscribed.