Main Content


Return payload length for Bluetooth BR/EDR format configuration

Since R2020a



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


    collapse all

    Create a default Bluetooth BR/EDR waveform configuration object.

    cfgPayload = bluetoothWaveformConfig
    cfgPayload = 
      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(cfgPayload)
    payloadLength = 18

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

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

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

    payloadLength1 = getPayloadLength(cfgPayload1)
    payloadLength1 = 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


    [1] Bluetooth Technology Website. “Bluetooth Technology Website | The Official Website of Bluetooth Technology.” Accessed November 22, 2021.

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

    Extended Capabilities

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

    Version History

    Introduced in R2020a