mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-30 18:57:19 +02:00
feat(ble_mesh): Remote Provisioning Server UUID Matchs Supported
This commit is contained in:
@ -212,7 +212,7 @@ static const btc_func_t profile_tab[BTC_PID_NUM] = {
|
||||
[BTC_PID_RPR_CLIENT] = {btc_ble_mesh_rpr_client_call_handler, btc_ble_mesh_rpr_client_cb_handler },
|
||||
#endif /* CONFIG_BLE_MESH_RPR_CLI */
|
||||
#if CONFIG_BLE_MESH_RPR_SRV
|
||||
[BTC_PID_RPR_SERVER] = {NULL, btc_ble_mesh_rpr_server_cb_handler },
|
||||
[BTC_PID_RPR_SERVER] = {btc_ble_mesh_rpr_server_call_handler, btc_ble_mesh_rpr_server_cb_handler },
|
||||
#endif /* CONFIG_BLE_MESH_RPR_SRV */
|
||||
#if CONFIG_BLE_MESH_SAR_CLI
|
||||
[BTC_PID_SAR_CLIENT] = {btc_ble_mesh_sar_client_call_handler, btc_ble_mesh_sar_client_cb_handler },
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -88,7 +88,6 @@ static void reset_state(void)
|
||||
(void)memset(&prov_link, 0, offsetof(struct bt_mesh_prov_link, tx.retransmit));
|
||||
|
||||
#if CONFIG_BLE_MESH_PB_ADV
|
||||
|
||||
prov_link.pending_ack = PROV_XACT_NVAL;
|
||||
|
||||
prov_link.rx.prev_id = PROV_XACT_NVAL;
|
||||
@ -123,8 +122,6 @@ static void reset_adv_link(struct bt_mesh_prov_link *link, uint8_t reason)
|
||||
{
|
||||
ARG_UNUSED(link);
|
||||
|
||||
bt_mesh_prov_bearer_ctl_send(&prov_link, LINK_CLOSE, &reason, sizeof(reason));
|
||||
|
||||
bt_mesh_prov_clear_tx(&prov_link, true);
|
||||
|
||||
if (bt_mesh_prov_get()->link_close) {
|
||||
@ -1083,10 +1080,11 @@ static void link_ack(struct prov_rx *rx, struct net_buf_simple *buf)
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_RPR_SRV */
|
||||
|
||||
if (!k_delayed_work_remaining_get(&prov_link.prot_timer)) {
|
||||
/**
|
||||
* When the link is opened, the Provisioner and the unprovisioned device
|
||||
* shall start the link timer from the initial value set 60 seconds.
|
||||
* When the link is opened, the provisioner and the unprovisioned device
|
||||
* shall start the link timer with the timeout value set to 60 seconds.
|
||||
*/
|
||||
k_delayed_work_submit(&prov_link.prot_timer, PROTOCOL_TIMEOUT);
|
||||
}
|
||||
@ -1536,7 +1534,6 @@ static void protocol_timeout(struct k_work *work)
|
||||
uint8_t reason = CLOSE_REASON_TIMEOUT;
|
||||
prov_link.rx.seg = 0U;
|
||||
bt_mesh_prov_bearer_ctl_send(&prov_link, LINK_CLOSE, &reason, sizeof(reason));
|
||||
close_link(reason);
|
||||
#endif /* CONFIG_BLE_MESH_PB_ADV */
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2017-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -50,6 +50,7 @@ static struct bt_mesh_prov_link prov_links[BLE_MESH_PROV_SAME_TIME];
|
||||
#if CONFIG_BLE_MESH_RPR_CLI
|
||||
extern struct bt_mesh_prov_link rpr_links[CONFIG_BLE_MESH_RPR_CLI_PROV_SAME_TIME];
|
||||
#endif
|
||||
|
||||
struct bt_mesh_prov_ctx {
|
||||
/* Primary element address of Provisioner */
|
||||
uint16_t primary_addr;
|
||||
@ -247,7 +248,7 @@ void bt_mesh_provisioner_restore_prov_info(uint16_t primary_addr, uint16_t alloc
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_SETTINGS */
|
||||
|
||||
bool is_unprov_dev_being_provision(const uint8_t uuid[16])
|
||||
bool bt_mesh_is_unprov_dev_being_prov(const uint8_t uuid[16])
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -272,6 +273,7 @@ bool is_unprov_dev_being_provision(const uint8_t uuid[16])
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0; i < BLE_MESH_PROV_SAME_TIME; i++) {
|
||||
if (bt_mesh_atomic_test_bit(prov_links[i].flags, LINK_ACTIVE)
|
||||
#if CONFIG_BLE_MESH_PB_GATT
|
||||
@ -322,7 +324,7 @@ static int provisioner_check_unprov_dev_info(const uint8_t uuid[16], bt_mesh_pro
|
||||
* receive the connectable prov adv pkt from this device.
|
||||
* Here we check both PB-GATT and PB-ADV link status.
|
||||
*/
|
||||
if (is_unprov_dev_being_provision(uuid)) {
|
||||
if (bt_mesh_is_unprov_dev_being_prov(uuid)) {
|
||||
return -EALREADY;
|
||||
}
|
||||
|
||||
@ -377,7 +379,7 @@ static int provisioner_start_prov_pb_adv(const uint8_t uuid[16], const bt_mesh_a
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (is_unprov_dev_being_provision(uuid)) {
|
||||
if (bt_mesh_is_unprov_dev_being_prov(uuid)) {
|
||||
bt_mesh_pb_adv_unlock();
|
||||
return 0;
|
||||
}
|
||||
@ -439,7 +441,7 @@ static int provisioner_start_prov_pb_gatt(const uint8_t uuid[16], const bt_mesh_
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (is_unprov_dev_being_provision(uuid)) {
|
||||
if (bt_mesh_is_unprov_dev_being_prov(uuid)) {
|
||||
bt_mesh_pb_gatt_unlock();
|
||||
return 0;
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ uint16_t bt_mesh_provisioner_get_fast_prov_net_idx(void);
|
||||
*/
|
||||
uint8_t bt_mesh_set_fast_prov_unicast_addr_range(uint16_t min, uint16_t max);
|
||||
|
||||
bool is_unprov_dev_being_provision(const uint8_t uuid[16]);
|
||||
bool bt_mesh_is_unprov_dev_being_prov(const uint8_t uuid[16]);
|
||||
|
||||
int bt_mesh_rpr_cli_pdu_recv(struct bt_mesh_prov_link *link, uint8_t type,
|
||||
struct net_buf_simple *buf);
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2017 Intel Corporation
|
||||
* SPDX-FileContributor: 2018-2021 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileContributor: 2018-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -828,15 +828,14 @@ static void proxy_connected(struct bt_mesh_conn *conn, uint8_t err)
|
||||
|
||||
BT_DBG("conn %p err 0x%02x", conn, err);
|
||||
|
||||
conn_count++;
|
||||
|
||||
if (gatt_svc == MESH_GATT_PROV &&
|
||||
conn_count > 1) {
|
||||
if (gatt_svc == MESH_GATT_PROV && conn_count == 1) {
|
||||
BT_WARN("Only one prov connection could exists");
|
||||
bt_mesh_gatts_disconnect(conn, 0x13);
|
||||
return;
|
||||
}
|
||||
|
||||
conn_count++;
|
||||
|
||||
/* Since we use ADV_OPT_ONE_TIME */
|
||||
proxy_adv_enabled = false;
|
||||
|
||||
|
@ -135,7 +135,7 @@ int bt_mesh_unprov_dev_fifo_enqueue(uint8_t uuid[16], const uint8_t addr[6], uin
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (!bt_mesh_unprov_dev_info_query(uuid, addr, NULL, BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_UUID|
|
||||
if (!bt_mesh_unprov_dev_info_query(uuid, NULL, NULL, BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_ADDR |
|
||||
BLE_MESH_STORE_UNPROV_INFO_QUERY_TYPE_EXISTS)) {
|
||||
return 0;
|
||||
}
|
||||
@ -272,6 +272,7 @@ static void handle_adv_service_data(struct net_buf_simple *buf,
|
||||
bt_mesh_provisioner_prov_adv_recv(buf, addr, rssi);
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_PROVISIONER */
|
||||
|
||||
#if CONFIG_BLE_MESH_RPR_SRV
|
||||
if (bt_mesh_is_provisioned()) {
|
||||
const bt_mesh_addr_t *addr = bt_mesh_get_unprov_dev_addr();
|
||||
|
@ -1561,7 +1561,7 @@ static int trans_seg(struct net_buf_simple *buf, struct bt_mesh_net_rx *net_rx,
|
||||
* eventually be freed up and we'll be able to process
|
||||
* this one.
|
||||
*/
|
||||
BT_WARN("No free slots for new incoming segmented messages addr: %04x", net_rx->ctx.addr);
|
||||
BT_WARN("No free slots for new incoming segmented messages, src: %04x", net_rx->ctx.addr);
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -2067,12 +2067,13 @@ int bt_mesh_ext_rpr_cli_pdu_recv(void *link, uint8_t type, struct net_buf_simple
|
||||
struct bt_mesh_prov_link rpr_links[CONFIG_BLE_MESH_RPR_CLI_PROV_SAME_TIME];
|
||||
#endif /* CONFIG_BLE_MESH_RPR_CLI */
|
||||
|
||||
bool bt_mesh_ext_is_unprov_dev_being_provision(void *uuid)
|
||||
bool bt_mesh_ext_bt_mesh_is_unprov_dev_being_prov(void *uuid)
|
||||
{
|
||||
#if CONFIG_BLE_MESH_RPR_CLI
|
||||
return is_unprov_dev_being_provision(uuid);
|
||||
return bt_mesh_is_unprov_dev_being_prov(uuid);
|
||||
#else
|
||||
assert(0);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -2107,14 +2108,12 @@ int bt_mesh_ext_rpr_srv_nppi_pdu_recv(uint8_t type, const uint8_t *data)
|
||||
|
||||
int bt_mesh_ext_rpr_srv_set_waiting_prov_link(void* link, bt_mesh_addr_t *addr)
|
||||
{
|
||||
#if (CONFIG_BLE_MESH_PB_GATT && \
|
||||
CONFIG_BLE_MESH_RPR_SRV)
|
||||
#if (CONFIG_BLE_MESH_PB_GATT && CONFIG_BLE_MESH_RPR_SRV)
|
||||
return bt_mesh_rpr_srv_set_waiting_prov_link(link, addr);
|
||||
#else
|
||||
assert(0);
|
||||
return 0;
|
||||
#endif /* CONFIG_BLE_MESH_PB_GATT && \
|
||||
CONFIG_BLE_MESH_RPR_SRV) */
|
||||
#endif /* CONFIG_BLE_MESH_PB_GATT && CONFIG_BLE_MESH_RPR_SRV) */
|
||||
}
|
||||
|
||||
/* Friend */
|
||||
@ -4200,6 +4199,7 @@ static const bt_mesh_ext_config_t bt_mesh_ext_cfg = {
|
||||
.config_ble_mesh_srpl_cli = IS_ENABLED(CONFIG_BLE_MESH_SRPL_CLI),
|
||||
.config_ble_mesh_srpl_srv = IS_ENABLED(CONFIG_BLE_MESH_SRPL_SRV),
|
||||
.config_ble_mesh_prov_protocol_timeout = PROTOCOL_TIMEOUT,
|
||||
|
||||
#if CONFIG_BLE_MESH_CERT_BASED_PROV
|
||||
.config_ble_mesh_record_frag_max_size = CONFIG_BLE_MESH_RECORD_FRAG_MAX_SIZE,
|
||||
#endif /* CONFIG_BLE_MESH_CERT_BASED_PROV */
|
||||
@ -4534,7 +4534,7 @@ typedef struct {
|
||||
int (*_bt_mesh_ext_rpr_cli_pdu_send)(void *link, uint8_t type);
|
||||
int (*_bt_mesh_ext_rpr_cli_recv_pub_key_outbound_report)(void *link);
|
||||
int (*_bt_mesh_ext_rpr_cli_pdu_recv)(void *link, uint8_t type, struct net_buf_simple *buf);
|
||||
bool (*_bt_mesh_ext_is_unprov_dev_being_provision)(void *uuid);
|
||||
bool (*_bt_mesh_ext_bt_mesh_is_unprov_dev_being_prov)(void *uuid);
|
||||
void *(*_bt_mesh_ext_rpr_cli_get_rpr_link)(uint8_t index);
|
||||
/* CONFIG_BLE_MESH_RPR_CLI */
|
||||
|
||||
@ -4856,7 +4856,7 @@ static const bt_mesh_ext_funcs_t bt_mesh_ext_func = {
|
||||
._bt_mesh_ext_rpr_cli_pdu_send = bt_mesh_ext_rpr_cli_pdu_send,
|
||||
._bt_mesh_ext_rpr_cli_recv_pub_key_outbound_report = bt_mesh_ext_rpr_cli_recv_pub_key_outbound_report,
|
||||
._bt_mesh_ext_rpr_cli_pdu_recv = bt_mesh_ext_rpr_cli_pdu_recv,
|
||||
._bt_mesh_ext_is_unprov_dev_being_provision = bt_mesh_ext_is_unprov_dev_being_provision,
|
||||
._bt_mesh_ext_bt_mesh_is_unprov_dev_being_prov = bt_mesh_ext_bt_mesh_is_unprov_dev_being_prov,
|
||||
._bt_mesh_ext_rpr_cli_get_rpr_link = bt_mesh_ext_rpr_cli_get_rpr_link,
|
||||
/* CONFIG_BLE_MESH_RPR_CLI */
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "btc/btc_manage.h"
|
||||
|
||||
@ -91,4 +92,34 @@ esp_err_t esp_ble_mesh_register_rpr_server_callback(esp_ble_mesh_rpr_server_cb_t
|
||||
|
||||
return (btc_profile_cb_set(BTC_PID_RPR_SERVER, callback) == 0 ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
|
||||
esp_err_t esp_ble_mesh_rpr_server_set_uuid_match(const uint8_t *match_val, uint8_t match_len, uint8_t offset)
|
||||
{
|
||||
btc_ble_mesh_rpr_server_args_t arg = {0};
|
||||
btc_msg_t msg = {0};
|
||||
|
||||
msg.sig = BTC_SIG_API_CALL;
|
||||
msg.pid = BTC_PID_RPR_SERVER;
|
||||
msg.act = BTC_BLE_MESH_ACT_RPR_SRV_SET_UUID_MATCH;
|
||||
|
||||
if (!match_len || match_len > 16 ||
|
||||
!match_val || offset >= 16 ||
|
||||
offset + match_len > 16) {
|
||||
return ESP_ERR_INVALID_ARG;
|
||||
}
|
||||
|
||||
arg.set_uuid_match.match_val = bt_mesh_calloc(match_len);
|
||||
if (!arg.set_uuid_match.match_val) {
|
||||
BT_ERR("%s:Out of memory", __func__);
|
||||
return ESP_ERR_NO_MEM;
|
||||
}
|
||||
|
||||
memcpy(arg.set_uuid_match.match_val, match_val, match_len);
|
||||
arg.set_uuid_match.match_len = match_len;
|
||||
arg.set_uuid_match.offset = offset;
|
||||
|
||||
return (btc_transfer_context(&msg, &arg, sizeof(btc_ble_mesh_rpr_server_args_t),
|
||||
btc_ble_mesh_rpr_server_arg_deep_copy,
|
||||
btc_ble_mesh_rpr_server_arg_deep_free) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
|
||||
}
|
||||
#endif /* CONFIG_BLE_MESH_RPR_SRV */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -396,6 +396,13 @@ typedef union {
|
||||
uint16_t net_idx; /*!< NetKey Index used by Remote Provisioning Client */
|
||||
uint16_t rpr_cli_addr; /*!< Unicast address of Remote Provisioning Client */
|
||||
} prov_comp;
|
||||
|
||||
/**
|
||||
* @brief ESP_BLE_MESH_RPR_SERVER_SET_UUID_MATCH_COMP_EVT
|
||||
*/
|
||||
struct {
|
||||
int err_code; /*!< Indicate the result of setting Device UUID match value by the Remote Provisioning Server */
|
||||
} set_uuid_match_comp;
|
||||
} esp_ble_mesh_rpr_server_cb_param_t;
|
||||
|
||||
/** This enum value is the event of Remote Provisioning Server model */
|
||||
@ -407,6 +414,7 @@ typedef enum {
|
||||
ESP_BLE_MESH_RPR_SERVER_LINK_OPEN_EVT,
|
||||
ESP_BLE_MESH_RPR_SERVER_LINK_CLOSE_EVT,
|
||||
ESP_BLE_MESH_RPR_SERVER_PROV_COMP_EVT,
|
||||
ESP_BLE_MESH_RPR_SERVER_SET_UUID_MATCH_COMP_EVT,
|
||||
ESP_BLE_MESH_RPR_SERVER_EVT_MAX,
|
||||
} esp_ble_mesh_rpr_server_cb_event_t;
|
||||
|
||||
@ -474,6 +482,18 @@ typedef void (* esp_ble_mesh_rpr_server_cb_t)(esp_ble_mesh_rpr_server_cb_event_t
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_register_rpr_server_callback(esp_ble_mesh_rpr_server_cb_t callback);
|
||||
|
||||
/**
|
||||
* @brief This function is called by Remote Provisioning Server to set the part of
|
||||
* the device UUID to be compared before starting to remote provision.
|
||||
*
|
||||
* @param[in] match_val: Value to be compared with the part of the device UUID.
|
||||
* @param[in] match_len: Length of the compared match value.
|
||||
* @param[in] offset: Offset of the device UUID to be compared (based on zero).
|
||||
*
|
||||
* @return ESP_OK on success or error code otherwise.
|
||||
*/
|
||||
esp_err_t esp_ble_mesh_rpr_server_set_uuid_match(const uint8_t *match_val, uint8_t match_len, uint8_t offset);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -451,6 +451,61 @@ void btc_ble_mesh_rpr_client_cb_handler(btc_msg_t *msg)
|
||||
#if CONFIG_BLE_MESH_RPR_SRV
|
||||
|
||||
/* Remote Provisioning Server model related functions */
|
||||
extern int bt_mesh_rpr_srv_scan_set_dev_uuid_match(uint8_t offset, uint8_t length,const uint8_t *match);
|
||||
|
||||
void btc_ble_mesh_rpr_server_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src)
|
||||
{
|
||||
btc_ble_mesh_rpr_server_args_t *dst = p_dest;
|
||||
btc_ble_mesh_rpr_server_args_t *src = p_src;
|
||||
|
||||
if (!msg || !dst || !src) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
switch(msg->act) {
|
||||
case BTC_BLE_MESH_ACT_RPR_SRV_SET_UUID_MATCH:
|
||||
dst->set_uuid_match.match_val = bt_mesh_calloc(src->set_uuid_match.match_len);
|
||||
if (dst->set_uuid_match.match_val) {
|
||||
memcpy(dst->set_uuid_match.match_val, src->set_uuid_match.match_val, src->set_uuid_match.match_len);
|
||||
dst->set_uuid_match.match_len = src->set_uuid_match.match_len;
|
||||
dst->set_uuid_match.offset = src->set_uuid_match.offset;
|
||||
} else {
|
||||
BT_ERR("%s, Out of memory, act %d", __func__, msg->act);
|
||||
}
|
||||
bt_mesh_free(src->set_uuid_match.match_val);
|
||||
break;
|
||||
default:
|
||||
BT_DBG("%s, Unknown act %d", __func__, msg->act);
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
void btc_ble_mesh_rpr_server_arg_deep_free(btc_msg_t *msg)
|
||||
{
|
||||
btc_ble_mesh_rpr_server_args_t *arg = NULL;
|
||||
|
||||
if (!msg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
arg = (btc_ble_mesh_rpr_server_args_t *)msg->arg;
|
||||
|
||||
switch(msg->act) {
|
||||
case BTC_BLE_MESH_ACT_RPR_SRV_SET_UUID_MATCH:
|
||||
if (arg->set_uuid_match.match_val) {
|
||||
bt_mesh_free(arg->set_uuid_match.match_val);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void btc_ble_mesh_rpr_server_cb_to_app(esp_ble_mesh_rpr_server_cb_event_t event,
|
||||
esp_ble_mesh_rpr_server_cb_param_t *param)
|
||||
@ -522,6 +577,33 @@ void bt_mesh_rpr_server_cb_evt_to_btc(uint8_t event, const void *val, size_t len
|
||||
btc_ble_mesh_rpr_server_cb(&cb_params, act);
|
||||
}
|
||||
|
||||
void btc_ble_mesh_rpr_server_call_handler(btc_msg_t *msg)
|
||||
{
|
||||
esp_ble_mesh_rpr_server_cb_param_t cb = {0};
|
||||
btc_ble_mesh_rpr_server_args_t *arg = NULL;
|
||||
|
||||
if (!msg) {
|
||||
BT_ERR("%s, Invalid parameter", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
arg = (btc_ble_mesh_rpr_server_args_t *)msg->arg;
|
||||
|
||||
switch (msg->act) {
|
||||
case BTC_BLE_MESH_ACT_RPR_SRV_SET_UUID_MATCH:
|
||||
cb.set_uuid_match_comp.err_code = bt_mesh_rpr_srv_scan_set_dev_uuid_match(arg->set_uuid_match.offset,
|
||||
arg->set_uuid_match.match_len,
|
||||
arg->set_uuid_match.match_val);
|
||||
|
||||
btc_ble_mesh_rpr_server_cb(&cb, ESP_BLE_MESH_RPR_SERVER_SET_UUID_MATCH_COMP_EVT);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
btc_ble_mesh_rpr_server_arg_deep_free(msg);
|
||||
}
|
||||
|
||||
void btc_ble_mesh_rpr_server_cb_handler(btc_msg_t *msg)
|
||||
{
|
||||
esp_ble_mesh_rpr_server_cb_param_t *arg = NULL;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2020-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2020-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@ -64,6 +64,11 @@ void bt_mesh_rpr_client_cb_evt_to_btc(uint32_t opcode, uint8_t event,
|
||||
struct bt_mesh_msg_ctx *ctx,
|
||||
const void *val, size_t len);
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_ACT_RPR_SRV_SET_UUID_MATCH,
|
||||
BTC_BLE_MESH_ACT_RPR_SRV_MAX,
|
||||
} btc_ble_mesh_rpr_server_act_t;
|
||||
|
||||
typedef enum {
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_SCAN_START,
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_SCAN_STOP,
|
||||
@ -72,9 +77,22 @@ typedef enum {
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_LINK_OPEN,
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_LINK_CLOSE,
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_PROV_COMP,
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_SET_UUID_MATCH_COMP,
|
||||
BTC_BLE_MESH_EVT_RPR_SERVER_MAX,
|
||||
} btc_ble_mesh_rpr_server_evt_t;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
uint8_t *match_val;
|
||||
uint8_t match_len;
|
||||
uint8_t offset;
|
||||
} set_uuid_match;
|
||||
} btc_ble_mesh_rpr_server_args_t;
|
||||
|
||||
void btc_ble_mesh_rpr_server_arg_deep_copy(btc_msg_t *msg, void *p_dest, void *p_src);
|
||||
void btc_ble_mesh_rpr_server_arg_deep_free(btc_msg_t *msg);
|
||||
|
||||
void btc_ble_mesh_rpr_server_call_handler(btc_msg_t *msg);
|
||||
void btc_ble_mesh_rpr_server_cb_handler(btc_msg_t *msg);
|
||||
|
||||
void bt_mesh_rpr_server_cb_evt_to_btc(uint8_t event, const void *val, size_t len);
|
||||
|
Reference in New Issue
Block a user