Main Content

getPayloadLength

Payload length in bytes for Bluetooth BR/EDR format configuration

Download Required: To use getPayloadLength, 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

payloadLength = getPayloadLength(cfg) returns the payload length, in bytes, for the Bluetooth BR/EDR format configuration, cfg.

Examples

collapse all

Create a Bluetooth BR/EDR waveform configuration object with default properties.

cfg = bluetoothWaveformConfig
cfg = 
  bluetoothWaveformConfig with properties:

                       Mode: 'BR'
                 PacketType: 'FHS'
              DeviceAddress: '0123456789AB'
    LogicalTransportAddress: [3x1 double]
          HeaderControlBits: [3x1 double]
            ModulationIndex: 0.3200
           SamplesPerSymbol: 8
               WhitenStatus: 'On'
       WhitenInitialization: [7x1 double]

Get the payload length of the default 'FHS' packet.

payloadLength = getPayloadLength(cfg)
payloadLength = 18

Create another Bluetooth BR/EDR waveform configuration object. Set the packet type as 'HV1'.

cfgHV1 = bluetoothWaveformConfig('PacketType','HV1');

Get the payload length of the specified 'HV1' packet.

payloadLength = getPayloadLength(cfgHV1)
payloadLength = 10

Input Arguments

collapse all

Bluetooth BR/EDR format configuration, specified as bluetoothWaveformConfig object.

Output Arguments

collapse all

Payload length of packet, returned as a nonnegative integer. This value indicates the number of bytes to be processed in a packet.

Data Types: double

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 R2020a