function err = commblkwininteg(blk, varargin)
% COMMBLKWININTEG Helper function for Windowed Integrator block.

%   Copyright 1996-2015 The MathWorks, Inc.

%-- Deal the input args to local variables
[integperiod, inputProcessing, roundingMode, overflowMode, ...
    LockScale] = deal(varargin{:});

%-- Init variables
err.eID = []; err.msg = [];

%-- Error if empty, non-numeric, non-integer, vector or less than 1.
if isempty(integperiod) || ~isnumeric(integperiod) || ...
        ~isscalar(integperiod) || ~isreal(integperiod) || ...
        ~is(integperiod, 'integer') || integperiod <= 1  
    err.eID = 'comm:commblkwininteg:InvalidIntegrationPeriod';
    err.msg = 'Integration Period must be a positive integer number.';
    return
end

%-- Data type
inputProcessingValueSet = {'Columns as channels (frame based)', ...
                    'Elements as channels (sample based)'};
roundingModeValueSet = {'Ceiling','Convergent','Floor','Nearest', ...
    'Round','Simplest','Zero'};
checkBoxValueSet = {'off','on'}; % used by overflowMode & LockScale

dtRows = commblkGetCommFiltDTRowInfo(blk);
dspGetUDTFixptDataTypeInfo(blk, dtRows, true);

maskParamNames = get_param(blk, 'MaskNames');
maskParamValues = get_param(blk, 'MaskValues');

set_param([blk '/Discrete FIR Filter'], ...
    'InputProcessing', inputProcessingValueSet{inputProcessing}, ...
    'RndMeth', roundingModeValueSet{roundingMode}, ...
    'SaturateOnIntegerOverflow', checkBoxValueSet{overflowMode+1}, ...
    'CoefDataTypeStr', maskParamValues{strcmp(maskParamNames,'coeffDataTypeStr')}, ...
    'ProductDataTypeStr', maskParamValues{strcmp(maskParamNames,'prodOutputDataTypeStr')}, ...
    'AccumDataTypeStr', maskParamValues{strcmp(maskParamNames,'accumDataTypeStr')}, ...
    'OutDataTypeStr', maskParamValues{strcmp(maskParamNames,'outputDataTypeStr')}, ...
    'LockScale', checkBoxValueSet{LockScale+1});
%[EOF]