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

% current float WMO number
global g_decArgo_floatNum;

% output CSV file Id
global g_decArgo_outputCsvFileId;

% unpack the input data
a_sensorTechCROVERNbPackDesc = a_sensorTechCROVER{1};
a_sensorTechCROVERNbPackDrift = a_sensorTechCROVER{2};
a_sensorTechCROVERNbPackAsc = a_sensorTechCROVER{3};
a_sensorTechCROVERNbMeasDescZ1 = a_sensorTechCROVER{4};
a_sensorTechCROVERNbMeasDescZ2 = a_sensorTechCROVER{5};
a_sensorTechCROVERNbMeasDescZ3 = a_sensorTechCROVER{6};
a_sensorTechCROVERNbMeasDescZ4 = a_sensorTechCROVER{7};
a_sensorTechCROVERNbMeasDescZ5 = a_sensorTechCROVER{8};
a_sensorTechCROVERNbMeasDrift = a_sensorTechCROVER{9};
a_sensorTechCROVERNbMeasAscZ1 = a_sensorTechCROVER{10};
a_sensorTechCROVERNbMeasAscZ2 = a_sensorTechCROVER{11};
a_sensorTechCROVERNbMeasAscZ3 = a_sensorTechCROVER{12};
a_sensorTechCROVERNbMeasAscZ4 = a_sensorTechCROVER{13};
a_sensorTechCROVERNbMeasAscZ5 = a_sensorTechCROVER{14};
a_sensorTechCROVERSensorState = a_sensorTechCROVER{15};
a_sensorTechCROVERSensorSerialNum = a_sensorTechCROVER{16};

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

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

   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb packets for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbPackDesc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb packets for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbPackDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb packets for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbPackAsc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 1 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasDescZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 2 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasDescZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 3 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasDescZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 4 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasDescZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 5 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasDescZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 1 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasAscZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 2 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasAscZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 3 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasAscZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 4 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasAscZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Nb bins in zone 5 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERNbMeasAscZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Sensor state indicator (1:Ok, 0:Ko); %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERSensorState(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; cROVER tech; Sensor serial num; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechCROVERSensorSerialNum(idP, 3));
end

return
