NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
prov_bearer.h
1/* Bluetooth Mesh */
2
3/*
4 * Copyright (c) 2020 Nordic Semiconductor ASA
5 *
6 * SPDX-License-Identifier: Apache-2.0
7 */
8
9#define PROTOCOL_TIMEOUT K_SECONDS(60)
10
15#if MYNEWT_VAL(BLE_MESH_PB_GATT)
16#define PROV_BEARER_BUF_HEADROOM 5
17#else
18#define PROV_BEARER_BUF_HEADROOM 0
19#endif
20
21enum prov_bearer_link_status {
22 PROV_BEARER_LINK_STATUS_SUCCESS,
23 PROV_BEARER_LINK_STATUS_TIMEOUT,
24 PROV_BEARER_LINK_STATUS_FAIL,
25};
26
27struct prov_bearer;
28
31
32 void (*link_opened)(const struct prov_bearer *bearer, void *cb_data);
33
34 void (*link_closed)(const struct prov_bearer *bearer, void *cb_data,
35 enum prov_bearer_link_status reason);
36
37 void (*error)(const struct prov_bearer *bearer, void *cb_data,
38 uint8_t err);
39
40 void (*recv)(const struct prov_bearer *bearer, void *cb_data,
41 struct os_mbuf *buf);
42};
43
44typedef void (*prov_bearer_send_complete_t)(int err, void *cb_data);
45
49 bt_mesh_prov_bearer_t type;
50
61 int (*link_accept)(const struct prov_bearer_cb *cb, void *cb_data);
62
72 int (*send)(struct os_mbuf *buf, prov_bearer_send_complete_t cb,
73 void *cb_data);
74
80 void (*clear_tx)(void);
81
82 /* Only available in provisioners: */
83
96 int (*link_open)(const uint8_t uuid[16], int32_t timeout,
97 const struct prov_bearer_cb *cb, void *cb_data);
98
106 void (*link_close)(enum prov_bearer_link_status status);
107};
108
109extern const struct prov_bearer pb_adv;
110extern const struct prov_bearer pb_gatt;
111
112void pb_adv_init(void);
113void pb_gatt_init(void);
114
115void pb_adv_reset(void);
116void pb_gatt_reset(void);
Definition os_mbuf.h:86
Definition prov_bearer.h:30
Definition prov_bearer.h:47
bt_mesh_prov_bearer_t type
Definition prov_bearer.h:49
int(* link_open)(const uint8_t uuid[16], int32_t timeout, const struct prov_bearer_cb *cb, void *cb_data)
Open a new link as a provisioner.
Definition prov_bearer.h:96
int(* link_accept)(const struct prov_bearer_cb *cb, void *cb_data)
Enable link establishment as a provisionee.
Definition prov_bearer.h:61
int(* send)(struct os_mbuf *buf, prov_bearer_send_complete_t cb, void *cb_data)
Send a packet on an established link.
Definition prov_bearer.h:72
void(* link_close)(enum prov_bearer_link_status status)
Close the current link.
Definition prov_bearer.h:106
void(* clear_tx)(void)
Clear any ongoing transmissions, if possible.
Definition prov_bearer.h:80