%% Create BLE LL Control PDU Configuration Object Using Name-Value Pairs
% Create two unique BLE LL control PDU configuration objects using name-value pairs: first one of the type 'Terminate indication' and error code 'Connection timeout' and second one of the type 'Channel map indication' with used set of data channels.
% Create a BLE LL control PDU configuration object, 'cfgControl', by specifying opcode as 'Terminate indication' and the error code as 'Connection timeout'. View the applicable properties corresponding to the specified opcode.

cfgControl = bleLLControlPDUConfig('Opcode','Terminate indication', ...
    'ErrorCode','Connection Timeout')

% Create another BLE LL control PDU payload configuration object, 'cfgControl', this time by setting the value of opcode as 'Channel map indication'. Specify the list of used data channels. View the configured properties corresponding to the specified opcode.

cfgControl = bleLLControlPDUConfig('Opcode','Channel map indication');
cfgControl.UsedChannels = [0 3 12 16 18 24]

% Create a BLE LL data channel configuration object, 'cfgLLData', by specifying the values of 'LLID' as 'Control' and 'ControlConfig' as 'cfgControl'. View the properties of the configuration object 'cfgLLData'.

cfgLLData = bleLLDataChannelPDUConfig('LLID','Control');
cfgLLData.ControlConfig = cfgControl

% Copyright 2019 The MathWorks, Inc.