%% Write BLE Packet Data to PCAP File
% Create a PCAP file writer object, specifying the name of the PCAP file. Specify the Bluetooth low energy (BLE) link type.

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

% Write a global header to the PCAP file.

writeGlobalHeader(pcapObj,bleLinkType);

% Specify the BLE link layer (LL) packet.

llpacket = '42BC13E206120E00050014010A001F0040001700170000007D47C0';

% Write BLE LL packet to the PCAP file.

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

% Copyright 2020 The MathWorks, Inc.