/***************************************************************************
                     FILE INFORMATION HEADER
                     -----------------------

    a.  PROJECT NAME:           GRIFO_S7  P2813
    b.  ITEM TYPE               header
    c.  ITEM NAME:              intf_types.h
    d.  ITEM REFERENCE:
    e.  CURRENT VERSION:        1.2
    f.  DATE:                   9/16/99
    g.  SOURCE FILE LOCATION:   /sparc-2/library/sr3b_end/dati/common/mode_cmn/s.intf_types.h
    h.  'C' RELEASE:            2.11
    i.  ITEM DESCRIPTION:
          This contains types which are local to the interference_analysis
          modules.
    j.  DOCUMENTATION REFERENCES:
          Tracker Computer SDD for Software Release 2.
    k.  PROGRAMMER NAME(S):     S. Curtis
    l.  COPYRIGHT:              FIAR
    m.  REVISION HISTORY:    07-11-01 - Baseline copied from 3B.86 R3K Metis radar version
    2.1 94/04/15 22:04:02 stuart
        date and time created 94/04/15 22:04:02 by stuart



 ***************************************************************************/

#ifndef intf_types_defined
//## attribute ::types_reverse::TopLevel.intf_types_defined
const RhpString intf_types_defined(0);

//## dependency datatypes
#include "datatypes.h"
namespace legacy
{
    // * Interference Analysis datatypes. *
    //#[ type pp_intf_data_t
    typedef struct {
      pfa_measure_t       pfa_measure;
      cfar_sensing_t      cfar_sensing;
      jamming_status_t    jam_flag;
      timetag_t           processed_pck_timetag;
      waveform_t          pp_waveform_tellback;
      processing_status_t pp_processing_status_tellback;
      range_scale_t       pp_range_scale_tellback;
      boolean             detected_in_lookup;
      unsigned int        proc_nfft;
      } pp_intf_data_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.NO_INTF_SAMPLES
const RhpString NO_INTF_SAMPLES(10);

namespace legacy
{
    //#[ type sp_intf_data_t
    typedef struct {
      processing_status_t    sp_processing_status_tellback;
      waveform_t             sp_waveform_tellback;
      range_scale_t          sp_range_scale_tellback;
      sniff_channel_group_t  sniff_channel_group_tellback;
      decibel_t              intf_samples[NO_INTF_SAMPLES];
      freq_channel_t         last_tx_channel;
      } sp_intf_data_t;
    //#]
    
    //#[ type interference_dsp_results_t
    typedef struct {
      pp_intf_data_t  pp_intf_data;
      sp_intf_data_t  sp_intf_data;
      } interference_dsp_results_t;
    //#]
    
    //#[ type jammer_class_t
    typedef enum {
      non_counteractable,
      counteractable
      }  jammer_class_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.JAMMER_CLASS_T_MIN
const RhpString JAMMER_CLASS_T_MIN(non_counteractable);

//## attribute ::types_reverse::TopLevel.JAMMER_CLASS_T_MAX
const RhpString JAMMER_CLASS_T_MAX(counteractable);

namespace legacy
{
    //#[ type jammer_level_t
    typedef enum {
      not_jammed,
      jam_1,
      jam_2,
      jam_3
      }  jammer_level_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.JAMMER_LEVEL_T_MIN
const RhpString JAMMER_LEVEL_T_MIN(not_jammed);

//## attribute ::types_reverse::TopLevel.JAMMER_LEVEL_T_MAX
const RhpString JAMMER_LEVEL_T_MAX(jam_3);

namespace legacy
{
    //#[ type jammer_source_t
    typedef enum {
      cfar_jammer,
      sniff_jammer,
      pfa_jammer
      }  jammer_source_t;
    //#]
}

//## attribute ::types_reverse::TopLevel.JAMMER_SOURCE_T_MIN
const RhpString JAMMER_SOURCE_T_MIN(cfar_jammer);

//## attribute ::types_reverse::TopLevel.JAMMER_SOURCE_T_MAX
const RhpString JAMMER_SOURCE_T_MAX(pfa_jammer);

namespace legacy
{
    //#[ type jammer_bandwidth_t
    typedef struct {
      freq_channel_t	low_rf_channel;
      freq_channel_t	high_rf_channel;
      } jammer_bandwidth_t;
    //#]
    
    //#[ type jammer_detection_t
    typedef struct {
      timetag_t		timetag;
      jammer_level_t	power_level;
      union {
    	  struct
    	    {
    	      int	null;
    	    } not_jammed;
    	  struct
    	    {
    	      jammer_source_t	  source;
                  jamming_status_t    jammer_on_beam;
    /* Grifo-e */
                  jammer_class_t	  jam_class;
                  //jammer_class_t	  class;
    /* Grifo-e */
                  decibel_t		  power_from_sensor;
    	      jammer_bandwidth_t  bandwidth;
    	    } jammed;
            } data;
      } jammer_detection_t;
    //#]
    
    // NOTE: this type will be deleted, as replaced by tx_channel_jammed_status_t
    // type yet available in tx_channel_jammed_status.h 
    //#[ type jammer_status_t
    typedef struct {
                     jammer_level_t  jammer_level;
                     decibel_t       intf_value;
                   } jammer_status_t;
    //#]
    
    // *** DOJ mode Structure ***
    //#[ type doj_op_mode_t
    typedef enum {
      doj_off,
      doj_search,
      doj_acquisition
      }  doj_op_mode_t;
    //#]
    
    //#[ type doj_mode_t
    typedef struct {
      doj_op_mode_t		doj_op_mode;
      antenna_mode_t	scan_type;
      pos_type_t		scan_stab;
      az_el_t           des_jammer_position;
      } doj_mode_t;
    //#]
    
    // *** Jammer Map Window Structure ***
    //## type num_of_jammer_map_entries_t
    typedef unsigned int num_of_jammer_map_entries_t;
}

//## attribute ::types_reverse::TopLevel.NUM_OF_JAMMER_MAP_ENTRIES_T_MIN
const RhpString NUM_OF_JAMMER_MAP_ENTRIES_T_MIN(0);

//## attribute ::types_reverse::TopLevel.NUM_OF_JAMMER_MAP_ENTRIES_T_MAX
const RhpString NUM_OF_JAMMER_MAP_ENTRIES_T_MAX(MAX_UNSIGNED_INT);

namespace legacy
{
    //## type jammer_window_ptr_t
    typedef unsigned int jammer_window_ptr_t;
}

//## attribute ::types_reverse::TopLevel.JAMMER_WINDOW_PTR_T_MIN
const RhpString JAMMER_WINDOW_PTR_T_MIN(0);

//## attribute ::types_reverse::TopLevel.JAMMER_WINDOW_PTR_T_MAX
const RhpString JAMMER_WINDOW_PTR_T_MAX(7);

//#[ type NUM_WINDOW_ENTRIES
#define NUM_WINDOW_ENTRIES ARRAY_RANGE( JAMMER_WINDOW_PTR_T_MIN, \
                                        JAMMER_WINDOW_PTR_T_MAX )
//#]

namespace legacy
{
    //#[ type jammer_map_window_t
    typedef struct {
      num_of_jammer_map_entries_t  num_of_jammer_map_entries;
      jammer_window_ptr_t          window_start_entry;
      jammer_window_ptr_t          window_middle_entry;
      jammer_window_ptr_t          window_end_entry;
      jammer_detection_t           jammer_map_entries[ NUM_WINDOW_ENTRIES ];
    
      } jammer_map_window_t;
    //#]
    
    // ***** Soft Jammer Structure ****
    //#[ type power_distribution_t
    typedef struct {
      az_el_t	start;
      az_el_t	end;
      } power_distribution_t;
    //#]
    
    //#[ type jammer_position_t
    typedef struct {
      power_distribution_t	power_distribution
                              [ ARRAY_RANGE( jam_1, JAMMER_LEVEL_T_MAX ) ];
      } jammer_position_t;
    //#]
    
    //#[ type jammer_power_sum_t
    typedef struct {
      int		num_samples;
      decibel_t	power_from_sensor;
      float		weighted_timetag_offset;
      } jammer_power_sum_t;
    //#]
    
    //#[ type soft_jammer_t
    typedef struct {
      timetag_t		timetag;
      jammer_level_t	power_level;
      jammer_level_t	max_power_level;
      jammer_position_t	position;
      int			num_non_count;
      int			num_total_samples;
      jammer_bandwidth_t  	bandwidth;
      timetag_t     	base_timetag;
      jammer_power_sum_t	cfar_power_sums;
      } soft_jammer_t;
    //#]
}

/****** Jammer Map History Structure *****/

//## attribute ::types_reverse::TopLevel.JAMMER_MAP_HISTORY_SIZE
const RhpString JAMMER_MAP_HISTORY_SIZE(10);

namespace legacy
{
    //#[ type jammer_centroid_t
    typedef struct {
      validity_t            validity;
      timetag_t		timetag;
      az_el_t               position;
      } jammer_centroid_t;
    //#]
    
    //#[ type hard_jammer_t
    typedef struct {
      jammer_level_t	power_level;
    /* Grifo-e */
      jammer_class_t	jam_class;
      //jammer_class_t	class;
    /* Grifo-e */
      jammer_centroid_t     centroid;
      jammer_position_t	position;
      jammer_bandwidth_t  	bandwidth;
      decibel_t		power_from_sensor;
      } hard_jammer_t;
    //#]
    
    //#[ type jammer_map_history_t
    typedef struct {
      int		 num_hard_jammers;
      int            next_available;
      hard_jammer_t	 hard_jammers[JAMMER_MAP_HISTORY_SIZE];
      } jammer_map_history_t;
    //#]
}

/****** DOJ Results Structure ******/

//## attribute ::types_reverse::TopLevel.DOJ_RESULTS_SIZE
const RhpString DOJ_RESULTS_SIZE(5);

namespace legacy
{
    //#[ type doj_results_t
    typedef struct {
      int		num_hard_jammers;
      hard_jammer_t	hard_jammers[DOJ_RESULTS_SIZE];
      } doj_results_t;
    //#]
    
    // ***** Acquired Jammer Results Structure *****
    //#[ type acquired_jammer_t
    typedef struct {
      boolean	found;
      timetag_t	timetag;
      az_el_t	centroid;
      az_el_t	variance;
      } acquired_jammer_t;
    //#]
}

#endif
