This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Regarding BLE Mesh Model Publish & Subscribe

Hello Developers,

  I have just started playing around with BLE Mesh Zephyr examples on my recently purchased nRF52840-PDK board.

Anyways, I am bit stuck with one fundamental concept of Publish & Subscribe. Any insight to this will be highly appreciable!

I have following two questions..

Question #1)  I want to understand basic difference between sending a message & publishing a message in BLE Mesh context. Let me explain what I mean, with a  very basic example of OnOff Light.

I understand, there would be Generic OnOff client model which will  *SEND* some message (Get/Set) about light state(ON or OFF) to a remote node, which has Generic OnOff Server Model. In case of  Set, after Server state is toggled,  Server *SEND* an unacknowledged status message reporting its current state and other information.

I am confused, whether this *SEND*  thing is equal to *PUBLISH* or it is different? Is *SENDING* a message is same as *PUBLISHING* a message? If it is different, please help me understand how?

Question#2) In Mesh Profile specification, I have noticed that, both Generic OnOff Client & Server Model support both Publish & Subscribe both.

I am unable to understand, in which case, Generic OnOff client would need Subscription & in which case Generic OnOff Server would need Publication?

Normally, it is easy & natural for me to think, *client support publish* & *server support subscribe*. May be I am missing some use cases!

Looking for some quick reply, so that I can proceed with my node configurations more meaningfully! Thank You very much!

BR,

Parents
  • Hi.

    1) Yes, you are correct. Publishing in Mesh is the same as sending a message. BT Mesh isn't connection based, but based on the nodes broadcasting their message to every other node in range, i.e they are publishing their message.

    2) If the client should subscribe to any address depends on the usecase. If the client wants to, i.e receive status message from the server, it needs to subscribe to the address the server is publishing to.

    Best regards,
    Joakim

  • Hi Joakim,

     Thanks for your reply. Ok, i got that sending and publishing are same in terms of ADV bearer.

    Then i have another question..as follows..

    Suppose, If config server sets a publication period while configuring a simple Generic OnOff client, then *sending* or *publishing* a   "Get" or a "Set" light state message also needs to follow the publish period?  Meaning an OnOff client application need to continously send or publish the Get/Set message to the publish address?

    I could not find any such guideline in spec. Profile spec just says, publish period in publication set is used for publishing message. So will that mean, every publish message need to follow it?

    BR,

  • Hi.

    Not sure if I understand the question. If you are using periodic publication your device will publish the message at the defined intervals, yes.

    There is no requirement to use periodic publication. You can also send messages on user interaction etc.

    Best regards,
    Joakim

  • >>Not sure if I understand the question. If you are using periodic publication your device will publish the message at the defined intervals, yes.

    What I mean is, *if* periodic publication is set in Generic OnOff client, does it become mandatory to follow periodic publishing when sending *Get* / *Set* messages?

    I believe, periodic publishing will not happen automatically  by the device. It is application's responsibility to do periodic publishing. Please correct me if I am wrong!

    BR,

  • Ah. No you can still send messages on, i.e user interaction.
    Periodic publish will be handled by the application, yes. This will not happen automatically in every mesh node. You will need to enable this feature yourself.

    Best regards,
    Joakim

  • Hi Joakim,

     Thanks for the clarification. One last question based on the below example.

    Example:

    1. Generic OnOffclient sets light state ON to OFF to the Generic OnOff Server.

    2. Generic OnOff Server sends Unicast status to Generic OnOff client.

    3. Generic OnOffServer publishes unsolicited *status* to the publish address

    In step#3, If the publication is set in the Generic OnOffServer,

    - Does it become mandatory to publish the unsolicited *status* messages by the server?

    - Does it become mandatory to publish the unsolicted *status* messages periodically as per publication period? 

  • I'm not really sure if I understand the question here.

    If you have configured periodic publishing, it should publish the message at the given, defined period.
    I want to emphasise that you don't have to use periodic publication if you only want to send messages on, i.e user interaction.

    Br,
    Joakim

Reply Children
No Data
Related