17#include <zephyr/types.h>
18#include <zephyr/bluetooth/conn.h>
19#include <zephyr/bluetooth/uuid.h>
20#include <zephyr/bluetooth/gatt.h>
27#define BT_UUID_NUS_VAL \
28 BT_UUID_128_ENCODE(0x6e400001, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e)
31#define BT_UUID_NUS_TX_VAL \
32 BT_UUID_128_ENCODE(0x6e400003, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e)
35#define BT_UUID_NUS_RX_VAL \
36 BT_UUID_128_ENCODE(0x6e400002, 0xb5a3, 0xf393, 0xe0a9, 0xe50e24dcca9e)
38#define BT_UUID_NUS_SERVICE BT_UUID_DECLARE_128(BT_UUID_NUS_VAL)
39#define BT_UUID_NUS_RX BT_UUID_DECLARE_128(BT_UUID_NUS_RX_VAL)
40#define BT_UUID_NUS_TX BT_UUID_DECLARE_128(BT_UUID_NUS_TX_VAL)
62 const uint8_t *
const data, uint16_t len);
72 void (*
sent)(
struct bt_conn *conn);
114int bt_nus_send(
struct bt_conn *conn,
const uint8_t *data, uint16_t len);
126 return bt_gatt_get_mtu(conn) - 3;
int bt_nus_init(struct bt_nus_cb *callbacks)
Initialize the service.
bt_nus_send_status
NUS send status.
Definition nus.h:43
@ BT_NUS_SEND_STATUS_DISABLED
Definition nus.h:47
@ BT_NUS_SEND_STATUS_ENABLED
Definition nus.h:45
int bt_nus_send(struct bt_conn *conn, const uint8_t *data, uint16_t len)
Send data.
static uint32_t bt_nus_get_mtu(struct bt_conn *conn)
Get maximum data length that can be used for bt_nus_send.
Definition nus.h:122
void(* send_enabled)(enum bt_nus_send_status status)
Send state callback.
Definition nus.h:80
void(* received)(struct bt_conn *conn, const uint8_t *const data, uint16_t len)
Data received callback.
Definition nus.h:61
void(* sent)(struct bt_conn *conn)
Data sent callback.
Definition nus.h:72
Pointers to the callback functions for service events.
Definition nus.h:51