Periodic publishing #bluetoothmesh #nrf52


paul.leguennec@...
 

Hello,

I have been trying to use the periodic publishing in mesh, but I don't really see how to use it correctly. I have read the Mesh Specification, and I already asked here for help on publishing, and somebody gave me an hint by telling me to use the BT_MESH_MODEL_PUB_DEFINE macro with an update callback, but I don't think I am doing this correctly.
Right now I have my callback :
/*Attempt of callback that would allow periodic publishing*/
static int vendor_cb_update(struct bt_mesh_model *model)
{
    struct net_buf_simple *msg = model->pub->msg;
    /*Build message for VND Model CB*/
    bt_mesh_model_msg_init(msg,BT_MESH_MODEL_OP_3(0x08,CID_ZEPHYR)); // init of the status msg handler
    return 0;
}

and I am using the macro like this :
BT_MESH_MODEL_PUB_DEFINE(vnd_pub,vendor_cb_update,3+3);

I have been able to publish a message by pushing a button, and I would like to use only periodic publishing for my project.
Does somebody already used periodic publishing and would be able to tell me what I am doing wrong ?

Many thanks,
Paul

Join devel@lists.zephyrproject.org to automatically receive all group messages.