%% End-to-End Workflow of BLE LL Data Channel PDU
% Create a BLE LL data channel PDU configuration object, 'cfgTx', for a data PDU using default configuration. View the corresponding default properties.

cfgTx = bleLLDataChannelPDUConfig

% Initialize the CRC value corresponding to the configuration object 'cfgTx'.

cfgTx.CRCInitialization = '123456';

% Generate a BLE LL data channel PDU by using the data PDU configuration object, 'cfgTx' and the upper-layer payload '030004000A0100'.

pdu = bleLLDataChannelPDU(cfgTx,'030004000A0100');

% Decode the generated BLE LL data channel PDU by initializing the CRC value. The returned status indicates decoding is successful. View the values of 'status', 'cfgRx' and 'llPayload'.

crcInit = '123456';
[status, cfgRx, llPayload] = bleLLDataChannelPDUDecode(pdu, crcInit)

% Copyright 2019 The MathWorks, Inc.