The Bluetooth proxy feature includes proxy client and proxy server. In addition to the proxy pdu message used above, pb-gatt also uses the same proxy pdu message. Currently zephyr bluetooth mesh couples them in one file. A file at the separation is called gatt_services.c, which is used to contain Mesh Provisioning Service and Mesh Proxy Service. Another file in the separation is called proxy_msg.c, which is used to process Proxy pdu messages. Also according to Trond's suggestion: Rename CONFIG_BT_MESH_PROXY to CONFIG_BT_MESH_GATT. Create an additional promptless entry CONFIG_BT_MESH_GATT_SERVER that selects CONFIG_BT_MESH_GATT and is selected by CONFIG_BT_MESH_GATT_PROXY or CONFIG_BT_MESH_PB_GATT. Create additional CONFIG_BT_MESH_PROXY used to represent proxy feature (also include proxy client). Signed-off-by: Lingao Meng <menglingao@xiaomi.com>
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
/* Bluetooth Mesh */
|
|
|
|
/*
|
|
* Copyright (c) 2017 Intel Corporation
|
|
* Copyright (c) 2021 Lingao Meng
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef ZEPHYR_SUBSYS_BLUETOOTH_MESH_PROXY_MSG_H_
|
|
#define ZEPHYR_SUBSYS_BLUETOOTH_MESH_PROXY_MSG_H_
|
|
|
|
#include <bluetooth/gatt.h>
|
|
|
|
#define PDU_TYPE(data) (data[0] & BIT_MASK(6))
|
|
#define CFG_FILTER_SET 0x00
|
|
#define CFG_FILTER_ADD 0x01
|
|
#define CFG_FILTER_REMOVE 0x02
|
|
#define CFG_FILTER_STATUS 0x03
|
|
|
|
#define PDU_HDR(sar, type) (sar << 6 | (type & BIT_MASK(6)))
|
|
|
|
typedef int (*proxy_send_cb_t)(struct bt_conn *conn,
|
|
const void *data, uint16_t len,
|
|
bt_gatt_complete_func_t end, void *user_data);
|
|
|
|
typedef void (*proxy_recv_cb_t)(struct bt_conn *conn,
|
|
struct bt_mesh_net_rx *rx,
|
|
struct net_buf_simple *buf);
|
|
|
|
struct bt_mesh_proxy_role {
|
|
struct bt_conn *conn;
|
|
uint8_t msg_type;
|
|
|
|
struct {
|
|
proxy_send_cb_t send;
|
|
proxy_recv_cb_t recv;
|
|
} cb;
|
|
|
|
struct k_work_delayable sar_timer;
|
|
struct net_buf_simple buf;
|
|
};
|
|
|
|
ssize_t bt_mesh_proxy_msg_recv(struct bt_mesh_proxy_role *role,
|
|
const void *buf, uint16_t len);
|
|
int bt_mesh_proxy_msg_send(struct bt_mesh_proxy_role *role, uint8_t type,
|
|
struct net_buf_simple *msg,
|
|
bt_gatt_complete_func_t end, void *user_data);
|
|
void bt_mesh_proxy_msg_init(struct bt_mesh_proxy_role *role);
|
|
|
|
#endif /* ZEPHYR_SUBSYS_BLUETOOTH_MESH_PROXY_MSG_H_ */
|