wlanMPDUDecode
Decode MPDU
Syntax
Description
[
validates the frame check sequence (FCS) and decodes the specified MAC protocol data unit
(MPDU), cfgMAC
,payload
,status
] = wlanMPDUDecode(mpdu
)mpdu
. The function returns cfgMAC
, a
wlanMACFrameConfig
configuration object, payload
,
one or more MAC service data units (MSDUs), and status
, the result of
the MPDU decoding.
[
specifies options using one or more name-value arguments in addition any input argument
combination from previous syntaxes.cfgMAC
,payload
,status
] = wlanMPDUDecode(___,Name=Value
)
Examples
Create a wlanMACFrameConfig
object with default properties.
cfgMAC = wlanMACFrameConfig;
Generate a random payload.
payload = randi([0 255],1,40);
Use the payload and MAC frame configuration to generate a MAC frame.
mpdu = wlanMACFrame(payload,cfgMAC,OutputFormat="bits");
Decode the MAC frame and display the status of the decoding.
[rxCfgMAC,payload,status] = wlanMPDUDecode(mpdu); disp(status)
Success
Create a WLAN MAC frame configuration object for a QoS Data MAC frame, specifying the high-efficiency single-user (HE SU) format. Enable MPDU aggregation and disable MSDU aggregation.
frameType = "QoS Data"; phyFormat = "HE-SU"; cfgMAC = wlanMACFrameConfig(FrameType=frameType,FrameFormat=phyFormat, ... MPDUAggregation=true,MSDUAggregation=false);
Create a cell array of MSDUs, specifying each MSDU as a numeric vector of octets in bit format.
msduList = repmat({randi([0 255],32,1)},1,4);
Generate the MPDU for an HE SU PHY configuration.
cfgPHY = wlanHESUConfig(MCS=5);
[ampdu,ampduLength] = wlanMACFrame(msduList,cfgMAC,cfgPHY,OutputFormat="bits");
Deaggregate the A-MPDU.
[mpduList,delimiterCRCFailure,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY);
Decode the first MPDU and display the success of the decoding.
[cfg,msdu,decodeStatus] = wlanMPDUDecode(mpduList{1},phyFormat,DataFormat="octets");
disp(decodeStatus)
Success
Create a WLAN MAC frame configuration object for a QoS Data frame, and then generate the MPDU.
cfgMAC = wlanMACFrameConfig(FrameType="QoS Data"); payload = randi([0 255],1,40); mpdu = wlanMACFrame(payload,cfgMAC,OutputFormat="bits");
Create a non-high-throughput-format (non-HT-format) configuration object with default settings.
cfgPHY = wlanNonHTConfig;
Return the MSDUs by decoding the MPDU for the specified PHY format configuration.
[cfgMAC,payload,status] = wlanMPDUDecode(mpdu,cfgPHY);
Confirm successful decoding by displaying the status.
disp(status)
Success
Create a WLAN MAC frame configuration object for a VHT A-MPDU.
txCfgMAC = wlanMACFrameConfig(FrameType="QoS Data", ... FrameFormat="VHT");
Create a VHT-format configuration object with default settings.
cfgPHY = wlanVHTConfig;
Generate a random payload of eight MSDUs.
txPayload = repmat({randi([0 255],1,40)},1,8);
Generate the A-MPDU containing eight MPDUs for the specified MAC and PHY configurations.
ampdu = wlanMACFrame(txPayload,txCfgMAC,cfgPHY);
Extract the list of MPDUs by deaggregating the A-MPDU. Display the status of the deaggregation and the delimiter CRC.
[mpduList,failCRC,status] = wlanAMPDUDeaggregate(ampdu,cfgPHY, ... DataFormat="octets"); disp(status)
Success
disp(failCRC)
0 0 0 0 0 0 0 0
Decode all of the MPDUs in the extracted. Confirm successful decoding by displaying the status.
if strcmp(status,"Success") for i = 1:numel(mpduList) if ~failCRC(i) [cfgMAC,payload,status(i)] = ... wlanMPDUDecode(mpduList{i},cfgPHY, ... DataFormat="octets"); end end end disp(status)
Success Success Success Success Success Success Success Success
Input Arguments
MPDU to be decoded, specified as one of these values.
A binary-valued vector representing the MPDU in bit form
A vector of integers in the interval [0, 255] representing octets in decimal format
A string scalar representing the MPDU as octets in hexadecimal format
A character vector representing the MPDU as octets in hexadecimal format
A character array, where each row represents an octet in hexadecimal format
Data Types: single
| double
| int8
| int16
| int32
| int64
| uint8
| uint16
| uint32
| uint64
| char
| string
PHY format, specified as one of these values.
'EHT-SU'
— Extremely high-throughput SU (EHT SU) format'HE-SU'
— High-efficiency single-user (HE SU) format'HE-EXT-SU'
— HE extended-range SU (HE ER SU) format'HE-MU'
— HE multi-user (HE MU) format'HE-TB'
— HE trigger-based (HE TB) format'VHT'
— Very-high-throughput (VHT) format'HT'
— High-throughput (HT) format'Non-HT'
— Non-HT format
Data Types: char
| string
PHY format and transmission parameters, specified as one of these objects.
wlanEHTMUConfig
— EHT SU formatwlanHESUConfig
— HE SU or HE ER SU formatwlanHEMUConfig
— HE MU formatwlanHETBConfig
— HE TB formatwlanHERecoveryConfig
— Recovered HE transmission in HE SU, HE ER SU, or HE MU formatwlanVHTConfig
— VHT formatwlanHTConfig
— HT formatwlanNonHTConfig
— Non-high-throughput (non-HT) format
If you specify this input as an object of type wlanEHTMUConfig
,
this object must specify the configuration for a single user transmission.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: DataFormat='octets'
Format of input MPDU, specified as one of these values.
'bits'
— Specify thempdu
input in bit format'octets'
— Specify thempdu
input in octet format
Data Types: char
| string
Suppress warning messages, specified as one of these values.
false
or0
— Allow warning messages.true
or1
— Suppress warning messages.
Data Types: logical
Mesh frame indication, specified as a numeric or logical 1
(true
) or 0
( false
). To
indicate that the frame originates from a mesh station in a mesh BSS, set this
property to 1
(true
). The function uses this
argument only when decoding a frame of type QoS Data or QoS Null.
Data Types: logical
Output Arguments
MAC frame configuration, returned as a wlanMACFrameConfig
object.
One or more MSDUs, returned as a cell array of character arrays. The function
returns a character array for each MSDU. In these character arrays, each row is the
hexadecimal representation of an octet. For each MAC frame that contains no data, the
function returns payload
as an empty cell array.
Data Types: cell
Status of MPDU decoding, returned as an integer in the interval [–31, 0]. Each value
of status
corresponds to a member of the
wlanMACDecodeStatus
enumeration class, which indicates the status of
MAC frame decoding according to this table.
Enumeration Value | Member of Enumeration Class | Decoding Status |
0 | Success | MAC frame successfully decoded |
-1 | FCSFailed | Frame check sequence (FCS) failed |
-2 | InvalidProtocolVersion | Invalid protocol version |
-3 | UnsupportedFrameType | Unsupported frame type |
-4 | UnsupportedFrameSubtype | Unsupported frame subtype |
-5 | NotEnoughData | Insufficient data to decode frame |
-6 | UnsupportedBAVariant | Unsupported variant of Block Ack frame |
-7 | UnknownBitmapSize | Unknown bitmap size |
-8 | UnknownAddressExtMode | Unknown address extension mode |
-9 | MalformedAMSDULength | Malformed aggregate MAC service data unit (A-MSDU) with invalid length |
-10 | MalformedSSID | Malformed service set identifier (SSID) information element (IE) |
-11 | MalformedSupportedRatesIE | Malformed supported rates IE |
-12 | MalformedIELength | Malformed IE length field |
-13 | MissingMandatoryIEs | Mandatory IEs missing |
-14 | NoMPDUFound | No MPDU found in A-MPDU |
-15 | CorruptedAMPDU | All the delimiters in received A-MPDU failed cyclic redundancy check (CRC) |
-16 | InvalidDelimiterLength | Invalid length field in MPDU delimiter |
-17 | MaxAMSDULenthExceeded | A-MSDU exceeds maximum length limit |
-18 | MaxMPDULengthExceeded | MPDU exceeds maximum length limit |
-19 | MaxMMPDULengthExceeded | MAC management frame exceeds maximum length limit |
-20 | MaxMSDULengthExceeded | MSDU exceeds maximum length limit |
-21 | UnexpectedProtectedFrame | Invalid value of protected bit for this frame type |
-22 | UnsupportedTriggerType | Unsupported trigger frame type |
-23 | UnknownHELTFTypeAndGI | Unknown guard interval (GI) and high-efficiency long training field (HE-LTF) type |
-24 | UnknownAPTxPower | Unknown value for AP Tx Power subfield of Common Info field |
-25 | UnknownAID12Value | Unknown value for AID12 subfield of User Info field |
-26 | UnknownRUAllocation | Unknown value for B7-B1 in RU Allocation subfield of User Info field |
-27 | UnknownULMCS | Unknown value for UL MCS subfield of User Info field |
-28 | UnknownTargetRSSI | Unknown value for UL Target RSSI subfield of User Info field |
-29 | UnsupportedBARType | Unsupported value for BAR Type subfield of BAR Control field |
-30 | MissingUserInfo | Received trigger frame contains invalid User Info field |
-31 | InvalidLSIGLength | Invalid value for UL Length subfield of Common Info field, corresponding to length of legacy signal (L-SIG) field. |
An enumeration value other than 0
means that MPDU decoding
failed. If the decoding fails, the cfgMAC
output displays no
properties, and the function returns the payload
output as an empty
cell array.
Data Types: int16
Extended Capabilities
C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.
Version History
Introduced in R2019a
See Also
Functions
Objects
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: United States.
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)