%% Decode BLE L2CAP Data Frame with SDU
% Create a BLE L2CAP configuration object, 'cfgL2CAP', with default properties and view the applicable properties. Change the value of channel identifier to '0004'.

cfgL2CAP = bleL2CAPFrameConfig
cfgL2CAP.ChannelIdentifier = '0004'; % Channel identifier for ATT

% Generate a BLE L2CAP data frame from 'cfgL2CAP', specifying the upper-layer payload SDU from attribute protocol (ATT) layer as '0A0100'.

L2CAPFrame = bleL2CAPFrame(cfgL2CAP, "0A0100");

% Decode the generated BLE L2CAP data frame. The returned status indicates decoding was successful. View the output of 'status', 'cfgL2CAP' and the 'SDU'.

[status, cfgL2CAP, SDU] = bleL2CAPFrameDecode(L2CAPFrame)

% Copyright 2019 The MathWorks, Inc.