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

editing light-switch server struct

Hi, I am using Mesh SDK 4.0.0 and have couple of nRF52840 dev kits.


1) In light switch server example of Mesh SDK, is it possible to add more on_off data types to the server state?
I want to check with you whether the server can hold 4 different on_off states and few integers too. My application reads 4 input pins and I want to broadcast its status in BLE mesh.

2) I see a lot of on_off_state structures in the sdk. Can you tell me where (in which file) is the base server structure of the OnOff model?

3) I plan to edit that base structure and then all the structures and function arguments as necessary to have the set and get callbacks in main.c to work correctly. Does this sound like a graceful way to implement my point#1 ?
Please advise. Thank you

Parents
  • Hi,

    1) Yes, you can add Generic OnOff server models. The light switch examples uses only one Generic OnOff model on the server side (to mimic individual light bulbs), but the client side (representing switches) uses four client models. In the same manner you can have a device with four server models. If you use the Generic OnOff models, you will see that the server uses generic_onoff_server_init() which corresponds to generic_onoff_client_init() for the client.

    2) You find Generic OnOff model documentation on Infocenter. The implementation is under <SDK root folder>/models/model_spec/generic_onoff/, but note that you should not modify our implementation of SIG specified models.

    3) You should be able to implement what you need by adding four instances of the Generic OnOff server model and add/modify callbacks as appropriate, yes.

    Regards,
    Terje

Reply
  • Hi,

    1) Yes, you can add Generic OnOff server models. The light switch examples uses only one Generic OnOff model on the server side (to mimic individual light bulbs), but the client side (representing switches) uses four client models. In the same manner you can have a device with four server models. If you use the Generic OnOff models, you will see that the server uses generic_onoff_server_init() which corresponds to generic_onoff_client_init() for the client.

    2) You find Generic OnOff model documentation on Infocenter. The implementation is under <SDK root folder>/models/model_spec/generic_onoff/, but note that you should not modify our implementation of SIG specified models.

    3) You should be able to implement what you need by adding four instances of the Generic OnOff server model and add/modify callbacks as appropriate, yes.

    Regards,
    Terje

Children
  • Thanks Terje. I will try making 4 server models for 4 bool type data. I have some follow-up questions.

    1) Which server model/struct do I edit to have integer data type in the server? Any other suggestion to implement integer data server?
    2) Unrelated question- In Mesh beaconing example, I see that devices send their beacon (device name) in advertisement packets. I didn't see any "mesh" feature in the example. I assume we should add server/client models to the example code and use beaconing simultaneously. Is that the purpose of that mesh example?

    -Kunal

Related