Main Content

bluetoothLEConnectionConfig

Bluetooth LE LL connection configuration parameters

Since R2022a

    Description

    Use bluetoothLEConnectionConfig object to set the link layer (LL) connection configuration parameters at a Bluetooth® low energy (LE) Central or Peripheral node.

    Creation

    Description

    cfgConnection = bluetoothLEConnectionConfig creates a default Bluetooth LE connection configuration object that shares the LL connection configuration parameters between a Central node and a Peripheral node.

    example

    cfgConnection = bluetoothLEConnectionConfig(Name=Value) sets properties by using one or more name-value arguments. For example, ConnectionInterval=0.04 sets the connection interval to 0.04 seconds.

    Properties

    expand all

    LL connection interval, specified as a scalar in the range [0.0075, 4]. Specify this value in seconds. This property specifies the interval between the start of two consecutive LL connection events. Set this value as an integer multiple of 1.25 milliseconds. If the LL connection includes connected isochronous stream (CIS) events, set this property as a multiple of (NumPeripherals × 1.25), where NumPeripherals specifies the total number of Peripheral nodes simulated in the network. For more information about the connection interval, see Volume 6, Part B, Section 4.5.1 of Bluetooth Core Specification v5.3 [2].

    Data Types: double

    Unique connection address, specified as an 8-element character vector or a string scalar denoting a 4-octet hexadecimal value. This property specifies a unique 32-bit access address for the LL connection between a Central node and a Peripheral node.

    Data Types: char | string

    List of used data channels, specified as an integer vector with element values in the range [0, 36]. This value specifies the indices of the assigned data channels. This property indicates the set of good channels used by the connection. To ensure that at least two channels are set as used (good) channels, specify a vector length greater than 1.

    Data Types: double

    Algorithm, specified as 1 or 2 representing "Algorithm #1" or "Algorithm #2", respectively. This property specifies the channel selection algorithm for LL connection events.

    Data Types: double

    Hop increment count, specified as an integer in the range [5, 16]. This property specifies the number of hops between data channels. If you set the Algorithm property to 1, the object uses this value as an input.

    Data Types: double

    CRC initialization, specified as a 6-element character vector or a string scalar denoting a 3-octet hexadecimal value.

    Data Types: char | string

    LL connection supervision timeout, specified as a scalar in the range [0.1, 32]. Specify this value in seconds. This property specifies the timeout for a LL connection if no valid packet is received within this time. Set this value as a multiple of 10 milliseconds.

    Data Types: double

    PHY mode for generating or decoding, specified as "LE1M", "LE2M", "LE125K", or "LE500K".

    Data Types: char | string

    Offset added to the connection event counter, specified as an integer in the range [6, 65535]. Specify this value in seconds. The object updates the channel map after InstantOffset connection events from the current connection event.

    Data Types: double

    Offset for starting connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value in seconds. Within a connection interval, after the connection offset, communication begins between the Central and Peripheral node.

    If the connection between a Central and a Peripheral node includes CIS events, specify this property as (ConnectionOffsetOld+(ConnectionIntervalNumPeripherals)). For the first connection, the ConnectionOffsetOld value is 0. For the subsequent connections, the ConnectionOffsetOld value specifies the previous connection. The NumPeripherals value specifies the total number of Peripheral nodes simulated in the network.

    Data Types: double

    Active communication period in each connection event, specified as a scalar in the range [0, ConnectionInterval]. Specify this value in seconds. This value specifies the start of communication between the Central and Peripheral nodes within a connection interval. The value must be sufficient to accommodate at least one data or control protocol data unit (PDU) transmission from the Central to the Peripheral and a corresponding response from the Peripheral to the Central within a single connection event. Additionally, set this value to include the entire data communication time between the Central and the Peripheral within the same connection event. Otherwise, the data communication occurs in the subsequent connection event.

    Data Types: double

    Object Functions

    expand all

    configureConnectionConfigure LL connection between Bluetooth LE Central and Peripheral 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);

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 16, 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