Main Content

updateChannelList

Provide updated channel list to Bluetooth LE node

Since R2022a

    Download Required: To use updateChannelList, first download the Communications Toolbox Wireless Network Simulation Library add-on. For more information, see Get and Manage Add-Ons.

    Description

    status = updateChannelList(bluetoothLENodeObj,newUsedChannelsList) updates the channel map by providing a new list of used channels, newUsedChannelsList, to the Bluetooth® low energy (LE) node specified by the bluetoothLENodeObj object. The bluetoothLENodeObj must be configured as "Central". The object function returns the status, status, indicating whether the node accepted the new channel list. To use this syntax, set the Role property of bluetoothLENode to "isochronous-broadcaster" or "broadcaster".

    status = updateChannelList(bluetoothLENodeObj,newUsedChannelsList,DestinationNode=destinationNode) additionally specifies the destination node, DestinationNode, to which this object function provides a new list of used channels. To use this syntax, set the Role property of the bluetoothLENode object to "central" and the Role property of the destination node to "peripheral".

    example

    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 wireless network simulator object.

    networkSimulator = wirelessNetworkSimulator.init();

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

    centralNode = bluetoothLENode("central");
    centralNode.Position = [0 0 0]                  % In x-, y-, z-direction, in meters
    centralNode = 
      bluetoothLENode with properties:
    
            TransmitterPower: 20
             TransmitterGain: 0
               ReceiverRange: 100
                ReceiverGain: 0
         ReceiverSensitivity: -100
                 NoiseFigure: 0
        InterferenceModeling: "overlapping-adjacent-channel"
        InterferenceFidelity: 0
                        Name: "Node1"
                    Position: [0 0 0]
    
       Read-only properties:
                        Role: "central"
            ConnectionConfig: [1x1 bluetoothLEConnectionConfig]
                   CISConfig: [1x1 bluetoothLECISConfig]
             PeripheralCount: 0
              TransmitBuffer: [1x1 struct]
                          ID: 1
    
    

    Create a Bluetooth LE node, specifying the role as "peripheral". Specify the position of the node.

    peripheralNode = bluetoothLENode("peripheral");
    peripheralNode.Position = [10 0 0]              % In x-, y-, z-direction, in meters
    peripheralNode = 
      bluetoothLENode with properties:
    
            TransmitterPower: 20
             TransmitterGain: 0
               ReceiverRange: 100
                ReceiverGain: 0
         ReceiverSensitivity: -100
                 NoiseFigure: 0
        InterferenceModeling: "overlapping-adjacent-channel"
        InterferenceFidelity: 0
                        Name: "Node2"
                    Position: [10 0 0]
    
       Read-only properties:
                        Role: "peripheral"
            ConnectionConfig: [1x1 bluetoothLEConnectionConfig]
                   CISConfig: [1x1 bluetoothLECISConfig]
              TransmitBuffer: [1x1 struct]
                          ID: 2
    
    

    Create a Bluetooth LE configuration object, specifying the connection interval and active period for the connection.

    cfgConnection = bluetoothLEConnectionConfig (...
        ConnectionInterval=0.02, ...                  % In seconds
        ActivePeriod=0.02, ...                        % In seconds
        ConnectionOffset=0);                          % In seconds

    Configure the link layer (LL) connection between the Central and Peripheral nodes.

    connection = configureConnection(cfgConnection,centralNode,peripheralNode);

    Create a networkTrafficOnOff object to generate an On-Off application traffic pattern. Specify the data rate in kb/s and the packet size in bytes. Enable packet generation to generate an application packet with a payload. Add application traffic from the Central to the Peripheral node by using the addTrafficSource object function.

    traffic = networkTrafficOnOff(DataRate=500, ...
        PacketSize=10, ...
        GeneratePacket=true);
    addTrafficSource(centralNode,traffic,"DestinationNode",peripheralNode.Name);

    Schedule channel list update at the Central node at 0.05 seconds to use channels 0 to 10.

    scheduleAction(networkSimulator,@(varargin) updateChannelList(centralNode, ...
        0:10,DestinationNode=peripheralNode),[],0.05);

    Create a Bluetooth LE network consisting of a Central node, a Peripheral node, and a WLAN node.

    nodes = {centralNode peripheralNode};

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

    addNodes(networkSimulator,nodes)

    Set the simulation time and run the simulation.

    simulationTime = 0.3;                 % In seconds
    run(networkSimulator,simulationTime);

    Retrieve application, link layer (LL) , and physical layer (PHY) statistics corresponding to the Central and Peripheral nodes by using the statistics object function. For more information about the statistics, see Bluetooth LE Node Statistics.

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

    Input Arguments

    collapse all

    Bluetooth LE node object, specified as a bluetoothLENode object.

    List of good channels, specified as an integer vector with element values in the range [0, 36]. This input specifies the new list of used channels to update the channel map for the specified Bluetooth LE node. To ensure that at least two channels are set as used (good) channels, specify a vector length greater than 1.

    Name of destination node, specified as a character vector or string scalar or input as an object of type bluetoothLENode with role as "Peripheral". If you set the Role property of the bluetoothLENodeObj object to "central" or "peripheral", this input is mandatory. This input specifies the Name property of the specified Bluetooth LE node object, bluetoothLENodeObj, for sending data to the specified destination node.

    Data Types: char | string

    Output Arguments

    collapse all

    Flag indicating whether LL of the specified Bluetooth LE node bluetoothLENodeObj accepts the new channel list, returned as 0 (false) or 1 (true).

    Data Types: logical

    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". v5.3. https://www.bluetooth.com/.

    Version History

    Introduced in R2022a