%% Write WLAN MAC Packet to PCAPNG File
% Create a WLAN PCAP file writer object, specifying the name of the PCAPNG file.

pcapObj = wlanPCAPWriter('FileName','wlanExample2', ...
    'FileExtension','pcapng');

% Generate a WLAN MAC packet of type QoS Data.

macConfig = wlanMACFrameConfig('FrameType','QoS Data');
payload = '00576000103afffe80';
mpdu = wlanMACFrame(payload,macConfig,'OutputFormat','bits');

% Write the WLAN MAC packet to the PCAPNG format file.

timestamp = 12800000; % Number of microseconds
write(pcapObj,mpdu,timestamp,'PacketFormat','bits');

% Copyright 2020 The MathWorks, Inc.