Main Content

configureConnection

Configure LL connection between Bluetooth LE Central and Peripheral nodes

Since R2022a

    Description

    example

    (cfgUpdatedLEConnection,cfgUpdatedCIS) = configureConnection(cfgLEConnection,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 cfgLEConnection. The function outputs the updated LL connection configuration, cfgUpdatedLEConnection and the updated connected isochronous stream (CIS) configuration, cfgUpdatedCIS. In this syntax, the value of cfgUpdatedCIS output is [].

    (cfgUpdatedLEConnection,cfgUpdatedCIS) = configureConnection(cfgLEConnection,centralNode,peripheralNode,CfgCIS=cfgCIS) additionally configures the CIS connection between a Central and a Peripheral nodes by sharing the same asynchronous connection-oriented (ACL) and CIS logical transport connection configuration between the two nodes.

    Examples

    collapse all

    Check if the Communications Toolbox™ Wireless Network Simulation Library support package is installed. If the support package is not installed, MATLAB® returns an error with a link to download and install the support package.

    wirelessnetworkSupportPackageCheck;

    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 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
                 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, in seconds.

    connectionConfig.ConnectionInterval = 0.04;
    connectionConfig.ConnectionOffset = 0;
    connectionConfig.ActivePeriod = 0.02;

    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 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
                 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 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36]
                 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".

    Bluetooth LE CIS configuration object, specified as a bluetoothLECISConfig object or an array of objects of type bluetoothLECISConfig. If you specify this input, the object function establishes a CIS connection between the Central and Peripheral nodes. To configure multiple CIS connections, set this input as an array of objects of type bluetoothLECISConfig. Note that you can configure a maximum of 31 CIS connections.

    Output Arguments

    collapse all

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

    Bluetooth LE CIS configuration object, specified as a bluetoothLECISConfig 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