Main Content

configureConnection

Configure LL connection between Bluetooth LE Central and Peripheral nodes

    Description

    example

    cfgBluetoothLEConnection = configureConnection(cfgBluetoothLEConnection,centralNode,peripheralNode) configures the link layer (LL) connection between the Bluetooth® low energy (LE) Central node centralNode and Peripheral node peripheralNode by using the Bluetooth LE LL connection configuration object cfgBluetoothLEConnection.

    Examples

    collapse all

    Create a Bluetooth LE node, specifying the role as "central".

    centralNode = bluetoothLENode("central");

    Create two Bluetooth LE nodes, specifying the role as "peripheral".

    peripheralNode1 = bluetoothLENode("peripheral");
    peripheralNode2 = bluetoothLENode("peripheral");

    Create a default Bluetooth LE configuration object to share connection between the Central and Peripheral nodes.

    connectionConfig = bluetoothLEConnectionConfig
    connectionConfig = 
      bluetoothLEConnectionConfig with properties:
    
        ConnectionInterval: 0.0200
             AccessAddress: "5DA44270"
              UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... ]
                 Algorithm: 1
              HopIncrement: 5
         CRCInitialization: "012345"
        SupervisionTimeout: 1
                   PHYMode: "LE1M"
             InstantOffset: 6
          ConnectionOffset: 0
              ActivePeriod: 0.0200
    
    

    Specify the connection interval, connection offset, and active period for the LL connection.

    connectionConfig.ConnectionInterval = 0.04; % In seconds
    connectionConfig.ConnectionOffset = 0;      % In seconds
    connectionConfig.ActivePeriod = 0.02;       % In seconds

    Specify the unique connection address for the LL connection.

    connectionConfig.AccessAddress = "5DA44271"
    connectionConfig = 
      bluetoothLEConnectionConfig with properties:
    
        ConnectionInterval: 0.0400
             AccessAddress: "5DA44271"
              UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... ]
                 Algorithm: 1
              HopIncrement: 5
         CRCInitialization: "012345"
        SupervisionTimeout: 1
                   PHYMode: "LE1M"
             InstantOffset: 6
          ConnectionOffset: 0
              ActivePeriod: 0.0200
    
    

    Configure the LL connection between the Central node and Peripheral node 1.

    configureConnection(connectionConfig,centralNode,peripheralNode1);

    Update the LL connection configuration object to share connection parameters between the Central node and Peripheral node 2.

    connectionConfig.ConnectionOffset = 0.02;   % In seconds
    connectionConfig.ActivePeriod = 0.02;       % In seconds
    connectionConfig.AccessAddress = "5DA44272"
    connectionConfig = 
      bluetoothLEConnectionConfig with properties:
    
        ConnectionInterval: 0.0400
             AccessAddress: "5DA44272"
              UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 ... ]
                 Algorithm: 1
              HopIncrement: 5
         CRCInitialization: "012345"
        SupervisionTimeout: 1
                   PHYMode: "LE1M"
             InstantOffset: 6
          ConnectionOffset: 0.0200
              ActivePeriod: 0.0200
    
    

    Configure the LL connection between the Central node and Peripheral node 2.

    configureConnection(connectionConfig,centralNode,peripheralNode2);

    Input Arguments

    collapse all

    Bluetooth LE connection configuration object, specified as a bluetoothLEConnectionConfig object.

    Bluetooth LE node object for the Central node, specified as a bluetoothLENode object with the Role property set to "central".

    Bluetooth LE node object for the Peripheral node, specified as a bluetoothLENode object with the Role property set to "peripheral".

    Output Arguments

    collapse all

    Bluetooth LE connection configuration object, returned as a bluetoothLEConnectionConfig 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/.

    Version History

    Introduced in R2022a