Main Content

bluetoothLEGAPConfig

Bluetooth LE GAP configuration parameters

Since R2026a

    Description

    The bluetoothLEGAPConfig object enables you to set the configuration parameters of a Bluetooth® low energy (LE) generic access profile (GAP) specified in Section 9, Volume 3, Part C of Bluetooth Core Specification 6.1 [2]. Use this object to establish an asynchronous connection-oriented logical transport (ACL) connection between a Bluetooth LE Central and Peripheral node.

    Creation

    Description

    LEGAPConfig = bluetoothLEGAPConfig creates a default Bluetooth LE GAP configuration object.

    LEGAPConfig = bluetoothLEGAPConfig(PropertyName=Value) sets properties by using one or more name-value arguments. For example, GAPProcedure="connection establishment" enables the connection establishment procedure at the bluetoothLENode.

    example

    Properties

    expand all

    GAP procedure at the LL, specified as "none" or "connection establishment". Use this property to specify the type of GAP procedure you want to simulate at the LL. Based on your specified value, the object enables the corresponding LL state machine.

    • If you specify this value as "connection establishment", the LL starts from the standby state and initiates the connection procedure based on the role of the configured node.

    • If the value of this property is "none", the LL assumes that a connection is already established at the node. It immediately enters the connection state and starts connection events.

    Data Types: char | string

    Note

    All nodes in the simulation must use the same value for the GAPProcedure property.

    Maximum number of concurrent ACL connections that the LE node supports, specified as an integer in the range [1, 32]. To use this property, you must specify the Role property of the bluetoothLENode object to "peripheral".

    Data Types: double

    Type of LL advertising event, specified as "connectable and scannable undirected", "connectable directed with low duty cycle", or "connectable directed with high duty cycle". Use this value to specify the type of LL advertising event that the LE node uses in the advertising state while transmitting advertising protocol data units (PDUs).

    For more information on the types of advertising events, see Section 4.4.2, Volume 6, Part B of Bluetooth Core Specification 6.1 [2]. To use this property, you must specify the role property of the bluetoothLENode object to "peripheral".

    Data Types: char | string

    Target or peer node for directed advertisements, specified as [] or a bluetoothLENode object with the role property set to "central". To use this property, you must specify the role property of the bluetoothLENode object to "peripheral".

    Dependencies

    To enable this property, set the AdvertisingEventType property as "connectable directed with low duty cycle" or "connectable directed with high duty cycle".

    Data Types: double

    Periodic interval between consecutive advertising events, specified as a scalar in the range [0.02,10485.759375]. Units are in seconds. Specify this value as an integer multiple of 0.625 milliseconds. To use this property, you must specify the role property of the bluetoothLENode object to "peripheral".

    For more information on the type of advertising interval, see Section 4.4.2.2.1, Volume 6, Part B of Bluetooth Core Specification 6.1 [2].

    Data Types: double

    Random selection of advertising channels, specified as a logical 0 (false) or 1 (true). A value of 1 or true enables your bluetoothLENode object to randomly select the advertising channels. If you specify this value as 0 or false, the object sequentially selects the advertising channels 37, 38, and 39. To use this property, you must specify the role property of the bluetoothLENode object to "peripheral".

    Data Types: logical

    Periodic interval between consecutive scan events, specified as a scalar in the range [0.0025, 40.960]. Units are in seconds. Specify this value as an integer multiple of 0.625 milliseconds. To use this property, you must specify the role property of the bluetoothLENode object to "central".

    For more information on scan interval, see Section 4.4.3, Volume 6, Part B of Bluetooth Core Specification 6.1 [2].

    Data Types: double

    Listen time of the LL on the channel index in a scan event, specified as a scalar in the range [0.0025, ScanInterval]. Units are in seconds. Specify this value as an integer multiple of 0.625 milliseconds. To use this property, you must specify the role property of the bluetoothLENode object to "central".

    For more information on scan window, see Section 4.4.3, Volume 6, Part B of Bluetooth Core Specification 6.1 [2].

    Data Types: double

    Examples

    collapse all

    Configure and simulate a Bluetooth LE connection establishment procedure between a Central node and multiple Peripheral nodes using a GAP configuration.

    Initialize the wireless network simulator.

    networkSimulator = wirelessNetworkSimulator.init;

    Specify the total number of Bluetooth LE Peripheral nodes.

    numPeripherals = 7;

    Create a Bluetooth LE GAP configuration object for the Central node, enabling the LE connection establishment procedure at the LL. Specify the maximum number of concurrent ACL connections, periodic interval between consecutive scan events, and listen time of the LL on the channel index in a scan event.

    centralGAPConfig = bluetoothLEGAPConfig(GAPProcedure="connection establishment", ...
        MaxConnections=10,ScanInterval=0.06,ScanWindow=0.04)
    centralGAPConfig = 
      bluetoothLEGAPConfig with properties:
    
                GAPProcedure: "connection establishment"
              MaxConnections: 10
        AdvertisingEventType: "connectable and scannable undirected"
         AdvertisingInterval: 0.0300
           RandomAdvertising: 0
                ScanInterval: 0.0600
                  ScanWindow: 0.0400
    
    

    Create a Bluetooth LE Central node, specifying the node position and GAP configuration.

    centralNode = bluetoothLENode("central",Position=[0 0 0],GAPConfig=centralGAPConfig);

    Create a Bluetooth LE GAP configuration object for the Peripheral nodes, enabling the LE connection establishment procedure at the LL. Specify the advertisement interval in seconds.

    peripheralGAPConfig = bluetoothLEGAPConfig(GAPProcedure="connection establishment", ...
        AdvertisingInterval=0.05,AdvertisingEventType="connectable directed low duty cycle",TargetNode=centralNode)
    peripheralGAPConfig = 
      bluetoothLEGAPConfig with properties:
    
                GAPProcedure: "connection establishment"
              MaxConnections: 7
        AdvertisingEventType: "connectable directed low duty cycle"
                  TargetNode: [1×1 bluetoothLENode]
           RandomAdvertising: 0
                ScanInterval: 0.0500
                  ScanWindow: 0.0300
    
    

    Create Bluetooth LE Peripheral nodes, specifying the node positions and GAP configuration.

    peripheralNodes = bluetoothLENode("peripheral",Position=randi([1 10],numPeripherals,3),GAPConfig=peripheralGAPConfig);

    Add the Central and Peripheral nodes to the wireless network simulator. The Central node and the seven Peripheral nodes establish connections by performing advertising and scanning events. After establishing the connections, they enter the connection state to exchange data.

    addNodes(networkSimulator,[centralNode peripheralNodes])

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

    run(networkSimulator,1)

    References

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

    [2] Bluetooth Core Specifications Working Group. "Bluetooth Core Specification" v6.1. https://www.bluetooth.com/specifications/specs/core-specification-6-1/.

    Version History

    Introduced in R2026a