wlanMACFrame

Generate WLAN MAC frame (MPDU or A-MPDU)

Description

example

[frame,frameLength] = wlanMACFrame(macConfig) generates frame, a WLAN medium access control (MAC) frame for the input MAC frame configuration object. The function generates a MAC protocol data unit (MPDU) or an aggregate MPDU (A-MPDU), depending on the property values of the macConfig input. The function also computes frameLength, the total length of the MAC frame.

example

[frame,frameLength] = wlanMACFrame(payload,macConfig) generates a WLAN MAC frame containing payload, one or more MAC service data units (MSDUs). For the MAC frame to contain the payload, the FrameType property of the macConfig input must be set to 'Data' or 'QoS Data'. Otherwise, the function ignores payload.

example

[frame,frameLength] = wlanMACFrame(payload,macConfig,phyConfig) generates a WLAN MAC frame in the format specified by phyConfig, a physical layer (PHY) format configuration object. To generate A-MPDUs, use this syntax.

example

[frame,frameLength] = wlanMACFrame(___,'OutputFormat',format) specifies format, the data format in which the function returns frame.

Examples

collapse all

Create a wlanMACFrameConfig object for a request-to-send (RTS) MAC frame. Generate the frame by calling the wlanMACFrame function and display the result.

macConfig = wlanMACFrameConfig('FrameType','RTS');
[frame,frameLength] = wlanMACFrame(macConfig);
disp(frame')
B000FFFFFF013579A952
4000FFFFFF02468B7AB8

Generate a quality of service (QoS) Data WLAN MAC frame with the specified payload.

macConfig = wlanMACFrameConfig('FrameType','QoS Data');
payload = '00576000103afffe80';
[frame,frameLength] = wlanMACFrame(payload,macConfig);
disp(frame')
8000FFFFFF0135790135790020056013FF88241
8200FFFFFF02468B02468B000007000AFE0EA33

Create MAC and physical layer (PHY) configuration objects, which are required to generate a high-throughput-format (HT-format) aggregated MAC protocol data unit (A-MPDU).

macConfig = wlanMACFrameConfig('FrameType','QoS Data','FrameFormat','HT-Mixed', ...
                                       'MPDUAggregation',true);
phyConfig = wlanHTConfig('MCS',4);

Generate an HT-format A-MPDU containing the specified MAC service data unit (MSDU) payloads.

payload = {'00576000103afffe80','020000fffe00001ff0','002c0b0fffe000001f'};
[frame,frameLength] = wlanMACFrame(payload,macConfig,phyConfig);

Display the frame length.

disp(frameLength)
   131

Create a wlanMACManagementConfig configuration object, specifying the SSID as 'demo SSID'.

mgmtConfig = wlanMACManagementConfig('SSID','demo SSID');

Create a wlanMACFrameConfig configuration object, specifying the management frame-body configuration object as mgmtConfig and a beacon MAC frame.

macConfig = wlanMACFrameConfig('FrameType','Beacon','ManagementConfig',mgmtConfig);

Generate the beacon MAC frame with the specified SSID.

[macFrame,frameLength] = wlanMACFrame(macConfig);

Display the frame length.

frameLength
frameLength = 56

Create a wlanMACFrameConfig object for an RTS MAC frame. Generate the RTS MAC frame in bit format.

macConfig = wlanMACFrameConfig('FrameType','RTS');
[frame,frameLength] = wlanMACFrame(macConfig,'OutputFormat','bits');

Input Arguments

collapse all

MAC frame configuration, specified as a wlanMACFrameConfig object. This object defines the type of MAC frame and its applicable properties.

One or more MSDUs, specified as a numeric vector, character vector, string, or cell array. The value you specify depends on whether the frame is aggregated.

  • To generate an MPDU, specify this argument as one of these values:

    • A numeric vector of octets in decimal format, where each element is an integer in the interval [0, 255]

    • A character vector of octets in hexadecimal format

    • A string scalar of octets in hexadecimal format

    The value you specify represents one MSDU.

  • To generate an A-MPDU, specify this argument as one of these values:

    • A cell array of numeric vectors

    • A cell array of character vectors

    • A string array

    Each element of the specified array represents one MSDU.

Data Types: single | double | int8 | int16 | int32 | int64 | uint8 | uint16 | uint32 | uint64 | char | string | cell

PHY format configuration, specified as a configuration object of type wlanHESUConfig, wlanVHTConfig, or wlanHTConfig. The value you specify must be compatible with the frame format specified in the macConfig input.

  • If the FrameFormat property of macConfig is 'HE-SU' or 'HE-EXT-SU', specify this argument as a wlanHESUConfig object.

  • If the FrameFormat property of macConfig is 'VHT', specify this argument as a wlanVHTConfig object.

  • If the FrameFormat property of macConfig is 'HT-Mixed', specify this argument as a wlanHTConfig object.

Specify this argument to:

  • Ensure that the frame does not exceed the transmission time limit.

  • Add end-of-frame (EOF) padding to frames in very-high-throughput (VHT) or high-efficiency (HE) format.

  • Maintain minimum start spacing between MPDUs in an A-MPDU.

MAC frame format, specified as 'octets' or 'bits'.

Data Types: char | string

Output Arguments

collapse all

MAC frame (MPDU or A-MPDU), returned as one of these values.

  • A character array, where each row is an octet in hexadecimal format, when you specify the format input as 'octets'

  • A binary-valued column vector when you specify the format input as 'bits'

Data Types: int8 | char

Length of generated MAC frame, in octets, returned as a nonnegative integer. For VHT- and HE-format A-MPDUs, this output is the A-MPDU pre-EOF padding (APEP) length, which is less than or equal to the length of the frame output. For all other formats, this output is the physical layer convergence procedure (PLCP) service data unit (PSDU) length.

Data Types: double

References

[1] IEEE Std 802.11™-2016 (Revision of IEEE Std 802.11-2012). “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications.” IEEE Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.

[2] IEEE P802.11ax™/D4.1. “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 1: Enhancements for High Efficiency WLAN.” Draft Standard for Information technology — Telecommunications and information exchange between systems. Local and metropolitan area networks — Specific requirements.

Extended Capabilities

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

Introduced in R2018b