function addmavlinkkeys(filenames)
%ADDMAVLINKKEYS Add MAVLink keys stored in ".env" files.
%   addmavlinkkeys(FILENAMES) adds MAVLink keys stored in FILENAMES, which
%   have ".env" extension. The files stores MAVLink keys in
%   KeyName=KeyValue and KeyName_Base64=KeyValueStr formats. FILENAMES is a
%   string array containing file paths to ".env" files.

%   Copyright 2022 The MathWorks, Inc.

filenames = convertCharsToStrings(filenames);

% process all env files into a single table
allENVTable = uav.internal.mavlink.loadenv(filenames);

% process duplicated keys and convert base 64 values
keychain = uav.internal.mavlink.KeyChain();
keychain.addFromTable(allENVTable);

end


