Accessing mesh relay data from the application layer in Zephyr

Is there a way to access the data that comes into a provisioned node and is relayed on the mesh network, from the application layer in Zephyr?

I have a battery models erver and  I set it up for publishing to a certain address

On another device I subscribed to that address and in the RTT log I  see the data coming in and being relayed by the mesh stack but don't see a way to access it from my application.

There are callbacks in mesh model definitions , i.e BT_MESH_MODEL_CB and BT_MESH_MODEL_VND_CB  that use  bt_mesh_model_cb but it does not have any functions to examine the incoming data. What's the proper way to do this under Zephyr?
Thanks

Parents
  • The former. The model that the message is addressed to, in this case a battery server model. It is configured to publish to a group address. My expectation is  that if  node A  battery model is configured to publish to an address 123 and node B battery model is subscribed to receive messages from address 123, node B should receive a message from node A when it publishes it  If that understanding is correct, how can this message be examined at the application layer? Is  there an opcode handler that I need to implement? Sorry I'm still a newbie in mesh..Thank you

  • Hi,

    No worries.

    AndyM said:
    My expectation is  that if  node A  battery model is configured to publish to an address 123 and node B battery model is subscribed to receive messages from address 123, node B should receive a message from node A when it publishes it 

    This is correct, given that:

    • The models are of correct types for the message (e.g. a battery server model publishing a Generic Battery Status message, and a battery client model receiving it.)
    • Both models are bound to the same application key (through configuration)
    AndyM said:
    how can this message be examined at the application layer? Is  there an opcode handler that I need to implement?

    Please have a look at the API documentation for the Generic Battery Server and the Generic Battery Client libraries. For the server model, the state (i.e. the battery state) is kept in memory controlled by the application layer. For the client side, the call to bt_mesh_battery_cli_get() will either block (filling the provided memory with the response before it returns) or it will call a callback function (if said memory pointer is NULL).

    Regards,
    Terje

Reply
  • Hi,

    No worries.

    AndyM said:
    My expectation is  that if  node A  battery model is configured to publish to an address 123 and node B battery model is subscribed to receive messages from address 123, node B should receive a message from node A when it publishes it 

    This is correct, given that:

    • The models are of correct types for the message (e.g. a battery server model publishing a Generic Battery Status message, and a battery client model receiving it.)
    • Both models are bound to the same application key (through configuration)
    AndyM said:
    how can this message be examined at the application layer? Is  there an opcode handler that I need to implement?

    Please have a look at the API documentation for the Generic Battery Server and the Generic Battery Client libraries. For the server model, the state (i.e. the battery state) is kept in memory controlled by the application layer. For the client side, the call to bt_mesh_battery_cli_get() will either block (filling the provided memory with the response before it returns) or it will call a callback function (if said memory pointer is NULL).

    Regards,
    Terje

Children
No Data
Related