%% Write BLE Packet Data to PCAPNG File
% Create a PCAPNG file writer object, specifying the name of the PCAPNG file.

pcapngObj = pcapngWriter('FileName','writeBLEpacket');

% Write an interface description block for BLE.

interfaceName = 'BLE interface';
bleLinkType = 251;
interfaceId = writeInterfaceDescriptionBlock(pcapngObj,bleLinkType, ...
    interfaceName);

% Specify the BLE LL packet.

llpacket = '42BC13E206120E00050014010A001F0040001700170000007D47C0';

% Write BLE LL packet to the PCAPNG format file.

timestamp = 0; % Number of microseconds
packetComment = 'This is BLE packet';
write(pcapngObj, llpacket,timestamp,interfaceId,'PacketComment', ...
    packetComment);

% Copyright 2020 The MathWorks, Inc.