Main Content

bleLLAdvertisingChannelPDU

Generate BLE LL advertising channel PDU

Download Required: To use bleLLAdvertisingChannelPDU, 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

example

pdu = bleLLAdvertisingChannelPDU(cfgLLAdv) generates a Bluetooth low energy (BLE) link layer (LL) advertising channel protocol data unit (PDU) corresponding to the BLE LL advertising channel PDU configuration object cfgLLAdv.

Examples

collapse all

Generate two unique BLE LL advertising channel PDUs: first one of the type 'Advertising indication' using advertising data '020106' and the other of type 'Connection indication' using a set of data channels to be used.

Create a BLE LL advertising channel PDU configuration object, 'cfgLLAdv', with the opcode as 'Advertising indication' by using advertising data '020106'. View the configured properties corresponding to the opcode.

cfgLLAdv = bleLLAdvertisingChannelPDUConfig;
cfgLLAdv.AdvertisingData = '020106'
cfgLLAdv = 
  bleLLAdvertisingChannelPDUConfig with properties:

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

Generate the BLE LL advertising channel PDU by using the corresponding configuration object. Display the PDU length in octets.

pdu = bleLLAdvertisingChannelPDU(cfgLLAdv);
numel(pdu)/8
ans = 14

Display the first octet of the generated BLE LL advertising channel PDU.

pdu(1:8)
ans = 8×1

     0
     0
     0
     0
     0
     0
     1
     0

Create another BLE LL advertising channel PDU configuration object, this time using the name-value pairs. Change the BLE LL advertising channel PDU opcode to 'Connection indication'. View the active configured properties of the specified opcode.

cfgLLAdv = bleLLAdvertisingChannelPDUConfig('PDUType', ...
    'Connection indication')
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: 6
             SlaveLatency: 0
        ConnectionTimeout: 10
             UsedChannels: [1x37 double]
             HopIncrement: 5
       SleepClockAccuracy: '251 to 500 ppm'

Specify the value of connection interval as 8 and the set of data channels as [0 4 12 16 18 24 25]. View the configured properties.

cfgLLAdv.ConnectionInterval = 8; % in milliseconds
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: 8
             SlaveLatency: 0
        ConnectionTimeout: 10
             UsedChannels: [0 4 12 16 18 24 25]
             HopIncrement: 5
       SleepClockAccuracy: '251 to 500 ppm'

Generate the BLE LL advertising channel PDU from the corresponding configuration object. Display the PDU length in octets.

pdu = bleLLAdvertisingChannelPDU(cfgLLAdv);
numel(pdu)/8
ans = 39

Display the first octet of the generated BLE LL advertising channel PDU.

pdu(1:8)
ans = 8×1

     1
     0
     1
     0
     0
     0
     1
     1

Input Arguments

collapse all

BLE LL advertising channel PDU configuration object, specified as a bleLLAdvertisingChannelPDUConfig object. This value defines the type of generated BLE LL advertising channel PDU and its applicable properties.

Output Arguments

collapse all

Generated BLE LL advertising channel PDU, returned as a binary column vector. This value represents the output BLE LL advertising channel PDU.

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