Main Content

bluetoothConnectionConfig

Bluetooth BR/EDR connection configuration parameters

Since R2022b

    Description

    Use the bluetoothConnectionConfig object to set the baseband connection configuration parameters for a Bluetooth® basic rate/enhanced data rate (BR/EDR) Central and Peripheral node pair.

    Creation

    Description

    example

    cfgConnection = bluetoothConnectionConfig creates a default Bluetooth BR/EDR connection configuration object that shares the baseband connection configuration parameters between a Central and a Peripheral node.

    cfgConnection = bluetoothConnectionConfig(Name=Value) sets properties by using one or more name-value arguments. For example, HoppingSequenceType="Connection adaptive" sets the frequency hopping sequence type to "Connection adaptive".

    Properties

    expand all

    Packet type used over the asynchronous connection-oriented logical (ACL) logical transport from Central to Peripheral node, specified as "DH1", "DM1", "DM3", "DH3", "DM5", "DH5", "2-DH1", "2-DH3", "2-DH5", "3-DH1", "3-DH3", or "3-DH5".

    Data Types: char | string

    Packet type used over ACL logical transport from Peripheral to Central node, specified as "DH1", "DM1", "DM3", "DH3", "DM5", "DH5", "2-DH1", "2-DH3", "2-DH5", "3-DH1", "3-DH3", or "3-DH5".

    Data Types: char | string

    Packet type transmitted and received over the synchronous connection-oriented (SCO) logical transport, specified as "None", "HV1", "HV2", or "HV3". If you set this property to "None", the object disables the SCO link, and no voice transmission occurs between the Bluetooth BR/EDR nodes. If you set this property to "HV1", "HV2", or "HV3", the object enables the synchronous link. Based on the configured SCO packet type, the Bluetooth BR/EDR node internally generates voice traffic with a data rate of 64 Kbps. To send "DV" packets over the SCO link, perform these steps.

    1. Set this property to "HV1".

    2. Attach an ACL traffic source for the data payload with a packet size in the range of [1, 9] bytes.

    The object supports one SCO link in a physical link and up to three SCO links at the Central node.

    Data Types: char | string

    Frequency hopping sequence type, specified as "Connection basic" or "Connection adaptive".

    Data Types: char | string

    List of used (good) data channels for the Bluetooth BR/EDR physical link to use, specified as a vector of integers in the range [0, 78]. This value specifies the indices of the assigned data channels. To ensure that at least 20 channels are set as used (good) channels, specify this vector with unique values and a length greater than or equal to 20.

    Dependencies

    To enable this property, set the HoppingSequenceType property to "Connection adaptive".

    Data Types: double

    Maximum interval between two successive poll requests, specified as an integer in the range [6, 4096]. Set this value in number of slots. For more information about this property, see the Bluetooth Core Specification [2], Volume 2, Part C, Section 5.4.

    Data Types: double

    Slots after which the new channel map is enforced, specified as an integer in the range [96, 69120000]. The object adds this value to the current clock and updates the channel map. Units are in slots. This value must be at least PollInterval slots or 96 slots, whichever is greater.

    Dependencies

    To enable this property, set the HoppingSequenceType property to "Connection adaptive".

    Data Types: double

    Packet transmission power, specified as a scalar in the range [–20, 20]. The transmitter applies this value on the packet before sending it to the antenna. Units are in dBm.

    Data Types: double

    Connection supervision timeout, specified as a scalar in the range [400, 65535] or Inf. Units are in slots.

    • If the Bluetooth BR/EDR node does not receive a valid packet within the time set by this value, the object times out the connection. After the timeout, the logical link is disconnected at the baseband layer and no connection exists between the nodes.

    • If you set this value to Inf, the connection is always active.

    Data Types: double

    This property is read-only.

    Bluetooth BR/EDR Central node address, stored as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This property sets a unique address for the Bluetooth BR/EDR Central node.

    Data Types: char | string

    This property is read-only.

    Primary logical transport address, stored as a positive integer scalar.

    Data Types: double

    Note

    The physical layer (PHY) transmission mode of the packets specified by the CentralToPeripheralACLPacketType and PeripheralToCentralACLPacketType properties must be the same.

    Object Functions

    expand all

    configureConnectionConfigure connection between Bluetooth BR/EDR 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;

    Initialize the wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create two Bluetooth BR nodes, one with the "central" role and the other with the "peripheral" role. Specify the position of the Peripheral node, in meters.

    centralNode = bluetoothNode("central");
    peripheralNode = bluetoothNode("peripheral",Position=[1 0 0]);

    Add a random waypoint mobility model to the peripheral node. Set the shape of the node's mobility area to "circle".

    addMobility(peripheralNode,BoundaryShape="circle")

    Create a default Bluetooth BR/EDR connection configuration object to configure and share a connection between the Bluetooth BR Central and Peripheral nodes.

    cfgConnection = bluetoothConnectionConfig;

    Configure the connection between the Central and the Peripheral nodes.

    connection = configureConnection(cfgConnection,centralNode,peripheralNode)
    connection = 
      bluetoothConnectionConfig with properties:
    
        CentralToPeripheralACLPacketType: "DH1"
        PeripheralToCentralACLPacketType: "DH1"
                           SCOPacketType: "None"
                     HoppingSequenceType: "Connection adaptive"
                            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 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 ... ] (1x79 double)
                            PollInterval: 40
                           InstantOffset: 240
                        TransmitterPower: 20
                      SupervisionTimeout: 32000
                          CentralAddress: "D091BBE70001"
                        PrimaryLTAddress: 1
    
    

    Create and configure a networkTrafficOnOff object to generate an On-Off application traffic pattern.

    traffic = networkTrafficOnOff(DataRate=200,PacketSize=27, ...
        GeneratePacket=true,OnTime=inf);

    Add application traffic from the Central to the Peripheral node.

    addTrafficSource(centralNode,traffic,DestinationNode=peripheralNode);

    Add the Central and Peripheral nodes to the wireless network simulator.

    addNodes(networkSimulator,[centralNode peripheralNode]);

    Specify the simulation time, in seconds.

    simulationTime = 0.3;

    Run the simulation for the specified simulation time.

    run(networkSimulator,simulationTime);

    Retrieve the application, baseband, and physical layer (PHY) statistics corresponding to the Central and Peripheral nodes.

    centralStats = statistics(centralNode)
    centralStats = struct with fields:
            Name: "Node1"
              ID: 1
             App: [1x1 struct]
        Baseband: [1x1 struct]
             PHY: [1x1 struct]
    
    
    peripheralStats = statistics(peripheralNode)
    peripheralStats = struct with fields:
            Name: "Node2"
              ID: 2
             App: [1x1 struct]
        Baseband: [1x1 struct]
             PHY: [1x1 struct]
    
    

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed May 22, 2022. https://www.bluetooth.com/.

    [2] Bluetooth Core Specifications Working Group. "Bluetooth Core Specification" v5.3. https://www.bluetooth.com/.

    Version History

    Introduced in R2022b