Re: About publish & subscribe mechanism in Bluetooth Mesh

Johan Hedberg

Hi Vikrant,

On Mon, Nov 27, 2017, Vikrant More wrote:
How to send simple one byte of data from one node to another node which are
provisioned using meshctl using unicast addresses ?
Mesh application payloads always start with a model-specific OpCode,
which is 1-3 bytes long. So if you want to send valid data you'd need to
do that in the context of a model, and in that case you'd use the
bt_mesh_model_publish() or bt_mesh_model_send() APIs.

If you want to discard the access layer formatting (i.e. OpCode +
payload) and send arbitrary "raw" application payloads, you could use
the "net-send" command that the mesh_shell app provides, however note
that this is purely for testing purposes and can't be used for building
final products.

For subscribing you don't need anything >>special, except that a
provisioner configures one or more >>subscription addresses to your
How to achieve this using available meshctl commands ?
I'm not really familiar with meshctl, but looking at its source code it
seems to at least provide a "set-pub" command under the "config" submenu.
I don't see anything related to subscription there however. For testing
purposes you could also again use the Zephyr mesh_shell app since it can
send messages to itself. The shell provides "mod-pub" and "mod-sub-add"
commands for this.

Btw, if you want more help with meshctl, I recommend reaching out on
the BlueZ forums, i.e. the #bluez IRC channel on freenode and the
linux-bluetooth mailing list.


Join to automatically receive all group messages.