% ------------------------------------------------------------------------------
% Print SEAFET sensor technical data in output CSV file.
%
% SYNTAX :
%  print_sensor_tech_data_in_csv_file_ir_rudics_SEAFET( ...
%    a_cycleNum, a_profNum, a_dataIndexList, ...
%    a_sensorTechSEAFET)
%
% INPUT PARAMETERS :
%   a_cycleNum         : cycle number of the packet
%   a_profNum          : profile number of the packet
%   a_dataIndex        : index of the packet
%   a_sensorTechSEAFET : SEAFET technical data
%
% OUTPUT PARAMETERS :
%
% EXAMPLES :
%
% SEE ALSO :
% AUTHORS  : Jean-Philippe Rannou (Altran)(jean-philippe.rannou@altran.com)
% ------------------------------------------------------------------------------
% RELEASES :
%   06/12/2019 - RNU - creation
% ------------------------------------------------------------------------------
function print_sensor_tech_data_in_csv_file_ir_rudics_SEAFET( ...
   a_cycleNum, a_profNum, a_dataIndexList, ...
   a_sensorTechSEAFET)

% current float WMO number
global g_decArgo_floatNum;

% output CSV file Id
global g_decArgo_outputCsvFileId;

% unpack the input data
a_sensorTechSEAFETNbPackDesc = a_sensorTechSEAFET{1};
a_sensorTechSEAFETNbPackDrift = a_sensorTechSEAFET{2};
a_sensorTechSEAFETNbPackAsc = a_sensorTechSEAFET{3};
a_sensorTechSEAFETNbMeasDescZ1 = a_sensorTechSEAFET{4};
a_sensorTechSEAFETNbMeasDescZ2 = a_sensorTechSEAFET{5};
a_sensorTechSEAFETNbMeasDescZ3 = a_sensorTechSEAFET{6};
a_sensorTechSEAFETNbMeasDescZ4 = a_sensorTechSEAFET{7};
a_sensorTechSEAFETNbMeasDescZ5 = a_sensorTechSEAFET{8};
a_sensorTechSEAFETNbMeasDrift = a_sensorTechSEAFET{9};
a_sensorTechSEAFETNbMeasAscZ1 = a_sensorTechSEAFET{10};
a_sensorTechSEAFETNbMeasAscZ2 = a_sensorTechSEAFET{11};
a_sensorTechSEAFETNbMeasAscZ3 = a_sensorTechSEAFET{12};
a_sensorTechSEAFETNbMeasAscZ4 = a_sensorTechSEAFET{13};
a_sensorTechSEAFETNbMeasAscZ5 = a_sensorTechSEAFET{14};
a_sensorTechSEAFETSensorState = a_sensorTechSEAFET{15};
a_sensorTechSEAFETSensorSerialNum = a_sensorTechSEAFET{16};

% select the data (according to a_cycleNum and a_profNum)
idPack = find((a_sensorTechSEAFETNbPackDesc(a_dataIndexList, 1) == a_cycleNum) & ...
   (a_sensorTechSEAFETNbPackDesc(a_dataIndexList, 2) == a_profNum));

for id = 1:length(idPack)
   idP = a_dataIndexList(idPack(id));

   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb packets for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbPackDesc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb packets for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbPackDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb packets for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbPackAsc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 1 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasDescZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 2 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasDescZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 3 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasDescZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 4 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasDescZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 5 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasDescZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 1 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasAscZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 2 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasAscZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 3 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasAscZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 4 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasAscZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Nb bins in zone 5 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETNbMeasAscZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Sensor state indicator (1:Ok, 0:Ko); %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETSensorState(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; SEAFET tech; Sensor serial num; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechSEAFETSensorSerialNum(idP, 3));
end

return
