bleLLDataChannelPDU

Generate BLE LL data channel PDU

Download Required: To use bleLLDataChannelPDU, 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 = bleLLDataChannelPDU(cfgLLData) generates a Bluetooth low energy (BLE) link layer (LL) data channel protocol data unit (PDU), pdu, for a given BLE LL data channel configuration object cfgLLData. This syntax is used for generating BLE LL control PDUs.

example

pdu = bleLLDataChannelPDU(cfgLLData,LLPayload) generates a BLE LL data channel PDU, pdu, containing the upper-layer payload LLPayload for a given BLE LL data channel configuration object cfgLLData. This syntax is used for generating BLE LL data PDUs.

Examples

collapse all

Create a BLE LL control PDU configuration object for a control PDU using the default configuration. View the corresponding default properties.

cfgControl = bleLLControlPDUConfig
cfgControl = 
  bleLLControlPDUConfig with properties:

                Opcode: 'Connection update indication'
            WindowSize: 1
          WindowOffset: 0
    ConnectionInterval: 6
          SlaveLatency: 0
     ConnectionTimeout: 10
               Instant: 0

Create a BLE LL data channel PDU configuration object for a control PDU of type 'Connection update indication' by configuring the values of link layer identifier (LLID) as 'Control' and ControlConfig as 'cfgControl'. View the corresponding properties.

cfgLLData = bleLLDataChannelPDUConfig('LLID', 'Control', ...
    'ControlConfig', cfgControl)
cfgLLData = 
  bleLLDataChannelPDUConfig with properties:

                 LLID: 'Control'
                 NESN: 0
       SequenceNumber: 0
             MoreData: 0
    CRCInitialization: '012345'
        ControlConfig: [1x1 bleLLControlPDUConfig]

Generate a BLE LL data channel PDU of type 'Connection update indication' by using the configuration object 'cfgLLData'. Display the PDU length in octets.

pdu = bleLLDataChannelPDU(cfgLLData);
numel(pdu)/8
ans = 17

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

pdu(1:8)
ans = 8×1

     1
     1
     0
     0
     0
     0
     0
     0

Create a BLE LL data channel PDU configuration object, 'cfgLLData', for a data PDU by using the default configuration. View the corresponding default properties.

cfgLLData = bleLLDataChannelPDUConfig
cfgLLData = 
  bleLLDataChannelPDUConfig with properties:

                 LLID: 'Data (continuation fragment/empty)'
                 NESN: 0
       SequenceNumber: 0
             MoreData: 0
    CRCInitialization: '012345'

Generate a BLE LL data PDU by using the corresponding configuration object, 'cgLLData' and the upper-layer payload '030004000A0100'. Display the PDU length in octets.

pdu = bleLLDataChannelPDU(cfgLLData,'030004000A0100');
numel(pdu)/8
ans = 12

Display the first octet of the generated BLE LL data PDU.

pdu(1:8)
ans = 8×1

     1
     0
     0
     0
     0
     0
     0
     0

Input Arguments

collapse all

BLE LL data channel configuration object, specified as a bleLLDataChannelPDUConfig object. This object is used to configure the BLE LL data channel PDU and its applicable properties.

Upper-layer payload, specified as one of these types:

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

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

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

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

Data Types: char | double | string

Output Arguments

collapse all

Generated BLE LL data channel PDU, returned as a binary column vector. This value represents the output BLE LL data 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

Introduced in R2019b