%% End-to-End Workflow of BLE GAP AD Blocks
% Create a configuration object for a BLE GAP AD block using name-value pairs. Set the values of AD types as 'Advertising interval' and 'Local name', advertising interval as 48, local name as 'MathWorks', and local name shortening as true. View the properties of the corresponding configuration object.

cfgTx = bleGAPDataBlockConfig('AdvertisingDataTypes',{'Advertising interval','Local name'});
cfgTx.AdvertisingInterval = 48;
cfgTx.LocalName = 'MathWorks';
cfgTx.LocalNameShortening = true

% Create a BLE GAP AD block using the configuration object 'cfgTx'.

dataBlock = bleGAPDataBlock(cfgTx);

% Decode the generated BLE GAP AD block. The returned status indicates decoding was successful. View the output of 'status' and 'cfgRx'.

[status, cfgRx] = bleGAPDataBlockDecode(dataBlock)

% Copyright 2019 The MathWorks, Inc.