%% Write BLE LL Packet to PCAP File
% Create a default BLE PCAP file writer object.

pcapObj = blePCAPWriter;

% Generate a BLE LL packet.

cfgLLData = bleLLDataChannelPDUConfig('LLID', ...
    'Data (start fragment/complete)');
payload = '0E00050014010A001F004000170017000000';
llDataPDU = bleLLDataChannelPDU(cfgLLData, payload);
connAccessAddress = de2bi(hex2dec('E213BC42'), 32)';
llpacket = [connAccessAddress; llDataPDU];

% Write the BLE LL packet to the PCAP file.

timestamp = 0; % Number of microseconds
write(pcapObj,llpacket,timestamp,'PacketFormat','bits');

% Copyright 2020 The MathWorks, Inc.