function commSupportPackageCheck(baseCode)
%COMMSUPPORTPACKAGECHECK Checks for the support package install
%
%   commSupportPackageCheck(BASECODE) checks for the support package based
%   on BASECODE. If the support package is not installed, then it points to
%   the missing support package in the MATLAB Add-on Explorer.
%
%   BASECODE is a character vector or string specifying the base code of
%   the support package. It must be one of the following:
%   'NFC','ZIGBEE','CST_WINNER2'.

% Copyright 2019-2021 The MathWorks, Inc.

% Validate the base code for the support package
baseCode = validatestring(baseCode,{'NFC','ZIGBEE','CST_WINNER2'});

% Get the support package name and path.
if(strcmp(baseCode, 'NFC'))
    spName = 'Communications Toolbox Library for the NFC Protocol';
    spkgPath = which('nfcBase');
elseif(strcmp(baseCode, 'ZIGBEE'))
    spName = 'Communications Toolbox Library for ZigBee and UWB';
    spkgPath = which('zigbee.APSFrameGenerator');
else
    spName = 'WINNER II Channel Model for Communications Toolbox';
    spkgPath = which('winner2.AntennaArray');
end

% If a user installs support package, the corresponding features or
% functions will be available in the path, SPKGPATH.
try
    % Support package not installed - Error.
    coder.internal.errorIf(isempty(spkgPath),...
                    'comm:checkSPKGInstall:needToInstall',spName,baseCode);
catch e
    throwAsCaller(e);
end