You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I configure a mesh sensor (server) + central (client) for data transmission, but client cannot publish group address to server.
in central node (client):
Mesh controller handling thread starting...
Provisioner initializing...
[00:00:00.191,000] esp32_bt_adapter: BT controller compile version [4713a69]
[00:00:00.191,000] esp32_bt_adapter: Feature Config, ADV:1, BLE_50:1, DTM:1, SCAN:1, CCA:0, SMP:1, CONNECT:1
[00:00:00.221,000] bt_hci_core: HCI transport: BT ESP32
[00:00:00.221,000] bt_hci_core: Identity: D8:3B:DA:5B:CD:94 (public)
[00:00:00.221,000] bt_hci_core: HCI: version 5.0 (0x09) revision 0x0016, manufacturer 0x02e5
[00:00:00.221,000] bt_hci_core: LMP: version 5.0 (0x09) subver 0x0016
Bluetooth initialized
[00:00:00.221,000] bt_mesh_access: Unused space in relation list: 10
Mesh initialized
Created CDB
[00:00:00.556,000] bt_mesh_main: Primary Element: 0x0001
Provisioning completed
Waiting for unprovisioned beacon...
Unprovisioned_beacon
Detected node UUID: aabbccddeeff11223344556677889900
Provisioning aabbccddeeff11223344556677889900
Waiting for node to be added...
Unprovisioned_beacon
Node added at address 0x0002
Configuring node 0x0002...
AppKey bound to model 0x1100
Publish set failed for sensor model (err 0 status 7)
Waiting for unprovisioned beacon...
Configuring node 0x0002...
AppKey bound to model 0x1100
Publish set failed for sensor model (err 0 status 7)
Waiting for unprovisioned beacon...
in sensor node (server):
Mesh sensor handling thread starting...
Booting Sensor Node...
[00:00:00.002,000] esp32_bt_adapter: BT controller compile version [4713a]
[00:00:00.002,000] esp32_bt_adapter: Feature Config, ADV:1, BLE_50:1, DTM1
[00:00:00.045,000] bt_hci_core: HCI transport: BT ESP32
[00:00:00.045,000] bt_hci_core: Identity: 58:8C:81:AE:CB:08 (public)
[00:00:00.045,000] bt_hci_core: HCI: version 5.0 (0x09) revision 0x0016, 5
[00:00:00.045,000] bt_hci_core: LMP: version 5.0 (0x09) subver 0x0016
Bluetooth initialized
[00:00:00.045,000] bt_mesh_access: Unused space in relation list: 10
[00:00:00.753,000] bt_mesh_provisionee: Device UUID: aabbccdd-eeff-1122-30
Mesh sensor node ready (unprovisioned)
[00:00:04.893,000] bt_mesh_main: Primary Element: 0x0002
Provisioned sensor node at addr 0x0002
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
Here is my central mesh node:
#include <zephyr/sys/printk.h>
#include <zephyr/settings/settings.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/mesh.h>
#include "ble_mesh_central.h"
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I configure a mesh sensor (server) + central (client) for data transmission, but client cannot publish group address to server.
in central node (client):
Mesh controller handling thread starting...
Provisioner initializing...
[00:00:00.191,000] esp32_bt_adapter: BT controller compile version [4713a69]
[00:00:00.191,000] esp32_bt_adapter: Feature Config, ADV:1, BLE_50:1, DTM:1, SCAN:1, CCA:0, SMP:1, CONNECT:1
[00:00:00.221,000] bt_hci_core: HCI transport: BT ESP32
[00:00:00.221,000] bt_hci_core: Identity: D8:3B:DA:5B:CD:94 (public)
[00:00:00.221,000] bt_hci_core: HCI: version 5.0 (0x09) revision 0x0016, manufacturer 0x02e5
[00:00:00.221,000] bt_hci_core: LMP: version 5.0 (0x09) subver 0x0016
Bluetooth initialized
[00:00:00.221,000] bt_mesh_access: Unused space in relation list: 10
Mesh initialized
Created CDB
[00:00:00.556,000] bt_mesh_main: Primary Element: 0x0001
Provisioning completed
Waiting for unprovisioned beacon...
Unprovisioned_beacon
Detected node UUID: aabbccddeeff11223344556677889900
Provisioning aabbccddeeff11223344556677889900
Waiting for node to be added...
Unprovisioned_beacon
Node added at address 0x0002
Configuring node 0x0002...
AppKey bound to model 0x1100
Publish set failed for sensor model (err 0 status 7)
Waiting for unprovisioned beacon...
Configuring node 0x0002...
AppKey bound to model 0x1100
Publish set failed for sensor model (err 0 status 7)
Waiting for unprovisioned beacon...
in sensor node (server):
Mesh sensor handling thread starting...
Booting Sensor Node...
[00:00:00.002,000] esp32_bt_adapter: BT controller compile version [4713a]
[00:00:00.002,000] esp32_bt_adapter: Feature Config, ADV:1, BLE_50:1, DTM1
[00:00:00.045,000] bt_hci_core: HCI transport: BT ESP32
[00:00:00.045,000] bt_hci_core: Identity: 58:8C:81:AE:CB:08 (public)
[00:00:00.045,000] bt_hci_core: HCI: version 5.0 (0x09) revision 0x0016, 5
[00:00:00.045,000] bt_hci_core: LMP: version 5.0 (0x09) subver 0x0016
Bluetooth initialized
[00:00:00.045,000] bt_mesh_access: Unused space in relation list: 10
[00:00:00.753,000] bt_mesh_provisionee: Device UUID: aabbccdd-eeff-1122-30
Mesh sensor node ready (unprovisioned)
[00:00:04.893,000] bt_mesh_main: Primary Element: 0x0002
Provisioned sensor node at addr 0x0002
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
No publish address assigned (pub->addr=0x0000)
Here is my central mesh node:
#include <zephyr/sys/printk.h>
#include <zephyr/settings/settings.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/mesh.h>
#include "ble_mesh_central.h"
static const uint16_t net_idx;
static const uint16_t app_idx;
static uint16_t self_addr = 0x0001; /* Provisioner address */
static uint16_t node_addr;
static const uint8_t dev_uuid[16] = {
0xaa, 0xbb, 0xcc, 0xdd,
0xee, 0xff, 0x11, 0x22,
0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x99, 0x00
};
static uint8_t node_uuid[16];
K_SEM_DEFINE(sem_unprov_beacon, 0, 1);
K_SEM_DEFINE(sem_node_added, 0, 1);
static void sensor_status(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
int32_t value;
// Extract sensor data from buf
value = net_buf_simple_pull_le32(buf);
}
/* ----------------- Mesh component ----------------- */
BT_MESH_MODEL_PUB_DEFINE(sensor_cli_pub, NULL, 10);
/* Define config client instance */
static struct bt_mesh_cfg_cli cfg_cli = {
// You can set callbacks if needed, otherwise leave empty
};
static const struct bt_mesh_model_op sensor_cli_op[] = {
{ BT_MESH_MODEL_OP_SENSOR_STATUS, 4, sensor_status },
BT_MESH_MODEL_OP_END,
};
static struct bt_mesh_model root_models[] = {
BT_MESH_MODEL_CFG_CLI(&cfg_cli),
BT_MESH_MODEL(BT_MESH_MODEL_ID_SENSOR_CLI,
sensor_cli_op, &sensor_cli_pub, NULL),
};
static const struct bt_mesh_elem elements[] = {
BT_MESH_ELEM(0, root_models, BT_MESH_MODEL_NONE),
};
static void setup_cdb(void)
{
struct bt_mesh_cdb_app_key *key;
uint8_t app_key[16];
int err;
}
static bool model_supports_pub(uint16_t mod_id) {
switch (mod_id) {
case BT_MESH_MODEL_ID_GEN_ONOFF_SRV:
case BT_MESH_MODEL_ID_SENSOR_SRV:
return true;
default:
return false;
}
}
int configure_model_pub(uint16_t net_idx,
uint16_t node_addr,
uint16_t elem_addr,
uint16_t mod_id,
uint16_t app_idx,
uint16_t group_addr,
uint8_t ttl,
uint8_t period_sec,
uint8_t transmit_count,
uint8_t transmit_interval_ms)
{
struct bt_mesh_cfg_cli_mod_pub pub;
uint8_t status;
int err;
}
/* ----------------- Configure Node ----------------- */
static void configure_node(struct bt_mesh_cdb_node *node)
{
NET_BUF_SIMPLE_DEFINE(buf, BT_MESH_RX_SDU_MAX);
struct bt_mesh_comp_p0_elem elem;
struct bt_mesh_cdb_app_key *key;
uint8_t app_key[16];
struct bt_mesh_comp_p0 comp;
uint8_t status;
int err, elem_addr;
}
static uint8_t check_unconfigured(struct bt_mesh_cdb_node *node, void *data)
{
k_sleep(K_MSEC(100));
}
/* ----------------- Callbacks ----------------- */
static void unprovisioned_beacon(uint8_t uuid[16],
bt_mesh_prov_oob_info_t oob_info,
uint32_t *uri_hash)
{
printk("Unprovisioned_beacon\n");
memcpy(node_uuid, uuid, 16);
k_sem_give(&sem_unprov_beacon);
}
static void node_added(uint16_t idx, uint8_t uuid[16], uint16_t addr, uint8_t num_elem)
{
printk("Node added at address 0x%04x\n", addr);
node_addr = addr;
k_sem_give(&sem_node_added);
}
static const struct bt_mesh_prov prov = {
.uuid = dev_uuid,
.unprovisioned_beacon = unprovisioned_beacon,
.node_added = node_added,
};
static const struct bt_mesh_comp mesh_comp = {
.cid = BT_COMP_ID_LF,
.elem = elements,
.elem_count = ARRAY_SIZE(elements),
};
/* ----------------- Provisioner initialization ----------------- */
static int bt_ready(void)
{
uint8_t net_key[16], dev_key[16];
int err;
}
int start_mesh_central(void)
{
int err;
char uuid_str[33];
}
Here is sensor node:
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/mesh.h>
#include <zephyr/settings/settings.h>
#include <zephyr/sys/printk.h>
#include <zephyr/kernel.h>
#include "ble_mesh_sensor.h"
#include "ble_mesh_central.h"
/* ------------------- Sensor Server ------------------- /
static int32_t sensor_value = 25;
static struct k_work_delayable sensor_work;
/ ------------------- Provisioning ------------------- */
static uint8_t dev_uuid[16] = {
0xaa, 0xbb, 0xcc, 0xdd,
0xee, 0xff, 0x11, 0x22,
0x33, 0x44, 0x55, 0x66,
0x77, 0x88, 0x99, 0x00
};
BT_MESH_MODEL_PUB_DEFINE(sensor_pub, NULL, 4);
static int sensor_get(const struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *buf)
{
printk("Sensor server get\n");
}
static const struct bt_mesh_model_op sensor_srv_op[] = {
{ BT_MESH_MODEL_OP_SENSOR_GET, BT_MESH_LEN_EXACT(0), sensor_get },
BT_MESH_MODEL_OP_END,
};
static struct bt_mesh_model root_models[] = {
BT_MESH_MODEL_CFG_SRV,
BT_MESH_MODEL(BT_MESH_MODEL_ID_SENSOR_SRV,
sensor_srv_op, &sensor_pub, NULL)
};
static const struct bt_mesh_elem elements[] = {
BT_MESH_ELEM(0, root_models, BT_MESH_MODEL_NONE),
};
static const struct bt_mesh_comp comp = {
.cid = BT_COMP_ID_LF,
.elem = elements,
.elem_count = ARRAY_SIZE(elements),
};
/* ------------------- Periodic Sensor Publish ------------------- */
static void sensor_publish(struct k_work *work)
{
struct bt_mesh_model *model = &root_models[1]; // Sensor Server
struct bt_mesh_model_pub *pub = model->pub;
}
static void prov_complete(uint16_t net_idx, uint16_t addr)
{
printk("Provisioned sensor node at addr 0x%04x\n", addr);
k_work_init_delayable(&sensor_work, sensor_publish);
k_work_reschedule(&sensor_work, K_SECONDS(5));
}
static void prov_reset(void)
{
bt_mesh_prov_enable(BT_MESH_PROV_ADV | BT_MESH_PROV_GATT);
}
static const struct bt_mesh_prov prov = {
.uuid = dev_uuid,
.complete = prov_complete,
.reset = prov_reset,
};
/* ------------------- Bluetooth Ready ------------------- */
static void bt_ready(int err)
{
if (err) {
printk("Bluetooth init failed (err %d)\n", err);
return;
}
}
/* ------------------- Entry Point ------------------- */
void start_mesh_sensor(void)
{
printk("Booting Sensor Node...\n");
bt_enable(bt_ready);
}
Beta Was this translation helpful? Give feedback.
All reactions