Main Content

configureFriendship

Configure friendship between Friend node and LPN

    Description

    example

    cfgBluetoothMeshFriendship = configureFriendship(cfgBluetoothMeshFriendship,friendNode,lowPowerNode) establishes friendship between a Friend node, friendNode, and a low power node (LPN), lowPowerNode, by configuring the friendship parameters using the Bluetooth® mesh friendship configuration object, cfgBluetoothMeshFriendship. At the Friend node, friendship with multiple LPNs is not supported.

    Examples

    collapse all

    Create a Bluetooth mesh profile configuration object, specifying the element address and enabling the Friend feature of the Friend node.

    meshFriendshipCfg = bluetoothMeshProfileConfig(ElementAddress="000A",Friend=true)
    meshFriendshipCfg = 
      bluetoothMeshProfileConfig with properties:
    
                 ElementAddress: "000A"
                          Relay: 0
                         Friend: 1
                       LowPower: 0
           NetworkTransmissions: 1
        NetworkTransmitInterval: 0.0100
                            TTL: 127
    
    

    Create a Bluetooth mesh profile configuration object for an LPN, specifying the element address and enabling the low power feature of the LPN.

    meshLPNCfg = bluetoothMeshProfileConfig(ElementAddress="000F",LowPower=true)
    meshLPNCfg = 
      bluetoothMeshProfileConfig with properties:
    
                 ElementAddress: "000F"
                          Relay: 0
                         Friend: 0
                       LowPower: 1
           NetworkTransmissions: 1
        NetworkTransmitInterval: 0.0100
                            TTL: 127
    
    

    Create a Bluetooth mesh node with the friend feature enabled. Specify the role as "broadcaster-observer" and assign the mesh profile configuration.

    meshFriendNode = bluetoothLENode("broadcaster-observer",MeshConfig=meshFriendshipCfg);

    Create a Bluetooth mesh node with the low power feature enabled. Specify the role as "broadcaster-observer" and assign the mesh profile configuration.

    meshLPN = bluetoothLENode("broadcaster-observer",MeshConfig=meshLPNCfg);

    Create a default Bluetooth mesh friendship configuration object. Specify the poll timeout, receive window supported by the Friend node, and receive delay requested by the LPN.

    friendshipConfig = bluetoothMeshFriendshipConfig;
    friendshipConfig.PollTimeout = 3;                     % In seconds
    friendshipConfig.ReceiveWindow = 0.180;               % In seconds
    friendshipConfig.ReceiveDelay = 0.05                  % In seconds
    friendshipConfig = 
      bluetoothMeshFriendshipConfig with properties:
    
         ReceiveDelay: 0.0500
        ReceiveWindow: 0.1800
          PollTimeout: 3
    
    

    Configure friendship between the Friend node and LPN.

    configureFriendship(friendshipConfig,meshFriendNode,meshLPN);

    Input Arguments

    collapse all

    Bluetooth mesh friendship configuration object, specified as a bluetoothMeshFriendshipConfig object.

    Bluetooth LE node object for the broadcaster observer, specified as a bluetoothLENode object with the Role property set to "broadcaster-observer". You must also set the Friend property of the bluetoothMeshProfileConfig object to true and the MeshConfig property of the bluetoothLENode object to bluetoothMeshProfileConfig object.

    Bluetooth LE node object for the broadcaster observer, specified as a bluetoothLENode object with the Role property set to "broadcaster-observer". You must also set the LowPower property of the bluetoothMeshProfileConfig object to true and the MeshConfig property of the bluetoothLENode object to bluetoothMeshProfileConfig object.

    Output Arguments

    collapse all

    Bluetooth mesh friendship configuration object, returned as a bluetoothMeshFriendshipConfig object.

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 12, 2021. https://www.bluetooth.com/.

    [2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

    [3] Bluetooth Special Interest Group (SIG). "Bluetooth Mesh Profile". v1.0.1. https://www.bluetooth.com/.

    Version History

    Introduced in R2022a