Main Content

bleLLAdvertisingChannelPDU

Generate Bluetooth LE LL advertising channel PDU

    Description

    example

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

    Examples

    collapse all

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

    Create a Bluetooth LE LL advertising channel PDU configuration object, 'cfgLLAdv', with the opcode as 'Advertising indication' by using advertising data '020106'.

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

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

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

    Display the first octet of the generated Bluetooth LE LL advertising channel PDU.

    advLLpdu(1:8)
    ans = 8×1
    
         0
         0
         0
         0
         0
         0
         1
         0
    
    

    Create another Bluetooth LE LL advertising channel PDU configuration object, this time using the name-value pairs. Set the Bluetooth LE LL advertising channel PDU opcode to 'Connection indication'.

    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
            PeripheralLatency: 0
            ConnectionTimeout: 10
                 UsedChannels: [0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 ... ]
                 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].

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

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

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

    Display the first octet of the generated Bluetooth LE LL advertising channel PDU.

    advLLpdu(1:8)
    ans = 8×1
    
         1
         0
         1
         0
         0
         0
         1
         1
    
    

    Input Arguments

    collapse all

    Bluetooth LE LL advertising channel PDU configuration object, specified as a bleLLAdvertisingChannelPDUConfig object.

    Output Arguments

    collapse all

    Generated Bluetooth LE LL advertising channel PDU, returned as a binary column vector.

    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