Apply Licenses

clear;

Tobii = EyeTrackingOperations();

eyetracker_address = 'Address of the desired device';
% Example:
% eyetracker_address = 'tet-tcp://10.46.32.51';
try
    eyetracker = Tobii.get_eyetracker(eyetracker_address);
catch ME
    if (strcmp(ME.identifier,'EyeTrackerGet:error204'))
        fprintf('Unable to connect eye tracker.\n');
        return
    end
end

licenses_path = {'licenses/se_license_key_IS4BA-00000057'
                'licenses/se_license_key_IS405-030106416232'
                'licenses/se_license_key_IS405-030106416222'
                };

number_of_licenses = size(licenses_path,2);

input_licenses(number_of_licenses) = LicenseKey;

for i=1:number_of_licenses
    fileID = fopen(file_path,'r');
    input_licenses(i) = LicenseKey(fread(fileID));
    fclose(fileID);
end

% Returns an array with the licenses that were not successfully applied.
% Should return empty if all the licenses were correctly applied.
failed_licenses = eyetracker.apply_licenses(input_licenses);