Main Content

bleLLDataChannelPDUConfig

Configuration object for BLE LL data channel PDU

Download Required: To use bleLLDataChannelPDUConfig, 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 bleLLDataChannelPDUConfig creates a configuration object for a Bluetooth low energy (BLE) link layer (LL) data channel protocol data unit (PDU) using the default and specified values. You can configure a BLE LL data PDU and a BLE LL control PDU using the applicable properties of bleLLDataChannelPDUConfig.

Creation

Description

example

cfgLLData = bleLLDataChannelPDUConfig creates a configuration object, cfgLLData, for a BLE LL data channel PDU with default values.

example

cfgLLData = bleLLDataChannelPDUConfig(Name,Value) sets properties by using one or more name-value pairs. Enclose each property name in quotes. For example, bleLLDataChannelPDUConfig('LLID','Data (start fragment/complete)') configures cfgLLData with the type of BLE LL data channel PDU as a data PDU.

Properties

expand all

Note

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

Link layer identifier, specified as a character vector or a string scalar to describe the type of a BLE LL data channel PDU. You can specify 'LLID' as one of these values:

  • 'Data (continuation fragment/empty)'

  • 'Data (start fragment/complete)'

  • 'Control'

Data Types: char | string

Next expected sequence number, specified as 0 or 1. This property indicates either an acknowledgment for the last received packet or a request for resending the last transmitted packet from the peer.

Data Types: logical | double

Transmitting packet sequence number, specified as 0 or 1. This property indicates the sequence number of the packet being transmitted.

Data Types: logical | double

Indication for more data, specified as a numeric or a logical value of 1 (true) or 0 (false). A true or 1 value indicates that the sender has more data to send.

Data Types: logical

Cyclic redundancy check initialization value, specified as a six-element character vector or a string scalar denoting a three-octet hexadecimal value.

Data Types: char | string

BLE LL control PDU payload configuration object, specified as a bleLLControlPDUConfig object. The different fields of this value are configured using the settings of bleLLControlPDUConfig. The default value of this property is an object of type bleLLControlPDUConfig with all properties set to their default values. This property is applicable for generating and decoding a BLE LL control PDU.

Object Functions

expand all

bleLLDataChannelPDUGenerate BLE LL data channel PDU
bleLLDataChannelPDUDecodeDecode BLE LL data channel PDU
bleLLControlPDUConfigConfiguration object for BLE LL control PDU payload configuration

Examples

collapse all

Create a BLE LL data channel PDU configuration object for a data PDU and view the corresponding default properties.

cfgLLData = bleLLDataChannelPDUConfig
cfgLLData = 
  bleLLDataChannelPDUConfig with properties:

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

Specify the value of LLID as 'Data (start fragment/complete)' and view the corresponding properties.

cfgLLData.LLID = 'Data (start fragment/complete)'
cfgLLData = 
  bleLLDataChannelPDUConfig with properties:

                 LLID: 'Data (start fragment/complete)'
                 NESN: 0
       SequenceNumber: 0
             MoreData: 0
    CRCInitialization: '012345'

Create two unique BLE LL data channel PDU configuration objects for a control PDU of type 'Channel map indication' and 'Version indication' using name-value pairs.

Create a BLE LL control PDU payload configuration object, 'cfgControl', for a control PDU with opcode 'Channel map indication'. View the applicable properties corresponding to the specified opcode.

cfgControl = bleLLControlPDUConfig('Opcode','Channel map indication')
cfgControl = 
  bleLLControlPDUConfig with properties:

          Opcode: 'Channel map indication'
         Instant: 0
    UsedChannels: [1x37 double]

Create a BLE LL data channel configuration object by specifying the values of 'LLID' as 'Control' and 'ControlConfig' as 'cfgControl'. View the properties of 'cfgLLData'.

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

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

Create another BLE LL data channel configuration object, 'cfgControl' for a control PDU, this time specifying the opcode as 'Version indication'. View the applicable properties of 'cfgControl' corresponding to the specified opcode.

cfgControl.Opcode = 'Version indication';
cfgControl.SubVersionNumber = '008E'
cfgControl = 
  bleLLControlPDUConfig with properties:

               Opcode: 'Version indication'
        VersionNumber: '5.0'
    CompanyIdentifier: 'FFFF'
     SubVersionNumber: '008E'

Create a BLE LL data channel configuration object, 'cfgLLData', by specifying the values of 'ControlConfig' as 'cfgControl' and view the applicable properties.

cfgLLData.ControlConfig = cfgControl
cfgLLData = 
  bleLLDataChannelPDUConfig with properties:

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

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

cfgTx = bleLLDataChannelPDUConfig
cfgTx = 
  bleLLDataChannelPDUConfig with properties:

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

Initialize the CRC value corresponding to the configuration object 'cfgTx'.

cfgTx.CRCInitialization = '123456';

Generate a BLE LL data channel PDU by using the data PDU configuration object, 'cfgTx' and the upper-layer payload '030004000A0100'.

pdu = bleLLDataChannelPDU(cfgTx,'030004000A0100');

Decode the generated BLE LL data channel PDU by initializing the CRC value. The returned status indicates decoding is successful. View the values of 'status', 'cfgRx' and 'llPayload'.

crcInit = '123456';
[status, cfgRx, llPayload] = bleLLDataChannelPDUDecode(pdu, crcInit)
status = 
Success
cfgRx = 
  bleLLDataChannelPDUConfig with properties:

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

llPayload = 7x2 char array
    '03'
    '00'
    '04'
    '00'
    '0A'
    '01'
    '00'

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