% ------------------------------------------------------------------------------
% Print OPTODE sensor technical data in output CSV file.
%
% SYNTAX :
%  print_sensor_tech_data_in_csv_file_105_to_110_112_sbd2_OPTODE( ...
%    a_cycleNum, a_profNum, a_dataIndexList, ...
%    a_sensorTechOPTODE)
%
% INPUT PARAMETERS :
%   a_cycleNum         : cycle number of the packet
%   a_profNum          : profile number of the packet
%   a_dataIndex        : index of the packet
%   a_sensorTechOPTODE : OPTODE 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_105_to_110_112_sbd2_OPTODE( ...
   a_cycleNum, a_profNum, a_dataIndexList, ...
   a_sensorTechOPTODE)

% current float WMO number
global g_decArgo_floatNum;

% output CSV file Id
global g_decArgo_outputCsvFileId;

% unpack the input data
a_sensorTechOPTODENbPackDesc = a_sensorTechOPTODE{1};
a_sensorTechOPTODENbPackDrift = a_sensorTechOPTODE{2};
a_sensorTechOPTODENbPackAsc = a_sensorTechOPTODE{3};
a_sensorTechOPTODENbMeasDescZ1 = a_sensorTechOPTODE{4};
a_sensorTechOPTODENbMeasDescZ2 = a_sensorTechOPTODE{5};
a_sensorTechOPTODENbMeasDescZ3 = a_sensorTechOPTODE{6};
a_sensorTechOPTODENbMeasDescZ4 = a_sensorTechOPTODE{7};
a_sensorTechOPTODENbMeasDescZ5 = a_sensorTechOPTODE{8};
a_sensorTechOPTODENbMeasDrift = a_sensorTechOPTODE{9};
a_sensorTechOPTODENbMeasAscZ1 = a_sensorTechOPTODE{10};
a_sensorTechOPTODENbMeasAscZ2 = a_sensorTechOPTODE{11};
a_sensorTechOPTODENbMeasAscZ3 = a_sensorTechOPTODE{12};
a_sensorTechOPTODENbMeasAscZ4 = a_sensorTechOPTODE{13};
a_sensorTechOPTODENbMeasAscZ5 = a_sensorTechOPTODE{14};
a_sensorTechOPTODESensorState = a_sensorTechOPTODE{15};

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

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

   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb packets for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbPackDesc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb packets for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbPackDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb packets for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbPackAsc(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 1 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasDescZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 2 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasDescZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 3 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasDescZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 4 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasDescZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 5 for descent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasDescZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins for drift; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasDrift(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 1 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasAscZ1(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 2 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasAscZ2(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 3 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasAscZ3(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 4 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasAscZ4(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Nb bins in zone 5 for ascent; %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODENbMeasAscZ5(idP, 3));
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; OPTODE tech; Sensor state indicator (1:Ok, 0:Ko); %d\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      a_sensorTechOPTODESensorState(idP, 3));
end

return
