NimBLE-Arduino 2.1.2
Loading...
Searching...
No Matches
proxy_msg.h
1/* Bluetooth Mesh */
2
3/*
4 * Copyright (c) 2017 Intel Corporation
5 * Copyright (c) 2021 Lingao Meng
6 *
7 * SPDX-License-Identifier: Apache-2.0
8 */
9
10#ifndef ZEPHYR_SUBSYS_BLUETOOTH_MESH_PROXY_MSG_H_
11#define ZEPHYR_SUBSYS_BLUETOOTH_MESH_PROXY_MSG_H_
12
13#define PDU_TYPE(data) (data[0] & BIT_MASK(6))
14#define CFG_FILTER_SET 0x00
15#define CFG_FILTER_ADD 0x01
16#define CFG_FILTER_REMOVE 0x02
17#define CFG_FILTER_STATUS 0x03
18
19#define BT_MESH_PROXY_NET_PDU 0x00
20#define BT_MESH_PROXY_BEACON 0x01
21#define BT_MESH_PROXY_CONFIG 0x02
22#define BT_MESH_PROXY_PROV 0x03
23
24#define PDU_HDR(sar, type) (sar << 6 | (type & BIT_MASK(6)))
25
26struct bt_mesh_proxy_role;
27
28typedef int (*proxy_send_cb_t)(uint16_t conn_handle,
29 const void *data, uint16_t len);
30
31typedef void (*proxy_recv_cb_t)(struct bt_mesh_proxy_role *role);
32
33struct bt_mesh_proxy_role {
34 uint16_t conn_handle;
35 uint8_t msg_type;
36
37 struct {
38 proxy_send_cb_t send;
39 proxy_recv_cb_t recv;
40 } cb;
41
42 struct k_work_delayable sar_timer;
43 struct os_mbuf *buf;
44};
45
46struct bt_mesh_proxy_client {
47 struct bt_mesh_proxy_role *cli;
48 uint16_t conn_handle;
49 uint16_t filter[MYNEWT_VAL(BLE_MESH_PROXY_FILTER_SIZE)];
50 enum __packed {
51 NONE,
52 ACCEPT,
53 REJECT,
54 } filter_type;
55 struct ble_npl_callout send_beacons;
56};
57
58int bt_mesh_proxy_msg_recv(struct bt_mesh_proxy_role *role,
59 const void *buf, uint16_t len);
60int bt_mesh_proxy_msg_send(struct bt_mesh_proxy_role *role, uint8_t type, struct os_mbuf *msg);
61void bt_mesh_proxy_msg_init(struct bt_mesh_proxy_role *role);
62void bt_mesh_proxy_role_cleanup(struct bt_mesh_proxy_role *role);
63struct bt_mesh_proxy_role *bt_mesh_proxy_role_setup(uint16_t conn_handle,
64 proxy_send_cb_t send,
65 proxy_recv_cb_t recv);
66struct bt_mesh_proxy_client *find_client(uint16_t conn_handle);
67#endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_PROXY_MSG_H_ */
Definition os_mbuf.h:86