Main Content

bleLLAdvertisingChannelPDUConfig

Bluetooth LE LL advertising channel PDU configuration parameters

Since R2019b

    Description

    The bleLLAdvertisingChannelPDUConfig object parameterizes the bleLLAdvertisingChannelPDU function to generate a Bluetooth® low energy (LE) link layer (LL) advertising channel protocol data unit (PDU).

    Creation

    Description

    example

    cfgLLAdv = bleLLAdvertisingChannelPDUConfig creates a default Bluetooth LE LL advertising channel PDU configuration object, cfgLLAdv.

    example

    cfgLLAdv = bleLLAdvertisingChannelPDUConfig(Name,Value) sets properties using one or more name-value pairs. Enclose each property name in quotation marks. For example, ('PDUType','Scan response') sets the type of Bluetooth LE LL advertising channel PDU to 'Scan response'.

    Properties

    expand all

    Note

    For more information about Bluetooth LE LL advertising channel PDU properties and their respective values, see Volume 6, Part B, Section 2.3 of the Bluetooth Core Specification [2].

    Bluetooth LE LL advertising channel PDU type, specified as a character vector or a string scalar. Specify this property as one of these values:

    • 'Advertising indication'

    • 'Advertising direct indication'

    • 'Advertising non connectable indication'

    • 'Scan request'

    • 'Scan response'

    • 'Connection indication'

    • 'Advertising scannable indication'

    Data Types: char | string

    Channel selection algorithm, specified as 'Algorithm1' or 'Algorithm2'. This value indicates the type of algorithm that the object uses to hop between channels.

    Data Types: char | string

    Advertiser device address type, specified as 'Random' or 'Public'.

    Data Types: char | string

    Advertiser device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value.

    Data Types: char | string

    Target device address type, specified as 'Random' or 'Public'. This value indicates the type of target device address when a directed advertisement packet is transmitted.

    Data Types: char | string

    Target device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This value indicates the target device address when a directed advertisement packet is transmitted.

    Data Types: char | string

    Scanner device address type, specified as 'Random' or 'Public'. This value indicates the type of scanner device address when a scan request packet is transmitted.

    Data Types: char | string

    Scanner device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This value indicates the scanner device address when a scan request packet is transmitted.

    Data Types: char | string

    Initiator device address type, specified as 'Random' or 'Public'. This value indicates the type of initiator device address when a connection indication packet is transmitted.

    Data Types: char | string

    Initiator device address, specified as a 12-element character vector or a string scalar denoting a 6-octet hexadecimal value. This value indicates the initiator device address when a connection indication packet is transmitted.

    Data Types: char | string

    Advertising data, specified as one of these values:

    • Character vector — This vector represent octets in hexadecimal format.

    • String scalar — This scalar represent octets in hexadecimal format.

    • Numeric vector of elements in the range [0,31] — This vector represent octets in decimal format.

    • n-by-2 character array — Each row represent an octet in hexadecimal format.

    This value indicates the advertising data that the device sends out in an advertisement packet.

    Data Types: char | string | double

    Scan response data, specified as one of these values:

    • Character vector — This vector represent octets in hexadecimal format.

    • String scalar — This scalar represent octets in hexadecimal format.

    • Numeric vector of elements in the range [0,31] — This vector represent octets in decimal format.

    • n-by-2 character array — Each row represent an octet in hexadecimal format.

    This value indicates the scan response data that the device sends out in a scan response packet (when scan request is received).

    Data Types: char | string | double

    Unique connection address, specified as an 8-element character vector or a string scalar. This property indicates a unique 32-bit address that the LL generates for a new connection or periodic advertisement between two devices.

    Data Types: char | string

    CRC initialization value, specified as a 6-element character vector or a string scalar denoting a 3-octet hexadecimal value. The object uses this property to initialize the CRC calculation.

    Data Types: char | string

    Transmit window size, specified as a nonnegative integer in the range [1, Mws], where Mws is the lesser of 8 and ConnectionInterval-1. This property indicates the window size within which the Central transmits the data packet and Peripheral listens for the data packet after connection establishment. Each unit is taken as 1.25 ms so that the (WindowSize×1.25) is in the range [1.25, min(10, ((ConnectionInterval×1.25) - 1.25) ms)] ms.

    Data Types: double

    Transmit window offset, specified as a nonnegative integer in the range [0, Mwo], where Mwo is the lesser of 3200 and ConnectionInterval. This value indicates the window offset after which the transmit window starts. Each unit is taken as 1.25 ms so that the resultant window offset (WindowOffset×1.25) is in the range of [0, (ConnectionInterval×1.25)] ms.

    Data Types: double

    Connection interval, specified as an integer in the range [6, 3200]. This value indicates the interval between the start of two consecutive connection events. Each unit is taken as 1.25 ms so that the resultant connection interval (ConnectionInterval×1.25) is in the range [7.5 ms, 4.0 s].

    Data Types: double

    Peripheral latency, specified as a nonnegative integer in the range [0, Msl], where Msl is the lesser of 499 and ((ConnectionInterval×10)/((ConnectionInterval×1.25)×2))-1. This value indicates the number of connection events that a Peripheral can skip listening for packets from the Central.

    Data Types: double

    Connection supervision timeout, specified as a positive integer in the range [Mct, 3200], where Mct is the greater of 10 and ((1+PeripheralLatency)×(ConnectionInterval×1.25)×2)/10. This value indicates the timeout for a connection if no valid packet is received within this time. Each unit is taken as 10 ms so that the resultant connection timeout (ConnectionInterval×10) is in the range of [100 ms, 32.0 s].

    Data Types: double

    List of used data channels, specified as an integer vector with element values in the range [0, 36]. The vector length must be greater than 1. At least two channels must be set as used (good) channels. This value indicates the set of good channels that the Central classifies.

    Data Types: double

    Hop increment count, specified as an integer in the range [5, 16]. This property indicates the hop increment count that the object uses to hop between data channels.

    Data Types: double

    Central sleep clock accuracy, specified as a character vector or a string scalar indicating the worst case Central sleep clock accuracy. Specify this property as one of these values:

    • '251 to 500 ppm'

    • '151 to 250 ppm'

    • '101 to 150 ppm'

    • '76 to 100 ppm'

    • '51 to 75 ppm'

    • '31 to 50 ppm'

    • '21 to 30 ppm'

    • '0 to 20 ppm'

    Data Types: char | string

    Examples

    collapse all

    Create a default Bluetooth LE LL advertising channel configuration object.

    cfgLLAdv = bleLLAdvertisingChannelPDUConfig
    cfgLLAdv = 
      bleLLAdvertisingChannelPDUConfig with properties:
    
                      PDUType: 'Advertising indication'
             ChannelSelection: 'Algorithm1'
        AdvertiserAddressType: 'Random'
            AdvertiserAddress: '0123456789AB'
              AdvertisingData: [3x2 char]
    
    

    Create two unique Bluetooth LE LL advertising channel configuration objects of type 'Scan response' and 'Connection indication' using name-value arguments.

    Create a Bluetooth LE LL advertising channel PDU configuration object by setting the values of PDU type to 'Scan response', advertiser address to '1234567890AB', and scan response data to '020106020AD3'.

    cfgLLAdv = bleLLAdvertisingChannelPDUConfig('PDUType','Scan response', ...
        'AdvertiserAddress','1234567890AB', ...
        'ScanResponseData','020106020AD3')
    cfgLLAdv = 
      bleLLAdvertisingChannelPDUConfig with properties:
    
                      PDUType: 'Scan response'
        AdvertiserAddressType: 'Random'
            AdvertiserAddress: '1234567890AB'
             ScanResponseData: [6x2 char]
    
    

    Create another Bluetooth LE LL advertising channel PDU configuration object and specify the type of PDU as 'Connection indication'. Set the values of the connection interval as 64 and the set of data channels as [0 4 12 16 18 24 25].

    cfgLLAdv = bleLLAdvertisingChannelPDUConfig('PDUType','Connection indication');
    cfgLLAdv.ConnectionInterval = 64;
    cfgLLAdv.UsedChannels = [0 4 12 16 18 24 25]
    cfgLLAdv = 
      bleLLAdvertisingChannelPDUConfig with properties:
    
                      PDUType: 'Connection indication'
             ChannelSelection: 'Algorithm1'
        AdvertiserAddressType: 'Random'
            AdvertiserAddress: '0123456789AB'
         InitiatorAddressType: 'Random'
             InitiatorAddress: '0123456789CD'
                AccessAddress: '01234567'
            CRCInitialization: '012345'
                   WindowSize: 1
                 WindowOffset: 0
           ConnectionInterval: 64
            PeripheralLatency: 0
            ConnectionTimeout: 10
                 UsedChannels: [0 4 12 16 18 24 25]
                 HopIncrement: 5
           SleepClockAccuracy: '251 to 500 ppm'
    
    

    Create a Bluetooth LE LL advertising channel PDU configuration object, specifying the values of PDU type as 'Connection indication', the connection interval as 8, and the set of data channels as [0 4 12 16 18 24 25].

    cfgLLAdvTx = bleLLAdvertisingChannelPDUConfig('PDUType','Connection indication');
    cfgLLAdvTx.ConnectionInterval = 8;
    cfgLLAdvTx.UsedChannels = [0 4 12 16 18 24 25]
    cfgLLAdvTx = 
      bleLLAdvertisingChannelPDUConfig with properties:
    
                      PDUType: 'Connection indication'
             ChannelSelection: 'Algorithm1'
        AdvertiserAddressType: 'Random'
            AdvertiserAddress: '0123456789AB'
         InitiatorAddressType: 'Random'
             InitiatorAddress: '0123456789CD'
                AccessAddress: '01234567'
            CRCInitialization: '012345'
                   WindowSize: 1
                 WindowOffset: 0
           ConnectionInterval: 8
            PeripheralLatency: 0
            ConnectionTimeout: 10
                 UsedChannels: [0 4 12 16 18 24 25]
                 HopIncrement: 5
           SleepClockAccuracy: '251 to 500 ppm'
    
    

    Generate a Bluetooth LE LL advertising channel PDU by using the corresponding configuration object.

    pdu = bleLLAdvertisingChannelPDU(cfgLLAdvTx);

    Decode the generated Bluetooth LE LL advertising channel PDU. The returned status indicates decoding is successful.

    [status,cfgLLAdvRx] = bleLLAdvertisingChannelPDUDecode(pdu)
    status = 
      blePacketDecodeStatus enumeration
    
        Success
    
    
    cfgLLAdvRx = 
      bleLLAdvertisingChannelPDUConfig with properties:
    
                      PDUType: 'Connection indication'
             ChannelSelection: 'Algorithm1'
        AdvertiserAddressType: 'Random'
            AdvertiserAddress: '0123456789AB'
         InitiatorAddressType: 'Random'
             InitiatorAddress: '0123456789CD'
                AccessAddress: '01234567'
            CRCInitialization: '012345'
                   WindowSize: 1
                 WindowOffset: 0
           ConnectionInterval: 8
            PeripheralLatency: 0
            ConnectionTimeout: 10
                 UsedChannels: [0 4 12 16 18 24 25]
                 HopIncrement: 5
           SleepClockAccuracy: '251 to 500 ppm'
    
    

    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/.

    Extended Capabilities

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

    Version History

    Introduced in R2019b