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

% current float WMO number
global g_decArgo_floatNum;

% output CSV file Id
global g_decArgo_outputCsvFileId;

fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; Packet time; %s\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   julian_2_gregorian_dec_argo(a_floatProgParam(a_dataIndex, 1)));
fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; Cycle #; %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 2));
fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; Profile #; %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 3));

fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV0 - Number of different cycle durations (1 to 5); %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 4));
fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV1 - Iridium EOL period (min); %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 5));
fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV2 - Waiting time between the 2 Iridium sessions (set to 0 if no second session) (min); %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 6));

for id = 1:5
   info = [];
   if (id > a_floatProgParam(a_dataIndex, 4))
      info = 'DO NOT CONSIDER';
      break
   end
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV%d - Cycle duration #%d (hour); %d; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      2*(id-1)+3, id, ...
      a_floatProgParam(a_dataIndex, 4*(id-1)+7), ...
      info);
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV%d - End date for cycle duration #%d (dd/mm/yy); %s; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      2*(id-1)+4, id, ...
      sprintf('%02d/%02d/%02d', ...
      a_floatProgParam(a_dataIndex, 4*(id-1)+8), ...
      a_floatProgParam(a_dataIndex, 4*(id-1)+9), ...
      a_floatProgParam(a_dataIndex, 4*(id-1)+10)), ...
      info);
end

fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM0 - Number of requested profiles; %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 27));
fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM1 - Delay before mission; %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 28));
fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM2 - Reference day (mission day of 1st surfacing for 1st cycle after deployment); %d\n', ...
   g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
   a_floatProgParam(a_dataIndex, 29));

for id = 1:10
   info = [];
   if (id > a_floatProgParam(a_dataIndex, 27))
      info = 'DO NOT CONSIDER';
      break
   end
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Day of profile #%d surfacing (mission day); %d; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      5*(id-1)+3, id, ...
      a_floatProgParam(a_dataIndex, 5*(id-1)+30), ...
      info);
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Expected hour of profile #%d surfacing; %d; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      5*(id-1)+4, id, ...
      a_floatProgParam(a_dataIndex, 5*(id-1)+31), ...
      info);
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Parking depth #%d (dbar); %d; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      5*(id-1)+5, id, ...
      a_floatProgParam(a_dataIndex, 5*(id-1)+32), ...
      info);
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Profile depth #%d (dbar); %d; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      5*(id-1)+6, id, ...
      a_floatProgParam(a_dataIndex, 5*(id-1)+33), ...
      info);
   fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Transmission after profile (0=N, 1=Y) #%d; %d; %s\n', ...
      g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
      5*(id-1)+7, id, ...
      a_floatProgParam(a_dataIndex, 5*(id-1)+34), ...
      info);
end
   
return

% function print_float_prog_param_data_in_csv_file_cts4_105_to_110_112_one( ...
%    a_cycleNum, a_profNum, a_dataIndex, ...
%    a_floatProgParam)
% 
% % current float WMO number
% global g_decArgo_floatNum;
% 
% % output CSV file Id
% global g_decArgo_outputCsvFileId;
% 
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; Packet time; %s\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    julian_2_gregorian_dec_argo(a_floatProgParam(a_dataIndex, 1)));
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; Cycle #; %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 2));
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; Profile #; %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 3));
% 
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV0 - Nombre de cycles différents (de 1 à 5); %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 4));
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV1 - Période fin de vie Iridium (min); %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 5));
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV2 - Attente inter-cycles (min); %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 6));
% 
% for id = 1:5
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV%d - Durée de cycle %d (h); %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       2*(id-1)+3, id, ...
%       a_floatProgParam(a_dataIndex, 2*(id-1)+7));
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PV%d - Date de fin pour durée %d; %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       2*(id-1)+4, id, ...
%       a_floatProgParam(a_dataIndex, 2*(id-1)+8));
% end
% 
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM0 - Nombre de profils programmés; %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 17));
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM1 - Délai avant mission; %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 18));
% fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM2 - Jour de référence profil (jour de delta/mise à l''eau); %d\n', ...
%    g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%    a_floatProgParam(a_dataIndex, 19));
% 
% for id = 1:10
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Jour associé à la présence #%d en surface; %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       5*(id-1)+3, id, ...
%       a_floatProgParam(a_dataIndex, 5*(id-1)+20));
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Heure de la présence #%d en surface (local time); %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       5*(id-1)+4, id, ...
%       a_floatProgParam(a_dataIndex, 5*(id-1)+21));
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Profondeur de dérive #%d (dbar); %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       5*(id-1)+5, id, ...
%       a_floatProgParam(a_dataIndex, 5*(id-1)+22));
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Profondeur de début de profil #%d (dbar); %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       5*(id-1)+6, id, ...
%       a_floatProgParam(a_dataIndex, 5*(id-1)+23));
%    fprintf(g_decArgo_outputCsvFileId, '%d; %d; %d; %s; float prog param; PM%d - Transmission #%d; %d\n', ...
%       g_decArgo_floatNum, a_cycleNum, a_profNum, get_phase_name(-1), ...
%       5*(id-1)+7, id, ...
%       a_floatProgParam(a_dataIndex, 5*(id-1)+24));
% end
%    
% return
