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 generated MAC frame is a MAC protocol data unit (MPDU) or aggregated MPDU (A-MPDU). 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 macConfig must be set to 'Data' or 'QoS Data'. Otherwise, payload is ignored.

example

[frame,frameLength] = wlanMACFrame(payload,macConfig,phyConfig) generates a WLAN MAC frame for phyConfig, a physical layer (PHY) format configuration object. Use this syntax to generate A-MPDUs.

example

[frame,frameLength] = wlanMACFrame(___,'OutputFormat',format) specifies the data format of the output WLAN MAC 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

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');

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

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: double | uint8 | 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', then you must specify this argument as a wlanHESUConfig object.

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

  • If the FrameFormat property of macConfig is 'HT-Mixed', then you must 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.

Format of output MAC frame, specified as 'bits' or 'octets'.

Data Types: string

Output Arguments

collapse all

Generated MPDU or A-MPDU MAC frame, returned as a character array. Each row of the array is an octet in hexadecimal format.

Data Types: char

Length of the 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. “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™/D3.1. “Part 11: Wireless LAN Medium Access Control (MAC) and Physical Layer (PHY) Specifications. Amendment 6: Enhancements for High Efficiency WLAN.” IEEE 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