nRF Connect SDK API 2.8.99
Loading...
Searching...
No Matches
nus_client.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 Nordic Semiconductor ASA
3 *
4 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5 */
6
7#ifndef BT_NUS_CLIENT_H_
8#define BT_NUS_CLIENT_H_
9
17#ifdef __cplusplus
18extern "C" {
19#endif
20
21#include <zephyr/bluetooth/gatt.h>
22#include <zephyr/bluetooth/conn.h>
23#include <bluetooth/gatt_dm.h>
24
29
33 uint16_t rx;
34
38 uint16_t tx;
39
43 uint16_t tx_ccc;
44};
45
46struct bt_nus_client;
47
62 uint8_t (*received)(struct bt_nus_client *nus, const uint8_t *data, uint16_t len);
63
73 void (*sent)(struct bt_nus_client *nus, uint8_t err, const uint8_t *data, uint16_t len);
74
81 void (*unsubscribed)(struct bt_nus_client *nus);
82};
83
86
88 struct bt_conn *conn;
89
91 atomic_t state;
92
97
99 struct bt_gatt_subscribe_params tx_notif_params;
100
102 struct bt_gatt_write_params rx_write_params;
103
106};
107
114
127 const struct bt_nus_client_init_param *init_param);
128
143int bt_nus_client_send(struct bt_nus_client *nus, const uint8_t *data,
144 uint16_t len);
145
162int bt_nus_handles_assign(struct bt_gatt_dm *dm,
163 struct bt_nus_client *nus);
164
177
178#ifdef __cplusplus
179}
180#endif
181
186#endif /* BT_NUS_CLIENT_H_ */
int bt_nus_handles_assign(struct bt_gatt_dm *dm, struct bt_nus_client *nus)
Assign handles to the NUS Client instance.
int bt_nus_client_send(struct bt_nus_client *nus, const uint8_t *data, uint16_t len)
Send data to the server.
int bt_nus_client_init(struct bt_nus_client *nus, const struct bt_nus_client_init_param *init_param)
Initialize the NUS Client module.
int bt_nus_subscribe_receive(struct bt_nus_client *nus)
Request the peer to start sending notifications for the TX Characteristic.
void(* sent)(struct bt_nus_client *nus, uint8_t err, const uint8_t *data, uint16_t len)
Data sent callback.
Definition nus_client.h:73
uint8_t(* received)(struct bt_nus_client *nus, const uint8_t *data, uint16_t len)
Data received callback.
Definition nus_client.h:62
void(* unsubscribed)(struct bt_nus_client *nus)
TX notifications disabled callback.
Definition nus_client.h:81
NUS Client callback structure.
Definition nus_client.h:49
uint16_t tx_ccc
Definition nus_client.h:43
uint16_t rx
Definition nus_client.h:33
uint16_t tx
Definition nus_client.h:38
Handles on the connected peer device that are needed to interact with the device.
Definition nus_client.h:28
struct bt_nus_client_cb cb
Definition nus_client.h:112
NUS Client initialization structure.
Definition nus_client.h:109
struct bt_nus_client_handles handles
Definition nus_client.h:96
struct bt_conn * conn
Definition nus_client.h:88
struct bt_gatt_subscribe_params tx_notif_params
Definition nus_client.h:99
atomic_t state
Definition nus_client.h:91
struct bt_nus_client_cb cb
Definition nus_client.h:105
struct bt_gatt_write_params rx_write_params
Definition nus_client.h:102
NUS Client structure.
Definition nus_client.h:85