Contenido principal

configurePeriodicAdv

R2026b

Configure Bluetooth LE periodic advertisements between Broadcaster and Observer

Since R2024a

    Description

    cfgPeriodicAdvUpdated = configurePeriodicAdv(cfgPeriodicAdv,broadcasterNode,observerNode) configures Bluetooth® low energy (LE) periodic advertisements (PA) between the Broadcaster, broadcasterNode, and the Observer, observerNode, by sharing the common PA synchronization configuration, cfgPeriodicAdv, between the nodes.

    example

    cfgPeriodicAdvUpdated = configurePeriodicAdv(cfgPeriodicAdv,broadcasterNode,observerNode,Name=Value) sets additional options using name-value arguments. For example, ResponseSlot=1 sets the value of the response slot number to 1. This syntax applies to periodic advertising train with responses (PAwR) mode.

    Note

    These notes outline considerations for the (PAwR):

    • When using scalar observer signature, you must specify both ReceiveSubevent and ResponseSlot name-value arguments.

    • When using vectorized observer signature (array of observers), the function applies default sequential assignments automatically. You must not specify ReceiveSubevent and ResponseSlot name-value arguments

    • The vectorized signature requires a 1-to-1 mapping (one observer per subevent per response slot), so you must at least as many subevents and response slots as you have observers.

    example

    Examples

    collapse all

    This example enables you to:

    1. Create and configure a Bluetooth LE piconet with Broadcaster and Observer nodes.

    2. Create and Configure a PAT between the Broadcaster and Observer nodes.

    3. Configure and add application traffic at the Broadcaster node.

    4. Simulate the Bluetooth LE piconet and retrieve the statistics of the Broadcaster and Observer nodes.

    Create a wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Create a Bluetooth LE node, specifying the role as "broadcaster". Specify the name and position of the node.

    broadcasterNode = bluetoothLENode("broadcaster",Name="Broadcaster");
    broadcasterNode.Position = [0 0 0];                % In x-, y-, and z-coordinates, in meters

    Create two Bluetooth LE nodes, specifying their roles as "observer". Specify the names and positions of the nodes.

    observerNode1 = bluetoothLENode("observer",Name="Observer1");
    observerNode1.Position = [5 5 0];                             % x-, y-, and z-coordinates, in meters
    observerNode2 = bluetoothLENode("observer",Name="Observer2"); 
    observerNode2.Position = [10 0 10];                           % x-, y-, and z-coordinates, in meters

    Create a PAT between the Broadcaster and Observer nodes by using the Bluetooth LE periodic advertisements configuration object.

    cfgPeriodicAdv = bluetoothLEPeriodicAdvConfig(PeriodicAdvInterval=60, ...
                                                      UsedChannels=10:30, ...
                                                      PHYMode="LE2M");

    Configure the PAT between the Broadcaster and Observer nodes.

    cfgPeriodicAdvUpdated = configurePeriodicAdv(cfgPeriodicAdv,broadcasterNode,[observerNode1 observerNode2])
    cfgPeriodicAdvUpdated = 
      bluetoothLEPeriodicAdvConfig with properties:
    
        PeriodicAdvInterval: 60
          PeriodicAdvOffset: 0
                    PHYMode: "LE2M"
               UsedChannels: [10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30]
            PeriodicAdvType: "PADVB"
              AccessAddress: 'D9DA7BEA'
    
    

    Create a networkTrafficOnOff (Wireless Network Toolbox) object to generate an On-Off application traffic pattern. Specify the data rate in kb/s and the packet size in bytes. Add application traffic at the Broadcaster node.

    traffic = networkTrafficOnOff(DataRate=1,PacketSize=15,OnTime=Inf,OffTime=0);
    addTrafficSource(broadcasterNode,traffic)

    Add the Broadcaster and Observer nodes to the wireless network simulator.

    addNodes(networkSimulator,[broadcasterNode observerNode1 observerNode2])

    Set the simulation time in seconds, and run the simulation.

    simulationTime = 600;
    run(networkSimulator,simulationTime)

    Retrieve statistics corresponding to the Broadcaster and Observer nodes. For more information about the statistics, see Bluetooth LE Node Statistics.

    broadcasterNodeStats = statistics(broadcasterNode);
    observerNode1Stats = statistics(observerNode1);
    observerNode2Stats = statistics(observerNode2);

    Input Arguments

    collapse all

    Common PA configuration, specified as a bluetoothLEPeriodicAdvConfig object.

    Broadcaster node, specified as a bluetoothLENode object or a vector of bluetoothLENode objects. For each object, the Role property value must be "broadcaster". If you specify this property as a vector:

    • The object function creates a periodic advertising train (PAT) at each specified Broadcaster and configures the specified Observer to listen for all the PATs.

    • The observerNode input must be a single bluetoothLENode object.

    Observer node, specified as a bluetoothLENode object or a vector of bluetoothLENode objects. For each object, the Role property value must be "observer". If you specify this property as a vector:

    • The object function creates a PAT at each specified Broadcaster and configures the specified Observer to listen for the PAT from the Broadcaster.

    • The broadcasterNode input must be a single bluetoothLENode object.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: ResponseSlot=1 sets the value of the response slot number to 1

    Since R2026b

    Subevent(s) of the periodic advertising train to which the observer must listen, specified as a scalar or 1-by-N row vector of subevent numbers in the range [1, NumSubevents], where N ≥ 1.

    This name-value argument applies when you set the value of the PeriodicAdvType property of the bluetoothLEPeriodicAdvConfig object to "PAwR"

    Data Types: double

    Since R2026b

    Response slot number that the observer uses to transmit responses, specified as a nonnegative integer in the range [0, NumResponseSlots]. A value of 0 indicates absence of a response slot. The value must be unique across all observers in the periodic advertising train when greater than 0.

    This name-value argument applies when you set the value of the PeriodicAdvType property of the bluetoothLEPeriodicAdvConfig object to "PAwR"

    Data Types: double

    Output Arguments

    collapse all

    Updated PA configuration, returned as a bluetoothLEPeriodicAdvConfig object or a vector of bluetoothLEPeriodicAdvConfig objects. This output contains the same number of bluetoothLEPeriodicAdvConfig objects that the broadcasterNode and observerNode inputs specify.

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed January 10, 2026. https://www.bluetooth.com/.

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

    Version History

    Introduced in R2024a

    expand all