ble_mesh: stack: Make proxy server & client functions clear

This commit is contained in:
lly 2020-07-03 20:00:36 +08:00
parent 049a3e1cd7
commit f4846cca4b
15 changed files with 132 additions and 121 deletions

View File

@ -1612,11 +1612,11 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
break; break;
case BTC_BLE_MESH_ACT_PROXY_GATT_ENABLE: case BTC_BLE_MESH_ACT_PROXY_GATT_ENABLE:
act = ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT; act = ESP_BLE_MESH_NODE_PROXY_GATT_ENABLE_COMP_EVT;
param.node_proxy_gatt_enable_comp.err_code = bt_mesh_proxy_gatt_enable(); param.node_proxy_gatt_enable_comp.err_code = bt_mesh_proxy_server_gatt_enable();
break; break;
case BTC_BLE_MESH_ACT_PROXY_GATT_DISABLE: case BTC_BLE_MESH_ACT_PROXY_GATT_DISABLE:
act = ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT; act = ESP_BLE_MESH_NODE_PROXY_GATT_DISABLE_COMP_EVT;
param.node_proxy_gatt_disable_comp.err_code = bt_mesh_proxy_gatt_disable(); param.node_proxy_gatt_disable_comp.err_code = bt_mesh_proxy_server_gatt_disable();
break; break;
#endif /* CONFIG_BLE_MESH_GATT_PROXY_SERVER */ #endif /* CONFIG_BLE_MESH_GATT_PROXY_SERVER */
#endif /* (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_SERVER */ #endif /* (CONFIG_BLE_MESH_NODE && CONFIG_BLE_MESH_PB_GATT) || CONFIG_BLE_MESH_GATT_PROXY_SERVER */
@ -1855,7 +1855,7 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
param.proxy_client_set_filter_type_comp.conn_handle = arg->proxy_client_set_filter_type.conn_handle; param.proxy_client_set_filter_type_comp.conn_handle = arg->proxy_client_set_filter_type.conn_handle;
param.proxy_client_set_filter_type_comp.net_idx = arg->proxy_client_set_filter_type.net_idx; param.proxy_client_set_filter_type_comp.net_idx = arg->proxy_client_set_filter_type.net_idx;
param.proxy_client_set_filter_type_comp.err_code = param.proxy_client_set_filter_type_comp.err_code =
bt_mesh_proxy_client_send_cfg(arg->proxy_client_set_filter_type.conn_handle, bt_mesh_proxy_client_cfg_send(arg->proxy_client_set_filter_type.conn_handle,
arg->proxy_client_set_filter_type.net_idx, &pdu); arg->proxy_client_set_filter_type.net_idx, &pdu);
break; break;
} }
@ -1869,7 +1869,7 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
param.proxy_client_add_filter_addr_comp.conn_handle = arg->proxy_client_add_filter_addr.conn_handle; param.proxy_client_add_filter_addr_comp.conn_handle = arg->proxy_client_add_filter_addr.conn_handle;
param.proxy_client_add_filter_addr_comp.net_idx = arg->proxy_client_add_filter_addr.net_idx; param.proxy_client_add_filter_addr_comp.net_idx = arg->proxy_client_add_filter_addr.net_idx;
param.proxy_client_add_filter_addr_comp.err_code = param.proxy_client_add_filter_addr_comp.err_code =
bt_mesh_proxy_client_send_cfg(arg->proxy_client_add_filter_addr.conn_handle, bt_mesh_proxy_client_cfg_send(arg->proxy_client_add_filter_addr.conn_handle,
arg->proxy_client_add_filter_addr.net_idx, &pdu); arg->proxy_client_add_filter_addr.net_idx, &pdu);
break; break;
} }
@ -1883,7 +1883,7 @@ void btc_ble_mesh_prov_call_handler(btc_msg_t *msg)
param.proxy_client_remove_filter_addr_comp.conn_handle = arg->proxy_client_remove_filter_addr.conn_handle; param.proxy_client_remove_filter_addr_comp.conn_handle = arg->proxy_client_remove_filter_addr.conn_handle;
param.proxy_client_remove_filter_addr_comp.net_idx = arg->proxy_client_remove_filter_addr.net_idx; param.proxy_client_remove_filter_addr_comp.net_idx = arg->proxy_client_remove_filter_addr.net_idx;
param.proxy_client_remove_filter_addr_comp.err_code = param.proxy_client_remove_filter_addr_comp.err_code =
bt_mesh_proxy_client_send_cfg(arg->proxy_client_remove_filter_addr.conn_handle, bt_mesh_proxy_client_cfg_send(arg->proxy_client_remove_filter_addr.conn_handle,
arg->proxy_client_remove_filter_addr.net_idx, &pdu); arg->proxy_client_remove_filter_addr.net_idx, &pdu);
break; break;
} }

View File

@ -258,11 +258,11 @@ static void adv_thread(void *p)
while (!(*buf)) { while (!(*buf)) {
s32_t timeout; s32_t timeout;
BT_DBG("Mesh Proxy Advertising start"); BT_DBG("Mesh Proxy Advertising start");
timeout = bt_mesh_proxy_adv_start(); timeout = bt_mesh_proxy_server_adv_start();
BT_DBG("Mesh Proxy Advertising up to %d ms", timeout); BT_DBG("Mesh Proxy Advertising up to %d ms", timeout);
xQueueReceive(adv_queue.handle, &msg, timeout); xQueueReceive(adv_queue.handle, &msg, timeout);
BT_DBG("Mesh Proxy Advertising stop"); BT_DBG("Mesh Proxy Advertising stop");
bt_mesh_proxy_adv_stop(); bt_mesh_proxy_server_adv_stop();
} }
#else #else
xQueueReceive(adv_queue.handle, &msg, portMAX_DELAY); xQueueReceive(adv_queue.handle, &msg, portMAX_DELAY);
@ -281,11 +281,11 @@ static void adv_thread(void *p)
while (!(*buf)) { while (!(*buf)) {
s32_t timeout = 0; s32_t timeout = 0;
BT_DBG("Mesh Proxy Advertising start"); BT_DBG("Mesh Proxy Advertising start");
timeout = bt_mesh_proxy_adv_start(); timeout = bt_mesh_proxy_server_adv_start();
BT_DBG("Mesh Proxy Advertising up to %d ms", timeout); BT_DBG("Mesh Proxy Advertising up to %d ms", timeout);
handle = xQueueSelectFromSet(mesh_queue_set, timeout); handle = xQueueSelectFromSet(mesh_queue_set, timeout);
BT_DBG("Mesh Proxy Advertising stop"); BT_DBG("Mesh Proxy Advertising stop");
bt_mesh_proxy_adv_stop(); bt_mesh_proxy_server_adv_stop();
if (handle) { if (handle) {
if (uxQueueMessagesWaiting(adv_queue.handle)) { if (uxQueueMessagesWaiting(adv_queue.handle)) {
xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT); xQueueReceive(adv_queue.handle, &msg, K_NO_WAIT);
@ -590,14 +590,14 @@ u16_t bt_mesh_get_stored_relay_count(void)
} }
#endif /* #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */ #endif /* #if defined(CONFIG_BLE_MESH_RELAY_ADV_BUF) */
const bt_mesh_addr_t *bt_mesh_pba_get_addr(void) const bt_mesh_addr_t *bt_mesh_get_unprov_dev_addr(void)
{ {
return dev_addr; return dev_addr;
} }
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \ #if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT CONFIG_BLE_MESH_GATT_PROXY_CLIENT
static bool bt_mesh_is_adv_flags_valid(struct net_buf_simple *buf) static bool adv_flags_valid(struct net_buf_simple *buf)
{ {
u8_t flags = 0U; u8_t flags = 0U;
@ -616,7 +616,7 @@ static bool bt_mesh_is_adv_flags_valid(struct net_buf_simple *buf)
return true; return true;
} }
static bool bt_mesh_is_adv_srv_uuid_valid(struct net_buf_simple *buf, u16_t *uuid) static bool adv_service_uuid_valid(struct net_buf_simple *buf, u16_t *uuid)
{ {
if (buf->len != 2U) { if (buf->len != 2U) {
BT_DBG("Length not match mesh service uuid"); BT_DBG("Length not match mesh service uuid");
@ -649,7 +649,9 @@ static bool bt_mesh_is_adv_srv_uuid_valid(struct net_buf_simple *buf, u16_t *uui
#define BLE_MESH_PROXY_SRV_DATA_LEN1 0x09 #define BLE_MESH_PROXY_SRV_DATA_LEN1 0x09
#define BLE_MESH_PROXY_SRV_DATA_LEN2 0x11 #define BLE_MESH_PROXY_SRV_DATA_LEN2 0x11
static void bt_mesh_adv_srv_data_recv(struct net_buf_simple *buf, const bt_mesh_addr_t *addr, u16_t uuid, s8_t rssi) static void handle_adv_service_data(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr,
u16_t uuid, s8_t rssi)
{ {
u16_t type = 0U; u16_t type = 0U;
@ -674,7 +676,7 @@ static void bt_mesh_adv_srv_data_recv(struct net_buf_simple *buf, const bt_mesh_
} }
BT_DBG("Start to handle Mesh Prov Service Data"); BT_DBG("Start to handle Mesh Prov Service Data");
bt_mesh_provisioner_prov_adv_ind_recv(buf, addr, rssi); bt_mesh_provisioner_prov_adv_recv(buf, addr, rssi);
} }
break; break;
#endif #endif
@ -687,7 +689,7 @@ static void bt_mesh_adv_srv_data_recv(struct net_buf_simple *buf, const bt_mesh_
} }
BT_DBG("Start to handle Mesh Proxy Service Data"); BT_DBG("Start to handle Mesh Proxy Service Data");
bt_mesh_proxy_client_adv_ind_recv(buf, addr, rssi); bt_mesh_proxy_client_gatt_adv_recv(buf, addr, rssi);
break; break;
#endif #endif
default: default:
@ -763,19 +765,19 @@ static void bt_mesh_scan_cb(const bt_mesh_addr_t *addr, s8_t rssi,
#if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \ #if (CONFIG_BLE_MESH_PROVISIONER && CONFIG_BLE_MESH_PB_GATT) || \
CONFIG_BLE_MESH_GATT_PROXY_CLIENT CONFIG_BLE_MESH_GATT_PROXY_CLIENT
case BLE_MESH_DATA_FLAGS: case BLE_MESH_DATA_FLAGS:
if (!bt_mesh_is_adv_flags_valid(buf)) { if (!adv_flags_valid(buf)) {
BT_DBG("Adv Flags mismatch, ignore this adv pkt"); BT_DBG("Adv Flags mismatch, ignore this adv pkt");
return; return;
} }
break; break;
case BLE_MESH_DATA_UUID16_ALL: case BLE_MESH_DATA_UUID16_ALL:
if (!bt_mesh_is_adv_srv_uuid_valid(buf, &uuid)) { if (!adv_service_uuid_valid(buf, &uuid)) {
BT_DBG("Adv Service UUID mismatch, ignore this adv pkt"); BT_DBG("Adv Service UUID mismatch, ignore this adv pkt");
return; return;
} }
break; break;
case BLE_MESH_DATA_SVC_DATA16: case BLE_MESH_DATA_SVC_DATA16:
bt_mesh_adv_srv_data_recv(buf, addr, uuid, rssi); handle_adv_service_data(buf, addr, uuid, rssi);
break; break;
#endif #endif
default: default:

View File

@ -78,7 +78,7 @@ void bt_mesh_unref_buf_from_pool(struct net_buf_pool *pool);
void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb, void bt_mesh_adv_send(struct net_buf *buf, const struct bt_mesh_send_cb *cb,
void *cb_data); void *cb_data);
const bt_mesh_addr_t *bt_mesh_pba_get_addr(void); const bt_mesh_addr_t *bt_mesh_get_unprov_dev_addr(void);
struct net_buf *bt_mesh_relay_adv_create(enum bt_mesh_adv_type type, u8_t xmit, struct net_buf *bt_mesh_relay_adv_create(enum bt_mesh_adv_type type, u8_t xmit,
s32_t timeout); s32_t timeout);

View File

@ -2211,7 +2211,7 @@ static void net_key_add(struct bt_mesh_model *model,
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) { if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
sub->node_id = BLE_MESH_NODE_IDENTITY_STOPPED; sub->node_id = BLE_MESH_NODE_IDENTITY_STOPPED;
bt_mesh_proxy_beacon_send(sub); bt_mesh_proxy_server_beacon_send(sub);
bt_mesh_adv_update(); bt_mesh_adv_update();
} else { } else {
sub->node_id = BLE_MESH_NODE_IDENTITY_NOT_SUPPORTED; sub->node_id = BLE_MESH_NODE_IDENTITY_NOT_SUPPORTED;
@ -2472,9 +2472,9 @@ static void node_identity_set(struct bt_mesh_model *model,
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) { if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
if (node_id) { if (node_id) {
bt_mesh_proxy_identity_start(sub); bt_mesh_proxy_server_identity_start(sub);
} else { } else {
bt_mesh_proxy_identity_stop(sub); bt_mesh_proxy_server_identity_stop(sub);
} }
bt_mesh_adv_update(); bt_mesh_adv_update();
} }

View File

@ -165,7 +165,7 @@ u8_t bt_mesh_set_fast_prov_action(u8_t action)
bt_mesh_beacon_disable(); bt_mesh_beacon_disable();
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) {
bt_mesh_provisioner_pb_gatt_enable(); bt_mesh_proxy_client_prov_enable();
} }
bt_mesh_provisioner_set_primary_elem_addr(bt_mesh_primary_addr()); bt_mesh_provisioner_set_primary_elem_addr(bt_mesh_primary_addr());
bt_mesh_provisioner_set_prov_bearer(BLE_MESH_PROV_ADV, false); bt_mesh_provisioner_set_prov_bearer(BLE_MESH_PROV_ADV, false);
@ -173,7 +173,7 @@ u8_t bt_mesh_set_fast_prov_action(u8_t action)
bt_mesh_atomic_or(bt_mesh.flags, BIT(BLE_MESH_PROVISIONER) | BIT(BLE_MESH_VALID_PROV)); bt_mesh_atomic_or(bt_mesh.flags, BIT(BLE_MESH_PROVISIONER) | BIT(BLE_MESH_VALID_PROV));
} else { } else {
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) {
bt_mesh_provisioner_pb_gatt_disable(); bt_mesh_proxy_client_prov_disable();
} }
if (bt_mesh_beacon_get() == BLE_MESH_BEACON_ENABLED) { if (bt_mesh_beacon_get() == BLE_MESH_BEACON_ENABLED) {
bt_mesh_beacon_enable(); bt_mesh_beacon_enable();

View File

@ -48,7 +48,7 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) {
if (bt_mesh_proxy_prov_disable(false) == 0) { if (bt_mesh_proxy_server_prov_disable(false) == 0) {
pb_gatt_enabled = true; pb_gatt_enabled = true;
} else { } else {
pb_gatt_enabled = false; pb_gatt_enabled = false;
@ -62,7 +62,7 @@ int bt_mesh_provision(const u8_t net_key[16], u16_t net_idx,
bt_mesh_atomic_clear_bit(bt_mesh.flags, BLE_MESH_VALID); bt_mesh_atomic_clear_bit(bt_mesh.flags, BLE_MESH_VALID);
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) && pb_gatt_enabled) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) && pb_gatt_enabled) {
bt_mesh_proxy_prov_enable(); bt_mesh_proxy_server_prov_enable();
} }
return err; return err;
@ -114,7 +114,7 @@ void bt_mesh_node_reset(void)
} }
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) { if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
bt_mesh_proxy_gatt_disable(); bt_mesh_proxy_server_gatt_disable();
} }
if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) { if (IS_ENABLED(CONFIG_BLE_MESH_SETTINGS)) {
@ -210,7 +210,7 @@ int bt_mesh_prov_enable(bt_mesh_prov_bearer_t bearers)
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) && if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
(bearers & BLE_MESH_PROV_GATT)) { (bearers & BLE_MESH_PROV_GATT)) {
bt_mesh_proxy_prov_enable(); bt_mesh_proxy_server_prov_enable();
bt_mesh_adv_update(); bt_mesh_adv_update();
} }
@ -241,7 +241,7 @@ int bt_mesh_prov_disable(bt_mesh_prov_bearer_t bearers)
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) && if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
(bearers & BLE_MESH_PROV_GATT)) { (bearers & BLE_MESH_PROV_GATT)) {
bt_mesh_proxy_prov_disable(true); bt_mesh_proxy_server_prov_disable(true);
} }
return 0; return 0;
@ -356,13 +356,13 @@ int bt_mesh_init(const struct bt_mesh_prov *prov,
if ((IS_ENABLED(CONFIG_BLE_MESH_NODE) && if ((IS_ENABLED(CONFIG_BLE_MESH_NODE) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) || IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) { IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
bt_mesh_proxy_init(); bt_mesh_proxy_server_init();
} }
if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) || IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) { IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) {
bt_mesh_proxy_prov_client_init(); bt_mesh_proxy_client_init();
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PROV)) { if (IS_ENABLED(CONFIG_BLE_MESH_PROV)) {
@ -427,13 +427,13 @@ int bt_mesh_deinit(struct bt_mesh_deinit_param *param)
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) {
bt_mesh_proxy_prov_disable(true); bt_mesh_proxy_server_prov_disable(true);
} }
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && bt_mesh_is_provisioner_en()) { if (IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && bt_mesh_is_provisioner_en()) {
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) {
bt_mesh_provisioner_pb_gatt_disable(); bt_mesh_proxy_client_prov_disable();
} }
bt_mesh_scan_disable(); bt_mesh_scan_disable();
@ -463,13 +463,13 @@ int bt_mesh_deinit(struct bt_mesh_deinit_param *param)
if ((IS_ENABLED(CONFIG_BLE_MESH_NODE) && if ((IS_ENABLED(CONFIG_BLE_MESH_NODE) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) || IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) { IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER)) {
bt_mesh_proxy_deinit(); bt_mesh_proxy_server_deinit();
} }
if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) && if ((IS_ENABLED(CONFIG_BLE_MESH_PROVISIONER) &&
IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) || IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) ||
IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) { IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT)) {
bt_mesh_proxy_prov_client_deinit(); bt_mesh_proxy_client_deinit();
} }
bt_mesh_gatt_deinit(); bt_mesh_gatt_deinit();
@ -532,7 +532,7 @@ int bt_mesh_provisioner_net_start(bt_mesh_prov_bearer_t bearers)
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) && if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
(bearers & BLE_MESH_PROV_GATT)) { (bearers & BLE_MESH_PROV_GATT)) {
bt_mesh_provisioner_pb_gatt_enable(); bt_mesh_proxy_client_prov_enable();
} }
bt_mesh_atomic_set_bit(bt_mesh.flags, BLE_MESH_VALID_PROV); bt_mesh_atomic_set_bit(bt_mesh.flags, BLE_MESH_VALID_PROV);
@ -608,7 +608,7 @@ int bt_mesh_provisioner_disable(bt_mesh_prov_bearer_t bearers)
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) && if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT) &&
(enable & BLE_MESH_PROV_GATT) && (enable & BLE_MESH_PROV_GATT) &&
(bearers & BLE_MESH_PROV_GATT)) { (bearers & BLE_MESH_PROV_GATT)) {
bt_mesh_provisioner_pb_gatt_disable(); bt_mesh_proxy_client_prov_disable();
#if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN) #if defined(CONFIG_BLE_MESH_USE_DUPLICATE_SCAN)
bt_mesh_update_exceptional_list(BLE_MESH_EXCEP_LIST_REMOVE, bt_mesh_update_exceptional_list(BLE_MESH_EXCEP_LIST_REMOVE,
BLE_MESH_EXCEP_INFO_MESH_PROV_ADV, NULL); BLE_MESH_EXCEP_INFO_MESH_PROV_ADV, NULL);

View File

@ -622,7 +622,7 @@ void bt_mesh_net_sec_update(struct bt_mesh_subnet *sub)
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED) { bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED) {
bt_mesh_proxy_beacon_send(sub); bt_mesh_proxy_server_beacon_send(sub);
} }
} }
@ -808,7 +808,7 @@ int bt_mesh_net_resend(struct bt_mesh_subnet *sub, struct net_buf *buf,
} }
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
bt_mesh_proxy_relay(&buf->b, dst) && bt_mesh_proxy_server_relay(&buf->b, dst) &&
BLE_MESH_ADDR_IS_UNICAST(dst)) { BLE_MESH_ADDR_IS_UNICAST(dst)) {
send_cb_finalize(cb, cb_data); send_cb_finalize(cb, cb_data);
return 0; return 0;
@ -913,7 +913,7 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
*/ */
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
tx->ctx->send_ttl != 1U) { tx->ctx->send_ttl != 1U) {
if (bt_mesh_proxy_relay(&buf->b, tx->ctx->addr) && if (bt_mesh_proxy_server_relay(&buf->b, tx->ctx->addr) &&
BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) { BLE_MESH_ADDR_IS_UNICAST(tx->ctx->addr)) {
/* Notify completion if this only went /* Notify completion if this only went
* through the Mesh Proxy. * through the Mesh Proxy.
@ -925,9 +925,9 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
} }
} }
#if CONFIG_BLE_MESH_GATT_PROXY_CLIENT if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_CLIENT) &&
if (tx->ctx->send_ttl != 1U) { tx->ctx->send_ttl != 1U) {
if (bt_mesh_proxy_client_send(&buf->b, tx->ctx->addr)) { if (bt_mesh_proxy_client_relay(&buf->b, tx->ctx->addr)) {
/* If Proxy Client succeeds to send messages with GATT bearer, /* If Proxy Client succeeds to send messages with GATT bearer,
* we can directly finish here. And if not, which means no * we can directly finish here. And if not, which means no
* connection has been created with Proxy Client, here we will * connection has been created with Proxy Client, here we will
@ -939,7 +939,6 @@ int bt_mesh_net_send(struct bt_mesh_net_tx *tx, struct net_buf *buf,
goto done; goto done;
} }
} }
#endif
/* Deliver to local network interface if necessary */ /* Deliver to local network interface if necessary */
if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() && if (IS_ENABLED(CONFIG_BLE_MESH_NODE) && bt_mesh_is_provisioned() &&
@ -1284,7 +1283,7 @@ static void bt_mesh_net_relay(struct net_buf_simple *sbuf,
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
(bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED || (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_ENABLED ||
rx->net_if == BLE_MESH_NET_IF_LOCAL)) { rx->net_if == BLE_MESH_NET_IF_LOCAL)) {
if (bt_mesh_proxy_relay(&buf->b, rx->ctx.recv_dst) && if (bt_mesh_proxy_server_relay(&buf->b, rx->ctx.recv_dst) &&
BLE_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) { BLE_MESH_ADDR_IS_UNICAST(rx->ctx.recv_dst)) {
goto done; goto done;
} }
@ -1447,7 +1446,7 @@ void bt_mesh_net_recv(struct net_buf_simple *data, s8_t rssi,
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
net_if == BLE_MESH_NET_IF_PROXY) { net_if == BLE_MESH_NET_IF_PROXY) {
bt_mesh_proxy_addr_add(data, rx.ctx.addr); bt_mesh_proxy_server_addr_add(data, rx.ctx.addr);
if (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_DISABLED && if (bt_mesh_gatt_proxy_get() == BLE_MESH_GATT_PROXY_DISABLED &&
!rx.local_match) { !rx.local_match) {
@ -1516,7 +1515,7 @@ void bt_mesh_net_start(void)
if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) && if (IS_ENABLED(CONFIG_BLE_MESH_GATT_PROXY_SERVER) &&
bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_NOT_SUPPORTED) { bt_mesh_gatt_proxy_get() != BLE_MESH_GATT_PROXY_NOT_SUPPORTED) {
bt_mesh_proxy_gatt_enable(); bt_mesh_proxy_server_gatt_enable();
bt_mesh_adv_update(); bt_mesh_adv_update();
} }

View File

@ -242,7 +242,7 @@ static void reset_state(void)
link.rx.prev_id = XACT_NVAL; link.rx.prev_id = XACT_NVAL;
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
link.rx.buf = bt_mesh_proxy_get_buf(); link.rx.buf = bt_mesh_proxy_server_get_buf();
#else #else
net_buf_simple_reset(&rx_buf); net_buf_simple_reset(&rx_buf);
link.rx.buf = &rx_buf; link.rx.buf = &rx_buf;
@ -530,7 +530,7 @@ static int prov_send_gatt(struct net_buf_simple *msg)
/* Changed by Espressif, add provisioning timeout timer operations. /* Changed by Espressif, add provisioning timeout timer operations.
* When sending a provisioning PDU successfully, restart the 60s timer. * When sending a provisioning PDU successfully, restart the 60s timer.
*/ */
err = bt_mesh_proxy_send(link.conn, BLE_MESH_PROXY_PROV, msg); err = bt_mesh_proxy_server_send(link.conn, BLE_MESH_PROXY_PROV, msg);
if (err) { if (err) {
BT_ERR("%s, Failed to send provisioning PDU", __func__); BT_ERR("%s, Failed to send provisioning PDU", __func__);
return err; return err;

View File

@ -1698,7 +1698,7 @@ static int prov_send_gatt(const u8_t idx, struct net_buf_simple *msg)
return -ENOTCONN; return -ENOTCONN;
} }
err = bt_mesh_proxy_prov_client_send(link[idx].conn, BLE_MESH_PROXY_PROV, msg); err = bt_mesh_proxy_client_send(link[idx].conn, BLE_MESH_PROXY_PROV, msg);
if (err) { if (err) {
BT_ERR("%s, Failed to send PB-GATT pdu", __func__); BT_ERR("%s, Failed to send PB-GATT pdu", __func__);
return err; return err;
@ -3453,7 +3453,7 @@ void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, s8_t rss
return; return;
} }
addr = bt_mesh_pba_get_addr(); addr = bt_mesh_get_unprov_dev_addr();
uuid = buf->data; uuid = buf->data;
net_buf_simple_pull(buf, 16); net_buf_simple_pull(buf, 16);
/* Mesh beacon uses big-endian to send beacon data */ /* Mesh beacon uses big-endian to send beacon data */
@ -3472,7 +3472,8 @@ void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, s8_t rss
#endif /* CONFIG_BLE_MESH_PB_ADV */ #endif /* CONFIG_BLE_MESH_PB_ADV */
} }
void bt_mesh_provisioner_prov_adv_ind_recv(struct net_buf_simple *buf, const bt_mesh_addr_t *addr, s8_t rssi) void bt_mesh_provisioner_prov_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi)
{ {
#if defined(CONFIG_BLE_MESH_PB_GATT) #if defined(CONFIG_BLE_MESH_PB_GATT)
const u8_t *uuid = NULL; const u8_t *uuid = NULL;

View File

@ -164,7 +164,8 @@ int bt_mesh_provisioner_prov_deinit(bool erase);
*/ */
void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, s8_t rssi); void bt_mesh_provisioner_unprov_beacon_recv(struct net_buf_simple *buf, s8_t rssi);
void bt_mesh_provisioner_prov_adv_ind_recv(struct net_buf_simple *buf, const bt_mesh_addr_t *addr, s8_t rssi); void bt_mesh_provisioner_prov_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi);
/** /**
* @brief This function gets the bt_mesh_prov pointer. * @brief This function gets the bt_mesh_prov pointer.

View File

@ -373,8 +373,8 @@ static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type,
return err; return err;
} }
int bt_mesh_proxy_prov_client_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_client_send(struct bt_mesh_conn *conn, u8_t type,
struct net_buf_simple *msg) struct net_buf_simple *msg)
{ {
struct bt_mesh_proxy_server *server = find_server(conn); struct bt_mesh_proxy_server *server = find_server(conn);
@ -491,7 +491,7 @@ static ssize_t prov_recv_ntf(struct bt_mesh_conn *conn, u8_t *data, u16_t len)
return -EINVAL; return -EINVAL;
} }
int bt_mesh_provisioner_pb_gatt_enable(void) int bt_mesh_proxy_client_prov_enable(void)
{ {
int i; int i;
@ -506,7 +506,7 @@ int bt_mesh_provisioner_pb_gatt_enable(void)
return 0; return 0;
} }
int bt_mesh_provisioner_pb_gatt_disable(void) int bt_mesh_proxy_client_prov_disable(void)
{ {
int i; int i;
@ -564,14 +564,14 @@ static ssize_t proxy_recv_ntf(struct bt_mesh_conn *conn, u8_t *data, u16_t len)
} }
/** /**
* Currently proxy client doesn't need bt_mesh_proxy_client_enable() and * Currently proxy client doesn't need bt_mesh_proxy_client_gatt_enable()
* bt_mesh_proxy_client_disable() functions, and once they are used, * and bt_mesh_proxy_client_gatt_disable() functions, and once they are
* proxy client can be enabled to parse node_id_adv and net_id_adv in * used, proxy client can be enabled to parse node_id_adv and net_id_adv
* order to support proxy client role. * in order to support proxy client role.
* And if gatt proxy is disabled, proxy client can stop handling these * And if gatt proxy is disabled, proxy client can stop handling these
* two kinds of connectable advertising packets. * two kinds of connectable advertising packets.
*/ */
int bt_mesh_proxy_client_enable(void) int bt_mesh_proxy_client_gatt_enable(void)
{ {
int i; int i;
@ -593,7 +593,7 @@ int bt_mesh_proxy_client_enable(void)
return 0; return 0;
} }
int bt_mesh_proxy_client_disable(void) int bt_mesh_proxy_client_gatt_disable(void)
{ {
int i; int i;
@ -650,7 +650,8 @@ static struct bt_mesh_subnet *bt_mesh_is_net_id_exist(const u8_t net_id[8])
return NULL; return NULL;
} }
void bt_mesh_proxy_client_adv_ind_recv(struct net_buf_simple *buf, const bt_mesh_addr_t *addr, s8_t rssi) void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi)
{ {
bt_mesh_proxy_adv_ctx_t ctx = {0}; bt_mesh_proxy_adv_ctx_t ctx = {0};
u8_t type = 0U; u8_t type = 0U;
@ -741,7 +742,7 @@ int bt_mesh_proxy_client_disconnect(u8_t conn_handle)
return 0; return 0;
} }
bool bt_mesh_proxy_client_send(struct net_buf_simple *buf, u16_t dst) bool bt_mesh_proxy_client_relay(struct net_buf_simple *buf, u16_t dst)
{ {
bool send = false; bool send = false;
int err = 0; int err = 0;
@ -761,7 +762,7 @@ bool bt_mesh_proxy_client_send(struct net_buf_simple *buf, u16_t dst)
net_buf_simple_init(&msg, 1); net_buf_simple_init(&msg, 1);
net_buf_simple_add_mem(&msg, buf->data, buf->len); net_buf_simple_add_mem(&msg, buf->data, buf->len);
err = bt_mesh_proxy_prov_client_send(server->conn, BLE_MESH_PROXY_NET_PDU, &msg); err = bt_mesh_proxy_client_send(server->conn, BLE_MESH_PROXY_NET_PDU, &msg);
if (err) { if (err) {
BT_ERR("%s, Failed to send proxy net message (err %d)", __func__, err); BT_ERR("%s, Failed to send proxy net message (err %d)", __func__, err);
} else { } else {
@ -780,7 +781,7 @@ static int beacon_send(struct bt_mesh_conn *conn, struct bt_mesh_subnet *sub)
net_buf_simple_init(&buf, 1); net_buf_simple_init(&buf, 1);
bt_mesh_beacon_create(sub, &buf); bt_mesh_beacon_create(sub, &buf);
return bt_mesh_proxy_prov_client_send(conn, BLE_MESH_PROXY_BEACON, &buf); return bt_mesh_proxy_client_send(conn, BLE_MESH_PROXY_BEACON, &buf);
} }
bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub) bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub)
@ -922,7 +923,7 @@ static int send_proxy_cfg(struct bt_mesh_conn *conn, u16_t net_idx, struct bt_me
return err; return err;
} }
err = bt_mesh_proxy_prov_client_send(conn, BLE_MESH_PROXY_CONFIG, buf); err = bt_mesh_proxy_client_send(conn, BLE_MESH_PROXY_CONFIG, buf);
if (err) { if (err) {
BT_ERR("%s, Failed to send proxy cfg message (err %d)", __func__, err); BT_ERR("%s, Failed to send proxy cfg message (err %d)", __func__, err);
} }
@ -931,7 +932,8 @@ static int send_proxy_cfg(struct bt_mesh_conn *conn, u16_t net_idx, struct bt_me
return err; return err;
} }
int bt_mesh_proxy_client_send_cfg(u8_t conn_handle, u16_t net_idx, struct bt_mesh_proxy_cfg_pdu *pdu) int bt_mesh_proxy_client_cfg_send(u8_t conn_handle, u16_t net_idx,
struct bt_mesh_proxy_cfg_pdu *pdu)
{ {
struct bt_mesh_conn *conn = NULL; struct bt_mesh_conn *conn = NULL;
@ -962,7 +964,7 @@ int bt_mesh_proxy_client_send_cfg(u8_t conn_handle, u16_t net_idx, struct bt_mes
} }
#endif /* CONFIG_BLE_MESH_GATT_PROXY_CLIENT */ #endif /* CONFIG_BLE_MESH_GATT_PROXY_CLIENT */
int bt_mesh_proxy_prov_client_init(void) int bt_mesh_proxy_client_init(void)
{ {
int i; int i;
@ -988,7 +990,7 @@ int bt_mesh_proxy_prov_client_init(void)
return 0; return 0;
} }
int bt_mesh_proxy_prov_client_deinit(void) int bt_mesh_proxy_client_deinit(void)
{ {
int i; int i;

View File

@ -74,13 +74,14 @@ typedef struct {
}; };
} bt_mesh_proxy_client_pdu_t; } bt_mesh_proxy_client_pdu_t;
int bt_mesh_proxy_prov_client_send(struct bt_mesh_conn *conn, u8_t type, struct net_buf_simple *msg); int bt_mesh_proxy_client_send(struct bt_mesh_conn *conn, u8_t type,
struct net_buf_simple *msg);
int bt_mesh_provisioner_pb_gatt_enable(void); int bt_mesh_proxy_client_prov_enable(void);
int bt_mesh_provisioner_pb_gatt_disable(void); int bt_mesh_proxy_client_prov_disable(void);
int bt_mesh_proxy_client_enable(void); int bt_mesh_proxy_client_gatt_enable(void);
int bt_mesh_proxy_client_disable(void); int bt_mesh_proxy_client_gatt_disable(void);
typedef void (*proxy_client_recv_adv_cb_t)(const bt_mesh_addr_t *addr, u8_t type, bt_mesh_proxy_adv_ctx_t *ctx, s8_t rssi); typedef void (*proxy_client_recv_adv_cb_t)(const bt_mesh_addr_t *addr, u8_t type, bt_mesh_proxy_adv_ctx_t *ctx, s8_t rssi);
typedef void (*proxy_client_connect_cb_t)(const bt_mesh_addr_t *addr, u8_t conn_handle, u16_t net_idx); typedef void (*proxy_client_connect_cb_t)(const bt_mesh_addr_t *addr, u8_t conn_handle, u16_t net_idx);
@ -92,17 +93,21 @@ void bt_mesh_proxy_client_set_conn_cb(proxy_client_connect_cb_t cb);
void bt_mesh_proxy_client_set_disconn_cb(proxy_client_disconnect_cb_t cb); void bt_mesh_proxy_client_set_disconn_cb(proxy_client_disconnect_cb_t cb);
void bt_mesh_proxy_client_set_filter_status_cb(proxy_client_recv_filter_status_cb_t cb); void bt_mesh_proxy_client_set_filter_status_cb(proxy_client_recv_filter_status_cb_t cb);
void bt_mesh_proxy_client_adv_ind_recv(struct net_buf_simple *buf, const bt_mesh_addr_t *addr, s8_t rssi); void bt_mesh_proxy_client_gatt_adv_recv(struct net_buf_simple *buf,
const bt_mesh_addr_t *addr, s8_t rssi);
int bt_mesh_proxy_client_connect(const u8_t addr[6], u8_t addr_type, u16_t net_idx); int bt_mesh_proxy_client_connect(const u8_t addr[6], u8_t addr_type, u16_t net_idx);
int bt_mesh_proxy_client_disconnect(u8_t conn_handle); int bt_mesh_proxy_client_disconnect(u8_t conn_handle);
bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub); bool bt_mesh_proxy_client_beacon_send(struct bt_mesh_subnet *sub);
bool bt_mesh_proxy_client_send(struct net_buf_simple *buf, u16_t dst);
int bt_mesh_proxy_client_send_cfg(u8_t conn_handle, u16_t net_idx, struct bt_mesh_proxy_cfg_pdu *pdu);
int bt_mesh_proxy_prov_client_init(void); bool bt_mesh_proxy_client_relay(struct net_buf_simple *buf, u16_t dst);
int bt_mesh_proxy_prov_client_deinit(void);
int bt_mesh_proxy_client_cfg_send(u8_t conn_handle, u16_t net_idx,
struct bt_mesh_proxy_cfg_pdu *pdu);
int bt_mesh_proxy_client_init(void);
int bt_mesh_proxy_client_deinit(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -370,7 +370,7 @@ static void proxy_send_beacons(struct k_work *work)
} }
} }
void bt_mesh_proxy_beacon_send(struct bt_mesh_subnet *sub) void bt_mesh_proxy_server_beacon_send(struct bt_mesh_subnet *sub)
{ {
int i; int i;
@ -378,7 +378,7 @@ void bt_mesh_proxy_beacon_send(struct bt_mesh_subnet *sub)
/* NULL means we send on all subnets */ /* NULL means we send on all subnets */
for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) { for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {
if (bt_mesh.sub[i].net_idx != BLE_MESH_KEY_UNUSED) { if (bt_mesh.sub[i].net_idx != BLE_MESH_KEY_UNUSED) {
bt_mesh_proxy_beacon_send(&bt_mesh.sub[i]); bt_mesh_proxy_server_beacon_send(&bt_mesh.sub[i]);
} }
} }
@ -392,7 +392,7 @@ void bt_mesh_proxy_beacon_send(struct bt_mesh_subnet *sub)
} }
} }
void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub) void bt_mesh_proxy_server_identity_start(struct bt_mesh_subnet *sub)
{ {
sub->node_id = BLE_MESH_NODE_IDENTITY_RUNNING; sub->node_id = BLE_MESH_NODE_IDENTITY_RUNNING;
sub->node_id_start = k_uptime_get_32(); sub->node_id_start = k_uptime_get_32();
@ -401,7 +401,7 @@ void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub)
next_idx = sub - bt_mesh.sub; next_idx = sub - bt_mesh.sub;
} }
void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub) void bt_mesh_proxy_server_identity_stop(struct bt_mesh_subnet *sub)
{ {
sub->node_id = BLE_MESH_NODE_IDENTITY_STOPPED; sub->node_id = BLE_MESH_NODE_IDENTITY_STOPPED;
sub->node_id_start = 0U; sub->node_id_start = 0U;
@ -428,7 +428,7 @@ int bt_mesh_proxy_identity_enable(void)
continue; continue;
} }
bt_mesh_proxy_identity_start(sub); bt_mesh_proxy_server_identity_start(sub);
count++; count++;
} }
@ -624,7 +624,7 @@ static void proxy_disconnected(struct bt_mesh_conn *conn, u8_t reason)
bt_mesh_adv_update(); bt_mesh_adv_update();
} }
struct net_buf_simple *bt_mesh_proxy_get_buf(void) struct net_buf_simple *bt_mesh_proxy_server_get_buf(void)
{ {
struct net_buf_simple *buf = &clients[0].buf; struct net_buf_simple *buf = &clients[0].buf;
@ -697,7 +697,7 @@ static struct bt_mesh_gatt_attr prov_attrs[] = {
struct bt_mesh_gatt_service prov_svc = BLE_MESH_GATT_SERVICE(prov_attrs); struct bt_mesh_gatt_service prov_svc = BLE_MESH_GATT_SERVICE(prov_attrs);
int bt_mesh_proxy_prov_enable(void) int bt_mesh_proxy_server_prov_enable(void)
{ {
int i; int i;
@ -727,7 +727,7 @@ int bt_mesh_proxy_prov_enable(void)
return 0; return 0;
} }
int bt_mesh_proxy_prov_disable(bool disconnect) int bt_mesh_proxy_server_prov_disable(bool disconnect)
{ {
int i; int i;
@ -832,7 +832,7 @@ static struct bt_mesh_gatt_attr proxy_attrs[] = {
struct bt_mesh_gatt_service proxy_svc = BLE_MESH_GATT_SERVICE(proxy_attrs); struct bt_mesh_gatt_service proxy_svc = BLE_MESH_GATT_SERVICE(proxy_attrs);
int bt_mesh_proxy_gatt_enable(void) int bt_mesh_proxy_server_gatt_enable(void)
{ {
int i; int i;
@ -860,7 +860,7 @@ int bt_mesh_proxy_gatt_enable(void)
return 0; return 0;
} }
void bt_mesh_proxy_gatt_disconnect(void) void bt_mesh_proxy_server_gatt_disconnect(void)
{ {
int i; int i;
@ -877,7 +877,7 @@ void bt_mesh_proxy_gatt_disconnect(void)
} }
} }
int bt_mesh_proxy_gatt_disable(void) int bt_mesh_proxy_server_gatt_disable(void)
{ {
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -891,7 +891,7 @@ int bt_mesh_proxy_gatt_disable(void)
return -EBUSY; return -EBUSY;
} }
bt_mesh_proxy_gatt_disconnect(); bt_mesh_proxy_server_gatt_disconnect();
bt_mesh_gatts_service_stop(&proxy_svc); bt_mesh_gatts_service_stop(&proxy_svc);
gatt_svc = MESH_GATT_NONE; gatt_svc = MESH_GATT_NONE;
@ -899,7 +899,7 @@ int bt_mesh_proxy_gatt_disable(void)
return 0; return 0;
} }
void bt_mesh_proxy_addr_add(struct net_buf_simple *buf, u16_t addr) void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, u16_t addr)
{ {
struct bt_mesh_proxy_client *client = struct bt_mesh_proxy_client *client =
CONTAINER_OF(buf, struct bt_mesh_proxy_client, buf); CONTAINER_OF(buf, struct bt_mesh_proxy_client, buf);
@ -945,7 +945,7 @@ static bool client_filter_match(struct bt_mesh_proxy_client *client,
return false; return false;
} }
bool bt_mesh_proxy_relay(struct net_buf_simple *buf, u16_t dst) bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, u16_t dst)
{ {
bool relayed = false; bool relayed = false;
int i; int i;
@ -970,7 +970,7 @@ bool bt_mesh_proxy_relay(struct net_buf_simple *buf, u16_t dst)
net_buf_simple_reserve(&msg, 1); net_buf_simple_reserve(&msg, 1);
net_buf_simple_add_mem(&msg, buf->data, buf->len); net_buf_simple_add_mem(&msg, buf->data, buf->len);
bt_mesh_proxy_send(client->conn, BLE_MESH_PROXY_NET_PDU, &msg); bt_mesh_proxy_server_send(client->conn, BLE_MESH_PROXY_NET_PDU, &msg);
relayed = true; relayed = true;
} }
@ -1032,8 +1032,8 @@ static int proxy_segment_and_send(struct bt_mesh_conn *conn, u8_t type,
return 0; return 0;
} }
int bt_mesh_proxy_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, u8_t type,
struct net_buf_simple *msg) struct net_buf_simple *msg)
{ {
struct bt_mesh_proxy_client *client = find_client(conn); struct bt_mesh_proxy_client *client = find_client(conn);
@ -1251,7 +1251,7 @@ static s32_t gatt_proxy_advertise(struct bt_mesh_subnet *sub)
active, remaining); active, remaining);
node_id_adv(sub); node_id_adv(sub);
} else { } else {
bt_mesh_proxy_identity_stop(sub); bt_mesh_proxy_server_identity_stop(sub);
BT_DBG("Node ID stopped"); BT_DBG("Node ID stopped");
} }
} }
@ -1330,7 +1330,7 @@ static size_t gatt_prov_adv_create(struct bt_mesh_adv_data prov_sd[2])
} }
#endif /* CONFIG_BLE_MESH_PB_GATT */ #endif /* CONFIG_BLE_MESH_PB_GATT */
s32_t bt_mesh_proxy_adv_start(void) s32_t bt_mesh_proxy_server_adv_start(void)
{ {
BT_DBG("%s", __func__); BT_DBG("%s", __func__);
@ -1374,7 +1374,7 @@ s32_t bt_mesh_proxy_adv_start(void)
return K_FOREVER; return K_FOREVER;
} }
void bt_mesh_proxy_adv_stop(void) void bt_mesh_proxy_server_adv_stop(void)
{ {
int err = 0; int err = 0;
@ -1397,7 +1397,7 @@ static struct bt_mesh_conn_cb conn_callbacks = {
.disconnected = proxy_disconnected, .disconnected = proxy_disconnected,
}; };
int bt_mesh_proxy_init(void) int bt_mesh_proxy_server_init(void)
{ {
int i; int i;
@ -1425,7 +1425,7 @@ int bt_mesh_proxy_init(void)
return bt_mesh_gatts_set_local_device_name(device_name); return bt_mesh_gatts_set_local_device_name(device_name);
} }
int bt_mesh_proxy_deinit(void) int bt_mesh_proxy_server_deinit(void)
{ {
int i; int i;

View File

@ -40,31 +40,32 @@ extern "C" {
int bt_mesh_set_device_name(const char *name); int bt_mesh_set_device_name(const char *name);
int bt_mesh_proxy_send(struct bt_mesh_conn *conn, u8_t type, int bt_mesh_proxy_server_send(struct bt_mesh_conn *conn, u8_t type,
struct net_buf_simple *msg); struct net_buf_simple *msg);
int bt_mesh_proxy_prov_enable(void); int bt_mesh_proxy_server_prov_enable(void);
int bt_mesh_proxy_prov_disable(bool disconnect); int bt_mesh_proxy_server_prov_disable(bool disconnect);
int bt_mesh_proxy_gatt_enable(void); int bt_mesh_proxy_server_gatt_enable(void);
int bt_mesh_proxy_gatt_disable(void); int bt_mesh_proxy_server_gatt_disable(void);
void bt_mesh_proxy_gatt_disconnect(void);
void bt_mesh_proxy_beacon_send(struct bt_mesh_subnet *sub); void bt_mesh_proxy_server_gatt_disconnect(void);
struct net_buf_simple *bt_mesh_proxy_get_buf(void); void bt_mesh_proxy_server_beacon_send(struct bt_mesh_subnet *sub);
s32_t bt_mesh_proxy_adv_start(void); struct net_buf_simple *bt_mesh_proxy_server_get_buf(void);
void bt_mesh_proxy_adv_stop(void);
void bt_mesh_proxy_identity_start(struct bt_mesh_subnet *sub); s32_t bt_mesh_proxy_server_adv_start(void);
void bt_mesh_proxy_identity_stop(struct bt_mesh_subnet *sub); void bt_mesh_proxy_server_adv_stop(void);
bool bt_mesh_proxy_relay(struct net_buf_simple *buf, u16_t dst); void bt_mesh_proxy_server_identity_start(struct bt_mesh_subnet *sub);
void bt_mesh_proxy_addr_add(struct net_buf_simple *buf, u16_t addr); void bt_mesh_proxy_server_identity_stop(struct bt_mesh_subnet *sub);
int bt_mesh_proxy_init(void); bool bt_mesh_proxy_server_relay(struct net_buf_simple *buf, u16_t dst);
int bt_mesh_proxy_deinit(void); void bt_mesh_proxy_server_addr_add(struct net_buf_simple *buf, u16_t addr);
int bt_mesh_proxy_server_init(void);
int bt_mesh_proxy_server_deinit(void);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1338,7 +1338,7 @@ int settings_core_commit(void)
} }
if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) { if (IS_ENABLED(CONFIG_BLE_MESH_PB_GATT)) {
bt_mesh_proxy_prov_disable(true); bt_mesh_proxy_server_prov_disable(true);
} }
for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) { for (i = 0; i < ARRAY_SIZE(bt_mesh.sub); i++) {