bleLLControlPDUConfig

Create configuration object for BLE LL control PDU payload configuration

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

Description

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

Creation

Description

example

cfgControl = bleLLControlPDUConfig creates a configuration object, cfgControl, for a BLE LL control PDU payload configuration using default values.

example

cfgControl = bleLLControlPDUConfig(Name,Value)sets the properties using one or more name-value pairs. Enclose each property name in quotes. For example, bleLLControlPDUConfig('Opcode','Version indication') configures cfgControl with the operation code as 'Version indication'

Properties

expand all

Note

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

BLE LL control PDU payload configuration operation code, specified as one of the values in this list. Each valid value describes a BLE LL control PDU operation code.

  • 'Connection update indication'

  • 'Channel map indication'

  • 'Terminate indication'

  • 'Unknown response'

  • 'Version indication'

  • 'Reject indication'

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 a data packet and the slave listens for a data packet after the connection is established. 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

Connection interval, specified as an 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 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 ((ConnectionTimeout×10)/((ConnectionInterval×1.25)×2))-1. This property indicates the number of connection events that a slave can ignore.

Data Types: double

Connection supervision timeout, specified as a nonnegative integer in the range [Mct, 3200], where Mct is the larger of 10 and ((1+SlaveLatency)*(ConnectionInterval×1.25)×2)/10. If the slave does not receive a valid packet within this time, this property indicates the connection timeout. Each unit is taken as 10 ms so that the connection timeout (ConnectionInterval×10) is in the range of 100 ms to 32.0 s.

Data Types: double

Connection event instant, specified as an integer in the range [0, 65535]. This property indicates the event count at which specific action must occur, for instance, using updated connection parameters.

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

Connection termination error code, specified as one of the values in this list. Each valid value describes the error description informing the remote device why the connection is about to be terminated.

  • 'Success'

  • 'Unknown connection identifier'

  • 'Hardware failure'

  • 'Memory capacity exceeded'

  • 'Connection timeout'

  • 'Connection limit exceeded'

  • 'Connection already exists'

  • 'Command disallowed'

  • 'Connection accept timeout exceeded'

  • 'Connection rejected due to limited resources'

  • 'Invalid LL parameters'

  • 'Connection rejected due to unacceptable BD_ADDR'

  • 'Unspecified error'

  • 'Unsupported LL parameter value'

  • 'Role change not allowed'

  • 'LL response timeout'

  • 'LL procedure collision'

  • 'Instant passed'

  • 'Channel classification not supported'

  • 'Extended inquiry response too large'

  • 'Connection rejected due to no suitable channel found'

  • 'Advertising timeout'

  • 'Controller busy'

  • 'Unacceptable connection parameters'

  • 'Connection failed to be established'

  • 'Unknown advertising identifier'

  • 'Limit reached'

  • 'Operation cancelled by host'

Data Types: char | string

Unrecognized or unsupported operation code, specified as the comma-separated pair consisting of 'UnknownOpcode' and a two-element character vector or string scalar denoting a one-octet hexadecimal value. This property indicates the type of BLE LL control PDU that is not recognized or supported.

Data Types: char | string

Version number of Bluetooth specification, specified as a string scalar denoting a one-octet hexadecimal value. You can specify the 'VersionNumber' as '4.0', '4.1', '4.2' or '4.3'. This property indicates the version number of the Bluetooth core specification.

Data Types: string

Manufacturer ID of Bluetooth controller, specified as a four-element character vector or a string scalar denoting a two-octet hexadecimal value. This property indicates the unique identifier assigned to your organization by Bluetooth Special Interest Group (SIG) [2].

Data Types: char | string

Subversion number of the Bluetooth controller, specified as a four-element character vector or string scalar denoting a two-octet hexadecimal value. This property indicates the unique value for each implementation or revision of a Bluetooth controller implementation.

Data Types: char | string

Object Functions

expand all

bleLLDataChannelPDUGenerate BLE LL data channel PDU
bleLLDataChannelPDUDecodeDecode BLE LL data channel PDU
bleLLDataChannelPDUConfigCreate configuration object for BLE LL data channel PDU

Examples

collapse all

Create a BLE LL control PDU configuration object, 'cfgControl', using default settings. View the corresponding applicable properties.

cfgControl = bleLLControlPDUConfig
cfgControl = 
  bleLLControlPDUConfig with properties:

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

Change the value of the connection interval to 64. View the configured properties.

cfgControl.ConnectionInterval = 64
cfgControl = 
  bleLLControlPDUConfig with properties:

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

Create two unique BLE LL control PDU configuration objects using name-value pairs: first one of the type 'Terminate indication' and error code 'Connection timeout' and second one of the type 'Channel map indication' with used set of data channels.

Create a BLE LL control PDU configuration object, 'cfgControl', by specifying opcode as 'Terminate indication' and the error code as 'Connection timeout'. View the applicable properties corresponding to the specified opcode.

cfgControl = bleLLControlPDUConfig('Opcode','Terminate indication', ...
    'ErrorCode','Connection Timeout')
cfgControl = 
  bleLLControlPDUConfig with properties:

       Opcode: 'Terminate indication'
    ErrorCode: 'Connection timeout'

Create another BLE LL control PDU payload configuration object, 'cfgControl', this time by setting the value of opcode as 'Channel map indication'. Specify the list of used data channels. View the configured properties corresponding to the specified opcode.

cfgControl = bleLLControlPDUConfig('Opcode','Channel map indication');
cfgControl.UsedChannels = [0 3 12 16 18 24]
cfgControl = 
  bleLLControlPDUConfig with properties:

          Opcode: 'Channel map indication'
         Instant: 0
    UsedChannels: [0 3 12 16 18 24]

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

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

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

Create a BLE LL data channel PDU configuration object for a control PDU by using 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

Generate a BLE LL data channel PDU using 'cfgTx' by specifying the value of link layer identifier, 'LLID', as 'Control' and 'ControlConfig' as 'cfgControl'. Specify the cyclic redundancy check (CRC) value for the configuration object 'cfgTx'. View the properties of 'cfgTx'.

cfgTx = bleLLDataChannelPDUConfig('LLID', 'Control', ...
    'ControlConfig',cfgControl);
cfgTx.CRCInitialization = 'E23456'
cfgTx = 
  bleLLDataChannelPDUConfig with properties:

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

Generate a BLE LL control PDU from 'cfgTx'.

pdu = bleLLDataChannelPDU(cfgTx);

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

crcInit = 'E23456'; % Received during associaton
[status, cfgRx, llPayload] = bleLLDataChannelPDUDecode(pdu, crcInit)
status = 
Success
cfgRx = 
  bleLLDataChannelPDUConfig with properties:

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

llPayload =

  1x0 empty char array

References

[1] Bluetooth Homepage. https://www.bluetooth.com/.

[2] Bluetooth Special Interest Group (SIG). "Bluetooth Core Specification." Version 5.0.

Extended Capabilities

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

Introduced in R2019b