%% Create Basic MAC Trigger Frame
% Create a basic MAC trigger frame to carry information for two users.
% Create a MAC trigger frame-body configuration object, specifying a channel bandwidth of 40 MHz.

cfgTrigger = wlanMACTriggerConfig('ChannelBandwidth','CBW40');

% Create configuration objects for the User Info fields of the trigger frame.

cfgUser1 = wlanMACTriggerUserConfig('AID12',1,'RUSize', ...
    242,'RUIndex',1);
cfgUser2 = wlanMACTriggerUserConfig('AID12',2,'RUSize', ...
    242,'RUIndex',2);

% Add the User Info fields to the trigger frame.

cfgTrigger = addUserInfo(cfgTrigger,cfgUser1);
cfgTrigger = addUserInfo(cfgTrigger,cfgUser2);

% Configure the trigger frame by creating a MAC frame-body configuration object, specifying the frame type and the trigger frame-body configuration.

cfgMAC = wlanMACFrameConfig('FrameType','Trigger', ...
    'TriggerConfig',cfgTrigger);

% Specify a non-HT PHY configuration by creating a default non-HT configuration object.

cfgPHY = wlanNonHTConfig;

% Create the MAC trigger frame and display its length.

[frame,frameLength] = wlanMACFrame(cfgMAC,cfgPHY);
disp(frameLength)

% Copyright 2020 The MathWorks, Inc.