PRO header_gen, header

	header_sw_part1 = {            $
	 hdr_part1:0L                 ,$
	 hdr_part2:0L                 ,$
	 version:0L                   ,$
	 vuoto_10:0L                  ,$
	 block_header_size:0L         ,$
	 block_size:0L                ,$
	 skip_offset:0L               ,$
	 counter:0L                   ,$
	 batch_counter:0L             ,$
	 signal_counter:0L            ,$
	 timetag:0L                   ,$
	 reserved_0:0L                ,$
	 reserved_1:0L                ,$
	 reserved_2:0L                ,$
	 reserved_3:0L                ,$
	 chunk_info_size:0L           ,$
	 extra_info_size:0L            $
	}
;
	header_sw_chank = {         $
	 NOME_1:0L                 ,$
	 NOME_2:0L                 ,$
	 NOME_3:0L                 ,$
	 NOME_4:0L                 ,$
	 RESERVED:0L               ,$
	 NUMERO_DI_CHUNKS:0L       ,$
	 MARKER_ASCII_1:0L         ,$
	 MARKER_ASCII_2:0L         ,$
	 SIZE_META_INFORMATION:0L  ,$
	 RESERVED_5:0L             ,$
	 RESERVED_6:0L             ,$
	 RESERVED_7:0L             ,$
	 RESERVED_8:0L             ,$
	 CHUNK_SIZE:0L             ,$
	 vuoto_2:0L                ,$
	 TIPO_:0L                  ,$
	 vuoto_7:0L                $
	}
;
	header_data_info = {                $
     MARKER_DATI_1:0L              ,$
	 MARKER_DATI_2:0L              ,$
	 VECCHIO_HEADER_MARKER:0L          ,$
	 REV_id:0L                          ,$
	 HEADER_DIM:0L                      $
	}

	signal_descr= {               $
	 batch_counter:0L                   ,$
	 ttag:0L                            ,$
	 n_pri:0L               ,$
	 n_rbin:0L              ,$
	 		vuoto_0:0L                  ,$
		vuoto_1:0L                  ,$
		vuoto_20:0L                  ,$
		vuoto_30:0L                  ,$
		vuoto_40:0L                  ,$
		vuoto_50:0L                  ,$
		vuoto_60:0L                  ,$
		vuoto_70:0L                  ,$
		vuoto_80:0L                  ,$
		vuoto_90:0L                  ,$
		vuoto_11:0L                  ,$
		vuoto_12:0L                  ,$
		vuoto_13:0L                  ,$
		vuoto_14:0L                  ,$
		vuoto_15:0L                  ,$
		vuoto_16:0L                  ,$
		vuoto_17:0L                  ,$
		vuoto_18:0L                  ,$
		vuoto_19:0L                  ,$
		vuoto_21:0L                  ,$
		vuoto_22:0L                  ,$
		vuoto_23:0L                  $
	}


	header_sw = {        $
		header_sw_part1:header_sw_part1 ,$
		header_sw_chank:header_sw_chank  $
	}


	header_data = {                                  $
		header_data_info : header_data_info              ,$
		signal_descr :  signal_descr     $
	}

;	header = {             $
;		header_sw : header_sw, $
;		header_data : header_data        $
;	}

;	header = {            $
;	 hdr_part1:0L                 ,$
;	 hdr_part2:0L                 ,$
;	 version:0L                    ,$
;	 vuoto_10:0L                   ,$
;	 block_header_size:0L          ,$
;	 block_size:0L                 ,$
;	 skip_offset:0L                ,$
;	 counter:0L                    ,$
;	 batch_counter:0L              ,$
;	 signal_counter:0L             ,$
;	 timetag:0L                    ,$
;	 reserved_0:0L                 ,$
;	 reserved_1:0L                 ,$
;	 reserved_2:0L                 ,$
;	 reserved_3:0L                 ,$
;	 chunk_info_size:0L            ,$
;	 extra_info_size:0L            ,$
;	 NOME_1:0L                 ,$
;	 NOME_2:0L                 ,$
;	 NOME_3:0L                 ,$
;	 NOME_4:0L                 ,$
;	 RESERVED:0L               ,$
;	 NUMERO_DI_CHUNKS:0L       ,$
;	 MARKER_ASCII_1:0L         ,$
;	 MARKER_ASCII_2:0L         ,$
;	 SIZE_META_INFORMATION:0L  ,$
;	 RESERVED_5:0L             ,$
;	 RESERVED_6:0L             ,$
;	 RESERVED_7:0L             ,$
;	 RESERVED_8:0L             ,$
;	 CHUNK_SIZE:0L             ,$
;	 vuoto_2:0L                ,$
;	 TIPO_:0L                   ,$
;	 vuoto_7:0L                ,$
;	 MARKER_DATI_1:0L              ,$
;	 MARKER_DATI_2:0L              ,$
;	 VECCHIO_HEADER_MARKER:0L          ,$
;	 REV_id:0L                          ,$
;	 HEADER_DIM:0L                      ,$
;	 bacth_counter:0L                   ,$
;	 ttag:0L                            ,$
;	 packet_descr_npri:0L               ,$
;	 packet_descr_nrbin:0L               $
;	}

     header_info_t =                  $
    { $
    	MARKER_DATI_1:0L              ,$
      MARKER_DATI_2:0L              ,$                                $
    	header_marker : 0L,          $
    	rev_id : 0L,                 $
    	header_dim : 0L,             $
    	VUOTO : lonarr(10) $
    }
    
    PACKETDESCR_t = $
    { $
      NPRI : 0L ,$
      NRBIN : 0L ,$
      NUMOFCHANNELS : 0L ,$
      BLOCKDIMENSION : 0L ,$
      SIGNALORDERING : 0L  $
    }

    signal_descr_t =        $
    { $
    	batch_counter : 0L, $
    	ttag : 0L, $
      PACKETDESCR : PACKETDESCR_t ,$
    	PACKETLENGTH : 0L ,$
      NUMBEROFPACKETSIGNAL : 0L $
    }

    mode_descr_t = $
    { $
    	master_mode : 0L, $
    	operation_mode : 0L, $
    	standby : 0L, $
    	radiate : 0L, $
    	waveform : 0L, $
    	range_scale : 0L, $
    	scan_rate : 0L, $
    	dsp_mode_qualifier : 0L, $
    	VUOTO : lonarr(8) $
    }

    exp_settings_t = $
    { $
    	exp_mof : 0L, $
    	phase_rst_code : 0L, $
    	pulse_id : 0L, $
    	exp_f_base : 0L, $
    	exp_f_delta : 0L, $
    	pulse_len : 0L, $
    	amp_peak : 0L, $
    	pulse_id_2 : 0L, $
    	exp_f_base_2 : 0L, $
    	exp_f_delta_2 : 0L, $
    	pulse_len_2 : 0L, $
    	amp_peak_2 : 0L $
    }

    det_settings_t = $
    { $
    	det_mof : 0L, $
    	lpf7_filter_id : 0L, $
    	lpf8_filter_id : 0L, $
    	det_f_base : 0L, $
    	det_f_delta : 0L, $
    	ph_vector : 0L, $ //maybe a vector
    	pc_lsn_start : 0L, $
    	pc_lsn_len : 0L $
    }

    pc_settings_t = $
    { $
    	pc_mof : 0L, $
    	filt_id : 0L, $
    	pc_lsn_start : 0L, $
    	pc_lsn_len : 0L, $
    	pc_out_offset : 0L $
    }

    agc_settings_t = $
    { $
    	n_rbin : 0L, $
    	n_rbin_1 : 0L, $
    	mgc : 0., $
    	tgt_rgate : 0., $
    	unamb_tgt_range : 0L, $
    	init_rgate : 0L, $
    	app_wind_len : 0L, $
    	inu_valid : 0L, $
    	vmbc_inu : 0., $
    	vmbc_inu_der : 0., $
        tx_chan : 0L, $
    	prt : 0L, $
    	prt_1 : 0L, $
    	stc_profile_modif : 0L $
    }

    sp_settings_t = $
    { $
        exp_settings : exp_settings_t, $		;//## attribute exp_settings
        det_settings : det_settings_t , $		;//## attribute det_settings
        pc_settings : pc_settings_t, $		  ;//## attribute pc_settings
        agc_settings : agc_settings_t  $		;//## attribute agc_settings
    }

    mission_time_t = $
    { $
    	utc_time_1 : 0L, $
    	utc_time_2 : 0L, $
    	utc_time_3 : 0L, $
    	utc_time_4 : 0L, $
    	timetag : 0L $
    }

    nav_attitude_t = $
    { $
    	true_heading_rad : 0., $
    	pitch_rad : 0., $
    	roll_rad : 0., $
    	platfrom_azimuth_rad : 0., $
    	magnetic_heading_rad : 0. $
    }

    nav_attitude_rate_t = $
    { $
    	heading_rad_sec : 0., $
    	pitch_rad_sec : 0., $
    	roll_rad_sec : 0. $
    }

    nav_geo_pos_t = $
    { $
    	lat_rad : 0., $
    	lon_rad : 0., $
    	altitude_m : 0. $
    }

    nav_speed_t = $
    { $
    	north_m_s : 0., $
    	east_m_s : 0., $
    	down_m_s : 0., $
    	vx_ground : 0. $
    }

    nav_acceleration_t = $
    {  $
    	north_m_s2 : 0., $
    	east_m_s2 : 0., $
    	down_m_s2 : 0. $
    }

    navigation_t = $
    { $
    	time_tag : 0L, $
    	attitude: nav_attitude_t , $
    	attitude_rate: nav_attitude_rate_t, $
    	geo_pos: nav_geo_pos_t , $
    	speed : nav_speed_t , $
    	acceleration : nav_acceleration_t $
    }

    ant_pos_t = $
    { $
    	antttag : 0L, $
    	navaz_rad : 0., $
    	navel_rad : 0., $
    	bodyaz_rad : 0., $
    	bodyel_rad : 0., $
    	antennaaz_rad : 0., $
    	antennael_rad : 0., $
    	utx_rad : 0., $
    	vtx_rad : 0., $
    	urx_rad : 0., $
    	vrx_rad : 0., $
    	uguardrx_rad : 0., $
    	vguardrx_rad : 0., $
    	VUOTO : lonarr(4) $
    }
    
    
    ant_event_t = $
    { $
      frame_in_progress : 0L, $
      bar_in_progress : 0L, $
      number_of_bars : 0L, $
      current_bar_number : 0L, $
      VUOTO : lonarr(4) $
    }
    
    antenna_t = $
    { $
      position : ant_pos_t, $;   //## attribute position
      event : ant_event_t $;    //## attribute event
     }

    waveform_descriptor_t = $ 
    { $
      validity : 0L, $
      VUOTO : lonarr(8) $
    }

    general_settings_t = $
    { $
        missiontime : mission_time_t , $		//## attribute missiontime
        navigation : navigation_t, $		//## attribute navigation
        antenna : antenna_t, $		//## attribute antenna
        waveform_descriptor : waveform_descriptor_t $
    }

    nci_settings_t = $
    { $
        n_rbin : 0L, $		//## attribute n_rbin
        n_pulses : 0L, $		//## attribute n_pulses
        time_tag : 0L, $		//## attribute time_tag
        conv_fact : 0. $		//## attribute conv_fact
    }
    
    mtifft_settings_t = $
    { $
      TIMETAG : 0L        ,$
      N_RBIN : 0L              ,$
      N_PULSES : 0L            ,$
      N_INT : 0L               ,$
      NCLUTTER_REG : 0L       ,$
      PRT : 0L                ,$
      MTI_FILT_ID : 0L        ,$
      FFT_WINDOW_ID : 0L      ,$
      CONV_SCALE_FACTOR : 0.   $
    }
    
    HEADER_CFAR , cfar_settings_t, Cfar2dResults, Cfar2dParameters

;    CFAR_Sample_Support_t     =     $
;      {                   $
;      CFAR_Geometry_ID      : 0L,    $
;      CFAR_rng_dim        : 0L,    $
;      CFAR_rng_guard        : 0L,    $
;      CFAR_dop_dim        : 0L,    $
;      CFAR_dop_guard        : 0L,    $
;      Gradient          : 0L,    $
;      CFAR_ring         : 0L   $
;    }
;    
;    
;    CFAR_SENSING_t        =     $
;      {                   $
;      MIN_RBIN          : 0L,    $
;      MAX_RBIN          : 0L,    $
;      MIN_FILT          : 0L,    $
;      MAX_FILT          : 0L   $
;    }
;    
;    
;    COLLAPSING_t          =     $
;      {                   $
;      MAX_COLL_DET        : 0L,   $
;      COLL_MAX_RNG        : 0L,   $
;      COLL_MAX_DOP        : 0L    $
;    }
;
;
;    CFAR_SETTINGS_t     =             $
;      {                   $
;      N_RBIN              : 0L,                    $
;      N_FFT               : 0L,                     $
;      CFAR_START_FILT     : 0L,                         $
;      CFAR_STOP_FILT      : 0L,                        $
;      DOPPLER_NOTCH       : 0L,                         $
;      CFAR_Scheme         : 0L,               $
;      RBIN_Block_dim      : 0L,            $
;      CFAR_Sample_Support : CFAR_Sample_Support_t,       $
;      PFA                 : 0L,                   $
;      RS_INDEX            : 0L,                  $
;      CFAR_SENSING        : CFAR_SENSING_t,              $
;      NUM_SAT             : 0.0,                         $
;      SAT_VECTOR          : 0l, $ ;bytarr(2048),              $
;      BATCH_ID            : 0L,                         $
;      ANTENNA_AZ_NED      : 0.0,              $
;      COLLAPSING          : COLLAPSING_t,                $
;      Noise_Level         : 0.0,            $
;      GUARD_SWITCH_FLAG   : 0L  ,                      $
;      CFAR_2D_THR_OVR     : 0L  ,                      $
;      GRIFO_GAIN          : 0.0               $
;    }
    
    arf_settings_t = $
    { $
      N_RBIN : 0L ,$
      N_FFT : 0L $
    }
    
    slb_settings_t = $
    { $
      TIMETAG         :0L ,$
      SLOBE_BLANKING  :0L ,$
      SLBC            :0. ,$
      N_RBIN           :0L ,$
      N_FFT            :0L ,$
      GRIFO_GAIN      :0. ,$
      MAX_COLL_DET    :0L ,$
      COLL_MAX_RNG    :0L ,$
      COLL_MAX_DOP    :0L ,$
      CFAR_START_FILT :0L ,$
      DOPPLER_NOTCH   :0. ,$
      PRT             :0L  $
    }
    
    pe_settings_t = $
    { $
      TIMETAG                :0L ,$
      N_RBIN                 :0L ,$
      LRB                    :0. ,$
      PRT                    :0. ,$
      MLC_FREQ               :0. ,$
      CLOSE_PLOT_FLAG        :0L ,$
      TX_CHAN                :0L ,$
      ANT_AZ                 :0. ,$
      ANT_EL                 :0. ,$
      NAV_AZ                 :0. ,$
      NAV_EL                 :0. ,$
      YAW                    :0. ,$
      PITCH                  :0. ,$
      ROLL                   :0. ,$
      PLAT_AZ                :0. ,$
      PP_COAST_FLAG          :0L ,$
      PP_MPRF_LOOKUP         :0L ,$
      STT_RB_START           :0L ,$
      STT_RB_STOP            :0L ,$
      STT_FIL_START          :0L ,$
      STT_FIL_STOP           :0L ,$
      UNAMB_TGT_RANGE        :0L ,$
      UNAMB_TGT_DOPPLER      :0L ,$
      FM_SLOPE               :0L ,$
      RB_START               :0L ,$
      RB_STOP                :0L ,$
      FIL_START              :0L ,$
      FIL_STOP               :0L ,$
      SDR_BEFORE_COAST       :0L ,$
      PRF_SET                :0L ,$
      PRF_NUMBER             :0L ,$
      MTG                    :0L ,$
      SPUR_NUM               :0L ,$
      DELSIGN                :0L ,$
      JAM_THRESH             :0L ,$
      CUT_OFF_VEL            :0L ,$
      BATCH_END              :0L ,$
      SPUR_FREQ              :0L ,$
      FILTERED_ERR_VEL_CLUTT :0L ,$
      FLW_RANGE_START        :0L ,$
      FLW_RANGE_STOP         :0L ,$
      FLW_DOPPLER_START      :0L ,$
      FLW_DOPPLER_STOP       :0L ,$
      DESENSITISATION        :0L ,$
      BATCH_AZIM_ANGLE       :0L ,$
      BATCH_COUNT            :0L ,$
      BATCH_DUR              :0L ,$
      AGR_WINDOW_CENTER      :0L ,$
      AGR_WINDOW_LENGTH      :0L ,$
      NGT_ENABLE             :0L ,$
      MTI_CODE               :0L ,$
      MBC_DOP_INDEX          :0L ,$
      STT_TRANSITION_STATUS  :0L ,$
      TRACKED_TGT_AMPLITUDE  :0L ,$
      ALE_BLANKING_ENABLE    :0L ,$
      ALE_RANGE_ESTIMATE     :0L ,$
      ALE_BLK_START          :0L ,$
      ALE_BLK_STOP           :0L ,$
      ALE_TRK_START          :0L ,$
      ALE_TRK_STOP           :0L ,$
      BARO_ALT               :0L ,$
      BARO_ALT_VALIDITY      :0. ,$
      Z_VELOCITY             :0L ,$
      AGC_GAIN               :0L ,$
      MGC                    :0L ,$
      EXPAND                 :0L ,$
      tx_chan_mhz            :0L ,$
      lrb_meters             :0. ,$
      VUOTO                 :LONARR(16) $
    }
    
    sc_settings_t =  $  ;//Scan Converter Settings
    { $
      ant_nav_direction : 0L, $;  //-1: decress, +1: increase (0: inversion). Can be directly deduced from the bar_number
      ant_current_bar_number : 0L, $;
      ant_nav_scan_center : 0L, $
      ant_nav_left_scan_limit : 0L, $;  //ant_scan_center+half_width
      ant_nav_right_scan_limit : 0L, $; //ant_scan_center-half_width

      rbm_white_level : 0L, $;   //mex max while level value for linear conversion of signal level to grey level (0=auto)

      map_comp_vx : 0L, $;  //Map motion compensation VX (navigation, ms)
      map_comp_vy : 0L, $;  //Map motion compensation VY (navigation, ms)
      VUOTO  : lonarr(8) $;  //please, fill with zero
    }

    dbs_pe_settings_t = $
    { $
      dbs_flush_flag : 0L, $;
      int_rbin_offset : 0L, $; //Integration rbin offset
      skip_processing : 0L, $
      VUOTO : lonarr(8) $
    }


    function_settings_t = $
    { $
        nci_settings : nci_settings_t ,$		;//## attribute nci_settings
        mtifft_settings : mtifft_settings_t ,$		;//## attribute mtifft_settings
        cfar_settings : cfar_settings_t ,$		;//## attribute cfar_settings
        arf_settings : arf_settings_t ,$		;//## attribute arf_settings
        slb_settings : slb_settings_t ,$		;//## attribute slb_settings
        pe_settings : pe_settings_t  ,$		;//## attribute pe_settings
        sc_settings : sc_settings_t ,$
        dbs_pe_settings : dbs_pe_settings_t $
    }

    ge_header_t = $
    { $
        header_info : header_info_t , $		;//## attribute header_info
        signal_descr : signal_descr_t , $		;//## attribute signal
        mode : mode_descr_t , $		;//## attribute mode
        sp_settings : sp_settings_t , $		;//## attribute sp_settings
        general_settings : general_settings_t , $		;//## attribute general_settings
        function_settings : function_settings_t  $		;//## attribute function_settings
    }

	header = {             $
		header_sw : header_sw, $
		header_data : ge_header_t        $
	}

END


