nrf52840 ble mesh: Toggle function for generic ONOFF SERVER

Hello,

Is there the possibility for a node with a Generic OnOff Client (BUTTON) to send a unique toggle command to a Generic OnOff Server (LED), instead to use 'bt_mesh_onoff_cli_set_unack' function and build a toggle logic changing the set value every time I push the button?

It could be an important feature in a system where there are for example two clients (BUTTON1 and BUTTON2) that command a single server (LED0).

When I press a button (it does not matter which) I want that LED0 goes ON, the when I press a button again (it does not matter which) I want that LED0 goes OFF and so on.

But if I use 'bt_mesh_onoff_cli_set_unack' function for BUTTON1 and BUTTON2 here is what happens:

Press BUTTON1 --> LED0 ON

Press BUTTON2 --> LED0 ON!! (I wanted LED0 OFF)

Press BUTTON1 --> LED0 OFF

Press BUTTON2--> LED0 OFF!! (I wanted LED0 ON)

and so on

Best regards

Parents
  • Hello,

    There is no toggle functionality in the Mesh Model specification, so this functionality needs to be implemented in the application.

    But if I use 'bt_mesh_onoff_cli_set_unack' function for BUTTON1 and BUTTON2 here is what happens:

    Press BUTTON1 --> LED0 ON

    Press BUTTON2 --> LED0 ON!! (I wanted LED0 OFF)

    Press BUTTON1 --> LED0 OFF

    Press BUTTON2--> LED0 OFF!! (I wanted LED0 ON)

    It looks like the application is not aware of the LED0 state. On each button press; get the LED0 OnOff state and use the inverted value to set it. There should also be more ways to solve this.

    Best regards,

    Maria

Reply
  • Hello,

    There is no toggle functionality in the Mesh Model specification, so this functionality needs to be implemented in the application.

    But if I use 'bt_mesh_onoff_cli_set_unack' function for BUTTON1 and BUTTON2 here is what happens:

    Press BUTTON1 --> LED0 ON

    Press BUTTON2 --> LED0 ON!! (I wanted LED0 OFF)

    Press BUTTON1 --> LED0 OFF

    Press BUTTON2--> LED0 OFF!! (I wanted LED0 ON)

    It looks like the application is not aware of the LED0 state. On each button press; get the LED0 OnOff state and use the inverted value to set it. There should also be more ways to solve this.

    Best regards,

    Maria

Children
Related