%% Write BLE Link Layer Packet to PCAP File
%  Create a PCAP file writer object, specifying the name of the PCAP file. Specify the BLE link type.

pcapObj = pcapWriter('FileName','writeBLE');
bleLinkType = 251;

% Write a global header to the PCAP file.

writeGlobalHeader(pcapObj,bleLinkType);

% Specify a BLE LL packet.

llpacket = '42BC13E206120E00050014010A001F0040001700170000007D47C0';

% Write the BLE LL packet to the PCAP file.

timestamp = 129100; % Number of microseconds
write(pcapObj,llpacket,timestamp);

% Copyright 2020 The MathWorks, Inc.