Main Content

bleLLAdvertisingChannelPDUConfig

Configuration object for BLE LL advertising channel PDU

Download Required: To use bleLLAdvertisingChannelPDUConfig, first download Communications Toolbox™ Library for the Bluetooth® Protocol. For more information, see Get and Manage Add-Ons. Alternatively, see Communications Toolbox Library for the Bluetooth Protocol File Exchange.

Description

The bleLLAdvertisingChannelPDUConfig creates a configuration object for Bluetooth low energy (BLE) link layer (LL) advertising channel protocol data unit (PDU) using the default and specified values. You can configure a BLE LL advertising channel PDU using the applicable properties of bleLLAdvertisingChannelPDUConfig.

Creation

Description

example

cfgLLAdv = bleLLAdvertisingChannelPDUConfig creates a configuration object, cfgLLAdv, for a BLE LL advertising channel PDU with default values.

example

cfgLLAdv = bleLLAdvertisingChannelPDUConfig(Name,Value) creates a BLE LL advertising channel PDU configuration object by specifying properties using one or more name-value pairs. Enclose each property name in quotation marks. For example, bleLLAdvertisingChannelPDUConfig('PDUType','Scan response') configures cfgLLAdv with the type of BLE LL advertising channel PDU as 'Scan response'.

Properties

expand all

Note

For more information about BLE LL advertising channel PDU properties and their respective values, see volume 6, part B, section 2.3 of the Bluetooth Core Specification [2].

BLE LL advertising channel PDU type, specified as a character vector or a string scalar to describe the type of a BLE LL advertising channel PDU. You can specify 'PDUType' 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' to indicate the type of algorithm used for hopping between channels.

Data Types: char | string

Advertiser device address type, specified as 'Random' or 'Public' to indicate the type of advertiser address in the packet.

Data Types: char | string

Advertiser device address, specified as a 12-element character vector or a string scalar denoting a six-octet hexadecimal value to indicate the advertiser device address.

Data Types: char | string

Target device address type, specified as 'Random' or 'Public' to indicate 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 six-octet hexadecimal value to indicate the target device address when a directed advertisement packet is transmitted.

Data Types: char | string

Scanner device address type, specified as 'Random' or 'Public' to indicate 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 six-octet hexadecimal value to indicate the scanner device address when a scan request packet is transmitted.

Data Types: char | string

Initiator device address type, specified as 'Random' or 'Public' to indicate 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 six-octet hexadecimal value to indicate 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 property 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 property 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 eight-element character vector or a string scalar. This property indicates a unique 32-bit address generated by the LL for the new connection or for a periodic advertisement between two devices.

Data Types: char | string

CRC initialization value, specified as a six-element character vector or a string scalar denoting a three-octet hexadecimal value. This property is used as initialization value for 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 master transmits the data packet and slave listens for the data packet after connection establishment. Each unit is taken as 1.25 ms so that the window size (WindowSize×1.25) is in the range of 1.25 ms to the minimum of (10 ms, ((ConnectionInterval×1.25) - 1.25) 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 property 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 ms to (ConnectionInterval×1.25) ms.

Data Types: double

Connection interval, specified as a positive integer in the range [6, 3200]. This property 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 of 7.5 ms to 4.0 s.

Data Types: double

Slave 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 property indicates the number of connection events that a slave can skip listening for packets from the master.

Data Types: double

Connection supervision timeout, specified as a positive integer in the range [Mct, 3200], where Mct is the larger of 10 and ((1+SlaveLatency)×(ConnectionInterval×1.25)×2)/10. This property 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 to 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 property indicates the set of good channels classified by the master.

Data Types: double

Hop increment count, specified as an integer in the range [5, 16]. This property indicates the hop increment count to be used for hopping between data channels.

Data Types: double

Master sleep clock accuracy, specified as a character vector or a string scalar indicating the worst case master sleep clock accuracy. You can specify SleepClockAccuracy 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

Object Functions

expand all

bleLLAdvertisingChannelPDUGenerate BLE LL advertising channel PDU
bleLLAdvertisingChannelPDUDecodeDecode BLE LL advertising channel PDU

Examples

collapse all

Create a BLE LL advertising channel configuration object and view the corresponding default properties.

cfgLLAdv = bleLLAdvertisingChannelPDUConfig
cfgLLAdv = 
  bleLLAdvertisingChannelPDUConfig with properties:

                  PDUType: 'Advertising indication'
         ChannelSelection: 'Algorithm1'
    AdvertiserAddressType: 'Random'
        AdvertiserAddress: '0123456789AB'
          AdvertisingData: [3x2 char]

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

Create a BLE LL advertising channel PDU configuration object, 'cfgLLAdv', by setting the values of PDU type as 'Scan response', advertiser address as '1234567890AB', and scan response data as '020106020AD3' using name-value pairs. View the corresponding properties.

cfgLLAdv = bleLLAdvertisingChannelPDUConfig(...
    'PDUType','Scan response', ...
    'AdvertiserAddress','1234567890AB', ...
    'ScanResponseData','020106020AD3')
cfgLLAdv = 
  bleLLAdvertisingChannelPDUConfig with properties:

                  PDUType: 'Scan response'
         ChannelSelection: 'Algorithm1'
    AdvertiserAddressType: 'Random'
        AdvertiserAddress: '1234567890AB'
         ScanResponseData: [6x2 char]

Create another BLE LL advertising channel PDU configuration object, 'cfgLLAdv', and change the type of PDU to '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]. View the corresponding properties.

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
             SlaveLatency: 0
        ConnectionTimeout: 10
             UsedChannels: [0 4 12 16 18 24 25]
             HopIncrement: 5
       SleepClockAccuracy: '251 to 500 ppm'

Create a BLE LL advertising channel PDU configuration object, 'cfgTx'. Set 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].

cfgTx = bleLLAdvertisingChannelPDUConfig('PDUType', ...
    'Connection indication');
cfgTx.ConnectionInterval = 8;
cfgTx.UsedChannels       = [0 4 12 16 18 24 25]
cfgTx = 
  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
             SlaveLatency: 0
        ConnectionTimeout: 10
             UsedChannels: [0 4 12 16 18 24 25]
             HopIncrement: 5
       SleepClockAccuracy: '251 to 500 ppm'

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

pdu = bleLLAdvertisingChannelPDU(cfgTx);

Decode the generated BLE LL advertising channel PDU. The returned status indicates decoding is successful. View the output of 'status' and 'cfgRx'.

[status, cfgRx] = bleLLAdvertisingChannelPDUDecode(pdu)
status = 
Success
cfgRx = 
  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
             SlaveLatency: 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, 2019. https://www.bluetooth.com/.

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

Extended Capabilities

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

Introduced in R2019b