Main Content

bleLLControlPDUConfig

Bluetooth LE LL control PDU payload configuration parameters

    Description

    The bleLLControlPDUConfig object parameterizes the bleLLDataChannelPDU function to generate a Bluetooth® low energy (LE) link layer (LL) control protocol data unit (PDU) payload.

    Creation

    Description

    cfgControl = bleLLControlPDUConfig creates a default Bluetooth LE LL control PDU payload configuration object.

    example

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

    example

    Properties

    expand all

    Note

    For more information about Bluetooth LE LL control PDU properties and their respective values, see Volume 6, Part B, Section 2.4 of the Bluetooth Core Specification [2].

    Bluetooth LE LL control PDU payload configuration operation code, specified as one of these values.

    • '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 Central transmits a data packet and the Peripheral 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 [1.25, min(10, ((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, 4.0 s].

    Data Types: double

    Peripheral 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 Peripheral 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+PeripheralLatency)*(ConnectionInterval×1.25)×2)/10. If the Peripheral 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 [100 ms, 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.

    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 that the Central classifies.

    Data Types: double

    Connection termination error code, specified as one of these values. 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 a 2-element character vector or string scalar denoting a 1-octet hexadecimal value. This property indicates the type of Bluetooth LE LL control PDU that the object does not recognize or support.

    Data Types: char | string

    Version number of Bluetooth Core Specification, specified as '4.0', '4.1', '4.2', or '5.0'. This property indicates the version number of the Bluetooth Core Specification.

    Data Types: string

    Manufacturer ID of Bluetooth controller, specified as a 4-element character vector or a string scalar denoting a 2-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 4-element character vector or string scalar denoting a 2-octet hexadecimal value. This property indicates the unique value for each implementation or revision of a Bluetooth controller implementation.

    Data Types: char | string

    Examples

    collapse all

    Create a default Bluetooth LE LL control PDU configuration object.

    cfgControl = bleLLControlPDUConfig
    cfgControl = 
      bleLLControlPDUConfig with properties:
    
                    Opcode: 'Connection update indication'
                WindowSize: 1
              WindowOffset: 0
        ConnectionInterval: 6
         PeripheralLatency: 0
         ConnectionTimeout: 10
                   Instant: 0
    
    

    Set the value of the connection interval to 64.

    cfgControl.ConnectionInterval = 64
    cfgControl = 
      bleLLControlPDUConfig with properties:
    
                    Opcode: 'Connection update indication'
                WindowSize: 1
              WindowOffset: 0
        ConnectionInterval: 64
         PeripheralLatency: 0
         ConnectionTimeout: 10
                   Instant: 0
    
    

    Create two unique Bluetooth LE LL control PDU configuration objects using name-value arguments: 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 Bluetooth LE LL control PDU configuration object, specifying opcode as 'Terminate indication' and error code as 'Connection timeout'.

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

    Create another Bluetooth LE LL control PDU payload configuration object, this time by setting the value of opcode as 'Channel map indication'. Specify the list of used data channels.

    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 Bluetooth LE LL data channel configuration object, specifying the values of 'LLID' as 'Control' and 'ControlConfig' as 'cfgControl'.

    cfgLLData = bleLLDataChannelPDUConfig('LLID','Control');
    cfgLLData.ControlConfig = cfgControl
    cfgLLData = 
      bleLLDataChannelPDUConfig with properties:
    
                     LLID: 'Control'
                     NESN: 0
           SequenceNumber: 0
                 MoreData: 0
        CRCInitialization: '012345'
            ControlConfig: [1x1 bleLLControlPDUConfig]
    
    

    Create a default Bluetooth LE LL control PDU configuration object.

    cfgControl = bleLLControlPDUConfig
    cfgControl = 
      bleLLControlPDUConfig with properties:
    
                    Opcode: 'Connection update indication'
                WindowSize: 1
              WindowOffset: 0
        ConnectionInterval: 6
         PeripheralLatency: 0
         ConnectionTimeout: 10
                   Instant: 0
    
    

    Create a Bluetooth LE LL data channel PDU configuration object, specifying the link layer identifier, 'LLID', as 'Control' and 'ControlConfig' as 'cfgControl'. Specify the cyclic redundancy check (CRC).

    cfgLLData = bleLLDataChannelPDUConfig('LLID','Control', ...
        'ControlConfig',cfgControl);
    cfgLLData.CRCInitialization = 'E23456'
    cfgLLData = 
      bleLLDataChannelPDUConfig with properties:
    
                     LLID: 'Control'
                     NESN: 0
           SequenceNumber: 0
                 MoreData: 0
        CRCInitialization: 'E23456'
            ControlConfig: [1x1 bleLLControlPDUConfig]
    
    

    Generate a Bluetooth LE LL control PDU.

    pdu = bleLLDataChannelPDU(cfgLLData);

    Decode the generated Bluetooth LE LL control PDU by initializing the CRC value. The returned status indicates decoding is successful.

    crcInit = 'E23456';                                 % Received during associaton
    [status,cfgRx,llPayload] = bleLLDataChannelPDUDecode(pdu,crcInit)
    status = 
      blePacketDecodeStatus enumeration
    
        Success
    
    
    cfgRx = 
      bleLLDataChannelPDUConfig with properties:
    
                     LLID: 'Control'
                     NESN: 0
           SequenceNumber: 0
                 MoreData: 0
        CRCInitialization: 'E23456'
            ControlConfig: [1x1 bleLLControlPDUConfig]
    
    
    llPayload =
    
      1x0 empty char array
    

    References

    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 22, 2023. 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