Turn off relay mode / friend mode in runtime?

Hello, 

I have a project with a node that on battery is an LPN node and on USB power the node is a relay & friend node.

As a result, I will need to switch between them in run-time, how would I go about this?

I am able to set LPN state using

bt_mesh_lpn_set(state);

How would I go about disabling friend/relay?

Note: without the config server. The goal is to change it from the ISR detect of USB power.

SDK: 2.6

nRF52832

  • Hi,

    bt_mesh_lpn_set() and bt_mesh_friend_set() are the correct ways to change the LPN and Friend features at runtime. When the LPN state is enabled, the node will send a friend request (granted it is provisioned) with possible criterias for determining which friend node it may choose. Capable friend nodes in range will respond with a friend offer, and the LPN will attempt to poll the friend once friendship is established. If no friendships were established, the LPN node will retry sending a friend request after a specified time

    When the LPN feature is disabled, all friendships will be cleared. Similarly, disabling the friend feature terminates any active friendships.

    For relays, enabling CONFIG_BT_MESH_RELAY_ENABLED causes the relay feature to be enabled on (re)boot. You can freely change the state of the relay feature and retransmit parameters during runtime using bt_mesh_relay_set(). (You can do this independent of whether it is enabled by default)

    Regards,

  •  Perfect explanation, quick response too!, I will add this into my project and let you know if I have further questions 

Related