Main Content

bleGAPDataBlockConfig

Bluetooth LE GAP data block configuration parameters

Since R2019b

    Description

    The bleGAPDataBlockConfig parameterizes the bleGAPDataBlock function to generate a Bluetooth® low energy (LE) generic access profile (GAP) data block of the type advertising data (AD) or scan response data (SRD).

    Creation

    Description

    example

    cfgGAP = bleGAPDataBlockConfig creates a default configuration object, cfgGAP, for a Bluetooth LE GAP data block of the type AD or SRD.

    example

    cfgGAP = bleGAPDataBlockConfig(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in quotes. For example, ('AdvertisingDataTypes','Tx power level') sets the block data advertising data type to 'Tx power level'.

    Properties

    expand all

    Note

    For more information about Bluetooth LE GAP data block properties and their respective values, see Volume 3, Part C, Section 4 of the Bluetooth Core Specification [2].

    Block data advertising data types, specified as a character vector, a string scalar or a cell array, containing the list of advertising data types for Bluetooth LE GAP data block. Specify this property as one of these values:

    • 'Flags'

    • 'UUIDs'

    • 'Local name'

    • 'Tx power level'

    • 'Connection interval range'

    • 'Advertising interval'

    Data Types: char | string | cell

    LE discoverable mode, specified as a character vector or a string scalar, describing the LE discoverable mode of the device. Specify this property as one of these values:

    • 'None'

    • 'General'

    • 'Limited'

    • 'Limited and general'

    Data Types: char | string

    Flag to enable basic rate (BR) or enhanced data rate (EDR ) support, specified as 1 (true) or 0 (false). A 1 (true) value indicates that the object supports BR or EDR mode.

    Dependencies

    To enable this property, set the AdvertisingDataTypes property to 'Flags'.

    Data Types: logical

    Simultaneous LE and BR/EDR support, specified as a character vector or a string scalar. Specify this property as one of these values:

    • 'None' — Simultaneous LE and BR or EDR support is disabled

    • 'Host' — Simultaneous LE and BR or EDR support is enabled at the Host

    • 'Controller' — Simultaneous LE and BR or EDR support is enabled at the Controller

    • 'Host and controller' — Simultaneous LE and BR or EDR support is enabled at the Host and Controller

    Dependencies

    To enable this property, set the BREDR property to true.

    Data Types: char | string

    Flag to enable shortening of local name, specified as 1 (true) or 0 (false).

    Data Types: logical

    UTF-8 encoded user-friendly descriptive name, specified as a character vector or a string scalar consisting of UTF-8 characters. This property specifies the local name that the object assigns to the device.

    Data Types: char | string

    Type of 16-bit service or service class identifiers, specified as 'Incomplete' or 'Complete'. If you set this value to 'Incomplete', the Identifiers property is incomplete.

    Data Types: char | string

    List of 16-bit service or service class identifiers, specified as an n-by-4 character array. The value of n must be in the range [0, 127]. Each row in the n-by-4 character array is represented as a 4-element character vector or a string scalar denoting a 2-octet (16-bit) hexadecimal value of a service or service class universally unique identifier (UUID). These UUIDs are assigned by the Bluetooth Special Interest Group (SIG).

    Data Types: char

    Advertising interval, specified as an integer in the range [32, 65,535]. This property denotes the interval between the start of two consecutive advertising events. Incremental units are in 0.625 ms steps, so the resultant range for [32, 65,535] is [20, 40.959375].

    Data Types: double

    Packet transmit power level, specified as an integer in the range [–127, 127]. This property calculates the pathloss as pathloss = Tx Power Level RSSI, where RSSI is the received signal strength indicator.

    Data Types: double

    Connection interval range, specified as a 2-element numeric vector [MIN, MAX], where MIN and MAX values must be in the range [6, 3200]. MIN and MAX specify the minimum and maximum value for the connection interval, respectively. MIN must be less than or equal to MAX. Incremental units are 1.25 ms steps, so that the resultant range for [6, 3200] is [7.5, 4.0].

    Data Types: double

    Examples

    collapse all

    Create two unique Bluetooth LE GAP AD configuration objects: one with AD types 'Flags' and 'Tx power level' and the other with AD type 'Flags' and simultaneous LE and BR or EDR support at the host.

    Create a default Bluetooth LE GAP AD block configuration object. Set the values of AD types to 'Flags' and 'Tx power level', LE discoverability to 'Limited' and Tx power level to 45.

    cfgGAP = bleGAPDataBlockConfig;
    cfgGAP.AdvertisingDataTypes = {'Flags';'Tx power level'};
    cfgGAP.LEDiscoverability = 'Limited';
    cfgGAP.TxPowerLevel = 45
    cfgGAP = 
      bleGAPDataBlockConfig with properties:
    
        AdvertisingDataTypes: {2x1 cell}
           LEDiscoverability: 'Limited'
                       BREDR: 0
                TxPowerLevel: 45
    
    

    Create another default Bluetooth LE GAP AD block configuration object, this time with AD type 'Flags' and having simultaneous support for LE and BR/EDR at the Host. Set the values of LE discoverability to 'Limited'. Enable BR or EDR support,

    cfgGAP = bleGAPDataBlockConfig;
    cfgGAP.AdvertisingDataTypes = {'Flags'};
    cfgGAP.LEDiscoverability = 'Limited and general';
    cfgGAP.BREDR = true;
    cfgGAP.LE = 'Host'
    cfgGAP = 
      bleGAPDataBlockConfig with properties:
    
        AdvertisingDataTypes: {'Flags'}
           LEDiscoverability: 'Limited and general'
                       BREDR: 1
                          LE: 'Host'
    
    

    Create a configuration object for a Bluetooth LE GAP AD block by using name-value pairs. Set the values of AD types to 'Advertising interval' and 'Local name', advertising interval to 48, local name to 'MathWorks' and local name shortening to true.

    cfgGAP = bleGAPDataBlockConfig('AdvertisingDataTypes', ...
        {'Advertising interval', ...
        'Local name'});
    cfgGAP.AdvertisingInterval = 48;
    cfgGAP.LocalName = 'MathWorks';
    cfgGAP.LocalNameShortening = true
    cfgGAP = 
      bleGAPDataBlockConfig with properties:
    
        AdvertisingDataTypes: {2x1 cell}
                   LocalName: 'MathWorks'
         LocalNameShortening: 1
         AdvertisingInterval: 48
    
    

    Create a Bluetooth LE GAP AD block configuration object by using name-value pairs. Set the values of AD types to 'Advertising interval' and 'Local name', advertising interval to 48, local name as 'MathWorks', and local name shortening to true.

    cfgGAPTx = bleGAPDataBlockConfig('AdvertisingDataTypes',{'Advertising interval','Local name'});
    cfgGAPTx.AdvertisingInterval = 48;
    cfgGAPTx.LocalName = 'MathWorks';
    cfgGAPTx.LocalNameShortening = true
    cfgGAPTx = 
      bleGAPDataBlockConfig with properties:
    
        AdvertisingDataTypes: {2x1 cell}
                   LocalName: 'MathWorks'
         LocalNameShortening: 1
         AdvertisingInterval: 48
    
    

    Generate a Bluetooth LE GAP AD block.

    dataBlock = bleGAPDataBlock(cfgGAPTx);

    Decode the generated Bluetooth LE GAP AD block. The returned status indicates decoding was successful.

    [status,cfgGAPRx] = bleGAPDataBlockDecode(dataBlock)
    status = 
      blePacketDecodeStatus enumeration
    
        Success
    
    
    cfgGAPRx = 
      bleGAPDataBlockConfig with properties:
    
        AdvertisingDataTypes: {2x1 cell}
                   LocalName: 'MathWorks'
         LocalNameShortening: 1
         AdvertisingInterval: 48
    
    

    References

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

    [2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.3. https://www.bluetooth.com/.

    [3] Bluetooth Special Interest Group (SIG). "Supplement to the Bluetooth Core Specification." CSS Version 7 (2016).

    Extended Capabilities

    C/C++ Code Generation
    Generate C and C++ code using MATLAB® Coder™.

    Version History

    Introduced in R2019b