Topics

[ #BluetoothMesh ] Can I use bt_mesh_model_publish() in ./samples/bluetooth/mesh_demo? #bluetoothmesh


Kai Ren
 

Hello,

I'm trying to know the difference between two APIs, they are:

* int bt_mesh_model_publish(struct bt_mesh_model *model)
* int bt_mesh_model_send(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data)

All of them are for access message sending, but I'm curious that is it okay that use bt_mesh_model_publish() function in ./samples/bluetooth/mesh_demo? The reason I asked is that mesh_demo is self-provisioning example, so there is no phase for model configuration.

Regards,
Kai


Johan Hedberg
 

Hi Kai,

On Sun, May 06, 2018, Kai Ren wrote:
I'm trying to know the difference between two APIs, they are:

* int bt_mesh_model_publish(struct bt_mesh_model *model)
* int bt_mesh_model_send(struct bt_mesh_model *model,
struct bt_mesh_msg_ctx *ctx,
struct net_buf_simple *msg,
const struct bt_mesh_send_cb *cb, void *cb_data)
bt_mesh_model_publish() is (like the name suggests) for model
publication. bt_mesh_model_send() is for everything else that falls
outside of that use case. This could be e.g. a server model's response
messages or a client model's request messages.

All of them are for access message sending, but I'm curious that is it
okay that use bt_mesh_model_publish() function in
./samples/bluetooth/mesh_demo? The reason I asked is that mesh_demo is
self-provisioning example, so there is no phase for model
configuration.
mesh_demo could use model publication, however it's the way it is
currently for the sake of simplicity, i.e. it uses bt_mesh_model_send().
The main purpose of this app is for demonstrating mesh "in action" with
real devices, rather than serving as a good example for how to write a
mesh application.

Johan