/* **********************************************************************
 * *	                                                                *
 * *       Structures to Hold User-Adjustable Set-Up Information        *
 * *                                                                    *
 * ********************************************************************** 
 * File: include/setup.h
 *
 *       COPYRIGHT (c) 1991, 1993, 1995, 1996, 1997, 1998, 1999,
 *               2000, 2001, 2002, 2003, 2004, 2006 BY
 *             VAISALA INC., WESTFORD MASSACHUSETTS, U.S.A. 
 * 
 * THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND  COPIED
 * ONLY  IN  ACCORDANCE WITH  THE  TERMS  OF  SUCH  LICENSE  AND WITH THE
 * INCLUSION OF THE ABOVE COPYRIGHT NOTICE.  THIS SOFTWARE  OR  ANY OTHER
 * COPIES  THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY
 * OTHER PERSON.  NO TITLE TO AND OWNERSHIP OF  THE  SOFTWARE  IS  HEREBY
 * TRANSFERED. 
 *
 */
#ifndef SIGMET_SETUP_H
#define SIGMET_SETUP_H 1

#ifdef __cplusplus
extern "C" {
#endif

/* Structures defining information about devices.  The device type and unit
 * number are defined for all devices; optional unioned data is available
 * for those devices that need it.
 */

#define WINDOW_MAX_WIDTH  (1500)
#define WINDOW_MAX_HEIGHT (1100)

#define WINDOW_MIN_WIDTH  (240)
#define WINDOW_MIN_HEIGHT (240)

#define ARCHIVE_TAPE (1)
#define ARCHIVE_MO   (2)
#define ARCHIVE_LDA  (3)
#define ARCHIVE_DVD  (4)
  /* Types of file systems to create on the modisk */
#define ARCHIVE_MO_HPHFS  (0)
#define ARCHIVE_MO_HPVXFS (1)

struct tape_device	/* Definitions for Tape device */
{
  char  sdevice[24];            /* Device file */
} ;
struct mo_device	/* Definitions for MO device */
{
  char  sMountPoint[24];        /* Mount point */
  char  sdevice[24];            /* Device file */
  char  sdevice_raw[24];        /* Raw device file */
  UINT1 iFsType;                /* File system type for HP platforms */
  char  pad73x3[3] ;
} ;
struct lda_device	/* Definitions for LDA device */
{
  char  sDirectory[DIRECTORY_SIZE];         /* Directory to use */
  char  pad_end[3];
} ;

struct dvd_device	/* Definitions for DVD device */
{
  char  sMountPoint[24];        /* Mount point */
  char  sdevice[24];            /* Device file */
  UINT4 iBufSize;               /* iBufSize in MB before writting to DVD */
} ;

union archive_specific_info {    /* union, size 92 bytes each */
  struct tape_device Tape;
  struct mo_device   Mo;
  struct lda_device  Lda;
  struct dvd_device  Dvd;
} ;

  /* archive_device structure is 96 bytes long */
struct archive_device		/* Definitions for ARCHIVE device */
{
  UINT1 isub_type ;		/* Type of archive */
  char  pad1x3[3] ;
  union archive_specific_info asi;
} ;

#define LINK_TYPE_HKO  (1)
#define LINK_TYPE_AWS  (2)
struct link_device {		/* Definitions for LINK device */
  SINT2 iwidth ;		/* Width of image */
  SINT2 iheight ;		/* Height of image */
  UINT1 isub_type;              /* Type of link */
  char  pad5x3[3];
  char sdevice[24];             /* Name of device */
} ;

struct printer_device {		/* Definitions for PRINTER device */
  SINT2 iwidth ;		/* Width of image */
  SINT2 iheight ;		/* Height of image */
  UINT1 iPaperSize;             /* Size of paper, choices in printer_lib.h */
  char  pad5x3[3];
  char  squeue[24];
} ;

#define MAX_LOOP_COUNT  (300)
#define MAX_VISUAL_DEPTH (24)
struct window_device {		/* Definitions for WINDOW device */
  SINT2 iwidth ;                /* Initial size of window */
  SINT2 iheight ;
  SINT2 ixpos;                  /* Initial position of window */
  SINT2 iypos;
  SINT2 imoviecnt ;		/* Allocation for movie frames */
#define WINDOW_TOOLS_OFF (0)
#define WINDOW_TOOLS_ON  (1)
  UINT1 iToolState ;
  char  pad11x1 ;
  char  sdisplay[24] ;
} ;

#define SIG_HOSTNAME_SIZE  (48)
struct network_device	/* Definitions for NETWORK device */
{	
  SINT2 iwidth ;      
  SINT2 iheight ;		/* Default size of TIFF image */
#define NET_FILE_IRIS    (1)
#define NET_FILE_NORDRAD (2)
#define NET_FILE_TIFF    (3)
#define NET_FILE_LINK    (4)	/*HKRO link format */
#define NET_FILE_NONE    (5)	/*File is not copied */
#define NET_FILE_HEADER  (6)	/*Just IRIS header is copied */
#define NET_FILE_GIF     (7)            
#define NET_FILE_BMP     (8)            
#define NET_FILE_PS      (9)
#define NET_FILE_JPEG    (10)
#define NET_FILE_PIPE    (11)
#define NET_FILE_COUNT   (11)	/*Number of different file formats*/
  UINT1 ifile_format;		/* Format of file data */

#define NET_NAME_NATIVE   (1)	/* Native naming conventions */
#define NET_NAME_8P3      (2)	/* <12 char node.NNN format */
#define NET_NAME_DEFAULT  (3)	/* nodeYYMMDDHHMMSS.PPPNNNN format */
#define NET_NAME_METPS    (4)	/* Hong Kong METPS 8 char XXYMDHMS format propriatory */
#define NET_NAME_ORIGINAL (5)	/* Original filename */
#define NET_NAME_IIA      (6)	/* Korea IIA propriatory format */
#define NET_NAME_COUNT    (6)	/* Number of different file name formats */
  UINT1 iname_format;		/* Format of file name */
#define NET_COMPRESS_NONE     (0)
#define NET_COMPRESS_COMPRESS (1)
#define NET_COMPRESS_GZIP     (2)
#define NET_COMPRESS_TIFFPACK (3)  /* TIFF PACKBITS compression */
#define NET_COMPRESS_MAXVALUE (3)  /* Maximum value allowed here */
  UINT1 iCompress;              /* Compression format */

/*#define NET_NOTIFY_DECNET  (1)*/           /*Use DECNET handshaking */
#define NET_NOTIFY_NONE    (2)	/*Use no handshaking */
#define NET_NOTIFY_NORDRAD (3)	/*File goes to NORDRAD using StoreProduct */
#define NET_NOTIFY_TCPIP   (4)	/*Use TCP/IP socket, AF_INET */
#define NET_NOTIFY_RENAME  (5)	/*Use file renaming so receiver gets a full file */
#define NET_NOTIFY_UNIX    (6)	/*Use TCP/IP socket, AF_UNIX */
  UINT1 inotify_scheme;         /* Notification scheme */
  UINT4 itcpip_port;            /* Port number if TCP/IP notification */
  char  snode_name[SIG_HOSTNAME_SIZE]; /* Remote host name. */
#define NET_COPY_NONE    (0)    /*Do not copy file*/
#define NET_COPY_COPY    (1)    /*Use software copying*/
#define NET_COPY_RCP     (2)    /*Use rcp shell command*/
#define NET_COPY_SCRIPT  (3)    /*Use script program*/
#define NET_COPY_SCP     (4)    /*Use scp shell command  */
  UINT1 icopy_scheme;
  char  sdirectory[DIRECTORY_SIZE]; /* Directory to copy to */
  /* Same options as input command line syntax */
  UINT1 iCommandLineSyntax;     /* Type of pipe command line arguments */
  char  pad_143;
  char  sPipeName[16];          /* Name of convert pipe to envoke */
  char  sScriptName[16];        /* Name of copy script to envoke */
  char  sUserName[16];          /* User name on remote system */
  char  sPassword[16];          /* Password on remote system */
} ;

union device_specific_info {    /* Overall union, size 96 bytes each */
  struct    link_device link   ;
  struct  window_device window ;
  struct network_device network;
  struct archive_device archive;
  struct printer_device printer;
} ;

struct device_def
{
  UINT1 idev_type;
#define IDEVTYPE_MINVALUE  (2)
#define IDEVTYPE_PRINTER   (2)
#define IDEVTYPE_WINDOW    (3)
#define IDEVTYPE_UNUSED    (4)
#define IDEVTYPE_ARCHIVE   (6)
#define IDEVTYPE_NETWORK   (7)
#define IDEVTYPE_LINK      (9)
#define IDEVTYPE_MAXVALUE  (9)

  SINT1 iunit_num;
#define MAX_ARCHIVE_LIMIT (8)  /* Upper bound */
  UINT2 iskip_time;   /* In seconds */
  char  salias[16];

  union device_specific_info dsi ;
};

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - */

/* Structure defining the RCP bits
 */
struct rcp_bit_def     /* Definitions for rcp control bit */
{
  UINT1 lenabled;
  UINT1 lhigh;
  UINT1 linitial_high;
  char  pad3x1[1] ;
};
struct rcp_status_def  /* Definitions for rcp status bit */
{
  UINT1 lenabled;
  UINT1 lhigh;
  UINT1 lCritical;     /* Fault is critical */
  char  pad3x1[1] ;
};

/* =======================================================================
 *                        Antenna Configuration
 * =======================================================================
 * This holds configuration information about the antenna(s).  This does
 * not include geometric information that is used for calibration, such as
 * beam width.  
 */
struct ant_manual_setup
{
  char sVersion[8] ;		/* IRIS version when saved */

  UINT1 lAntAvailable;          /* Flag indicates that system has an antenna */
  UINT1 iInterfaceType;		/* Interface type (ANTIFACE_* from antenna_lib.h) */
  UINT1 lControllingHost;	/* This is a controlling host */

  UINT1 lLogToFile ;		/* Antenna driver makes log files */
  UINT1 lLogPacketsAnt ;	/*   Log incoming antenna packets */
  UINT1 lLogPacketsBITE ;	/*   Log incoming BITE packets */
  UINT1 lLogPacketsTime ;	/*   Log incoming TIME packets */
  UINT1 lLogPacketsErr ;	/*   Log incoming unrecognized packets */
  UINT1 lLogDataAnt ;		/*   Log AZ/EL data insertions */
  UINT1 lLogDataINU ;		/*   Log INU data insertions */
  char pad18x2[2] ;
  SINT4 iLogDaysKept ;		/*   Number of days of logs to keep */

  /* Storage for AntExport info only
   */
  UINT4 iAntExportPortNum ;	/*   Socket port number on remote machine */
  char  sAntExportHost[40] ;	/*   IP address / Node name */

  /* The mimimum and maximum elevation angles allowed, in binary angles
   */
  SINT2 ielmin;  /* Signed number to make setup_limits work */
  BIN2  ielmax;  /* Unsigned number to make setup_limits work */

  /*The maximum velocity in azimuth and elevation, degrees/second
   */
  FLT4 fazvelmax, felvelmax;

  /* The latitude and longitude of the antenna itself, as 32-bit binary
   * angle.
   */
  UINT4 ilat, ilon;

  /* Height of ground relative to sea level in meters and height of
   * antenna platform above the ground in meters.
   */
  SINT2 ignd_hgt;
  SINT2 irad_hgt;

  /* Format of antenna control interface, see antenna_lib.h for options
   */
  UINT2 icontrol_format;

  /* Format of antenna status interface, see antenna_lib.h for options
   */
  UINT2 istatus_format;

  /* How long to continue to toggle the Radiate if it does not work, in seconds.
   */
  UINT4 itoggle_time;

  /* How long the radiate is off when we toggle.
   */
  FLT4 fRadiateTogglePeriod;

  /* Offset between the INU reported altitude, and its actual altitude
   * in cm.  This is used for systems which do not report altitude.
   */
  SINT4 inu_height_offset;

  /* Distance in cm between the INU location and the antenna.  This is
   * only used for moving platforms, and the three directions are
   * forward, to port, and up.
   */
  SINT4 iplatform_offset[3];

  /* Time radar requires noise source on
   */
  FLT4 fnoise_toggle_time;

  /* The maximum value available from the signal generator in dBm.
   * This value corresponds to a zero in the data format.
   */
  SINT4 isiggen_max;

  /* The minimum value available from the signal generator in dBm
   */
  SINT4 isiggen_min;

  /* Time required to warm up the signal generator after it is turned
   * on.
   */
  FLT4 fsiggen_warmup;

  /* Time required after signal generator value is changed before
   * level OK
   */
  FLT4 fsiggen_settle;

  UINT4 iazmode_initial;	/* Initial azimuth mode */
  UINT4 ielmode_initial;	/* Initial elevation mode */

  UINT2 iazpos_initial;		/* Initial azimuth position */
  UINT2 ielpos_initial;		/* Initial elevation position */

  FLT4 fazv_initial;		/* Initial azimuth velocity */
  FLT4 felv_initial;		/* Initial elevation velocity */

  SINT4 isiggen_value_initial;  /* Initial signal generator value */

  /* Sub Process Priorities
   */
  SINT2 ipri_antrcv, ipri_antxmt ;

  /* Second process formats
   */
  UINT2 icontrol2_format;
  UINT2 istatus2_format;

  /* Device names and TTY parameters for the two channels.
   */
  char schannel1[PATHNAME_SIZE]; /* Serial device, or network IP address */
  char schannel2[PATHNAME_SIZE];
  char sNetInterface1[16];       /* Network interface used for channel 1 */
  SINT4 iBaudRate1, iBaudRate2 ; /* Numerical baud rate or port number */
  UINT1 iParity1  , iParity2   ; /* One of TTYPARITY_xxx */
  UINT2 iNetDelayMs;             /* Average network delay in ms */

  UINT1 lStartSimulator;        /* Automatically start simulator at init time */

  UINT1 lUseTimeStamp ;		/* Use time stamps on received data */

  UINT1 iAngleSource ;		/* Where antenna angles come from */
#define ANTANGSRC_NORMAL    0	/*   Standard ANT_RCV interface */
#define ANTANGSRC_RCP       1	/*   Embedded RCP */
#define ANTANGSRC_RVP       2	/*   Embedded RVP */

  char pad523x1[1] ;

/* -------------------------------------------------- */

  /* Servo power control
   */
  struct rcp_bit_def cont_servo_power;

  /* T/R power control
   */
  struct rcp_bit_def cont_tr_power;

  /* Radiate control
   */
  struct rcp_bit_def cont_radiate;

  /* Reset antenna controller
   */
  struct rcp_bit_def cont_reset;

  /* Control the noise source
   */
  struct rcp_bit_def cont_noise;

  /* Control the signal generator
   */
  struct rcp_bit_def cont_siggen;

  /* Control whether the signal generator is in pulse or CW mode
   */
  struct rcp_bit_def cont_sigcw;
 
  /* Control the pulse width, only valid field used
   */
  struct rcp_bit_def cont_pwbw;
 
  /* Control the pulse width unchanged bit
   */
  struct rcp_bit_def cont_pw_unset;
 
  /* Control the polarization, only valid field used
   */
  struct rcp_bit_def cont_polar;
 
  /* Report the network status to the RCP
   */
  struct rcp_bit_def cont_nst;

  /* -------------------------------------------------- */

  /* Low airflow sensor
   */
  struct rcp_status_def status_low_airflow;

  /* Low waveguide pressure sensor
   */
  struct rcp_status_def status_low_wgp;

  /* Interlock open sensor
   */
  struct rcp_status_def status_interlock_open;

  /* Standby mode sensor
   */
  struct rcp_status_def status_standby;

  /* Radiate sensor
   */
  struct rcp_status_def status_radiate;

  /* Bad magnitron current sensor
   */
  struct rcp_status_def status_mag_current;

  /* RCP is in local mode
   */
  struct rcp_status_def status_local;

  /* T/R is in local mode
   */
  struct rcp_status_def status_trlocal;

  /* Antenna controller shutdown detection
   */
  struct rcp_status_def status_shutdown;

  /* T/R Power sensor
   */
  struct rcp_status_def status_tr_power;

  /* Servo Power sensor
   */
  struct rcp_status_def status_servo_power;

  /* Signal generator ON sensor
   */
  struct rcp_status_def status_siggen;

  /* Signal generator CW mode sensor
   */
  struct rcp_status_def status_sigcw;

  /* Pulse width can be sensed, only valid field used
   */
  struct rcp_status_def status_pwbw;

  /* Polarization can be sensed, only valid field used
   */
  struct rcp_status_def status_polar;

  /* Signal generator fault
   */
  struct rcp_status_def status_sigfault;

  /* Azimuth encoder calibrated
   */
  struct rcp_status_def status_calib_az;

  /* Elevation encoder calibrated
   */
  struct rcp_status_def status_calib_el;

  /* -------------------------------------------------- */

  /* RST names for the 8 possible modes.  Note that mode zero is
   * reported for unrecognized names, so it is not used at this point.
   * Similarly, incomming mode zero means turn on auto switching, and
   * do not control mode.
   */
  char sreport_mode[8][16];

  /* Site codes for the 4 possible sites to be reported to the RCP.
   */
  char sreport_sites[4][4];

  /* Delay in seconds applied before and after the mode is reported to
   * the RCP
   */
  FLT4 freport_mode_delay;

  /* This is the mode to request (temporarilly) when the RCP goes
   * dead.
   */
  UINT2 iDeadModeReq ;

  /* Time packets are in UTC, otherwise in the local time on the
   * computer
   */
  UINT1 lTimePacketUtc;

  char pad_end[1] ;
};

struct special_link
{
  UINT1 background;
  UINT1 overlay1;
  UINT1 underlay1;
  UINT1 underlay2;
  UINT1 legend;
  UINT1 centroid;
  UINT1 pad_6x2[2];
};

struct link_setup 
{
  char sVersion[8] ;		/* IRIS version when saved */

  UINT1 ilink_map[16];		/*Used to remap for link */
  struct special_link link;
};

struct misc_setup
{
  char sVersion[8] ;		/* IRIS version when saved */

  /* A certain fraction of the total available space for INGEST
   * and PRODUCT files can be used for "kept" files, i.e., files
   * that will not be deleted.  The percentage of total used for
   * kept is given in the following variables.  Note: additional
   * variables for RAW partition below.
   */
  SINT4 ikbytes_ingest;		/* Max total # bytes for INGEST files */
  SINT2 ikept_ingest_percent;

  SINT2 ikept_product_percent;
  SINT4 ifkbytes_product;	/* Max # kilobytes for PRODUCT files */

  SINT4 itrunc;			/* Truncation height (cm above radar) */

  SINT2 ingest_data_mode;	/* INGEST's supply of data */
#define DMODE_DSP    (0)           /* Use the DSP's */
#define DMODE_FAKE   (1)           /* Generate fake data */

  /* IEXT_HEADER tells which version number of extended header is to
   * be recorded.  Valid version numbers are 0,1,...  A negative value
   * means that no extended headers are to be recorded.
   */
  SINT2 iext_header;

  /* Amount by which RHI's are to speed up at high angles.
   */
  FLT4 relspeedup;

  /* Default Z/R relationship numbers
   */
  FLT4 fzr_const;
  FLT4 fzr_exp;

  /* Maximum number of bytes that will be held in the mapio
   * read-only-file cache for the product generator. 
   */
  UINT4 iprod_cache_size ;

  /* Make a status product each time a task starts
   */
  UINT1 lStatusEachTask ;

  /* Record using GMT, otherwise use the local time on the computer */
  UINT1 lRecordGmt;

  /* Between continuous scan PPI's, allow the antenna to free-run
   * if the next scan will begin within this many seconds.
   */
  SINT2 iant_coast_secs;

  /* The maximum time difference for APO of warning type in seconds.
   */
  SINT4 iMaxWarnDiff;

  /* The maximum time difference for APO of track type in seconds.
   */
  SINT4 iMaxTrackDiff;

  /* The maximum time difference for APO of all products not explicitly defined.
   */
  SINT4 iMaxDefaultDiff;

  /* The timeout time in seconds before we abort a network transfer.
   */
  SINT4 iNetworkSendTimeout;

  /* Maximum number of times to queue up a single product
   */
  UINT2 imax_send_queue;

  /* In automatic mode, switch the transmitter on this many
   * seconds before the task is scheduled to run.
   */
  SINT2 irad_warm_time;

  UINT1 lsay_text_product;	/* Speak when text product arrives over the network */
  UINT1 lsay_mode_change;	/* Speak when a mode change happens */
  UINT1 lsay_fatal_errors;	/* Speak when a fatal error happens */
  UINT1 lsay_bite_faults;	/* Speak when a BITE fault is reported */

  /* When INGEST is positioning the antenna, the servo is deemed
   * successful only if the velocity is less than the following
   * values in degrees/second.
   */
  FLT4 faz_ok_vel, fel_ok_vel;

  /* Likewise, if successful positioning is not achieved in a
   * time commensurate with a minimum level of performance (i.e.,
   * average velocity), then INGEST will not wait forever.  These
   * minimum performance velocities are in degrees per second.
   */
  FLT4 faz_morbid_speed, fel_morbid_speed;

  /* Time in seconds to wait between status products.
   */
  UINT4 istatus_product_gen;

  /* Time in seconds after a status product arrives before the site is
   * considered broken.
   */
  UINT4 istatus_product_timeout;

  /* Additional file information for separate RAW product directory
   */
  UINT4 ifkbytes_product_raw ;	/* Max # kilobytes for RAW products */
  UINT2 ikept_product_raw_percent ;

  /* Ingest angles are offset from zero by half a cpi */
  UINT1 lIngestAnglesEdged;

  /* Optimize tasks for continuous output */
  UINT1 lIngestContinuousOutput;

  /* Change pulse width in anticipation of an INGEST task that
   * will run in the future.
   */
  UINT1 lpw_advance_change ;

  /* Time is sourced by the RVP8, else IRIS */
  UINT1 lIngestTimeSourceRvp8;

  /* Allow INGEST noise samples. */
  UINT1 lnoise_enabled ;

  /* Force ingest to take noise samples each time the pulse width changes */
  UINT1 lnoise_at_pw_change;

  /* INGEST can optionally move the antenna before taking noise
   * samples.  The following deg*10 values are the desired noise
   * position.  -1 indicates a "dont care" on that axis.
   */
  SINT2 inoise_az, inoise_el;
  /* Take noise sample at start of vol scan if last one is older than
   * this many seconds.
   */
  SINT2 inoise_time;

  /* Number of times to retry when there is an error in the noise sample.
   */
  SINT2 iNoiseRetrys;

  /* Time to wait in ms after a bad noise sample before retrying.
   */
  SINT2 iNoiseRetryWait;

  /* Switch off xmit if there is more than this many seconds free.
   */
  SINT2 irad_off_time;

  /* Minimum gradient in 1/100 of a dB/km above the melting layer.
   * Positive means getting weaker as it goes up.
   */
  SINT2 iMinVerticalGradient;
  /* Gradient below the melting layer */
  SINT2 iLowVerticalGradient;
  /* Thickness of melting layer in km */
  FLT4  fMeltingThickness;
  /* Intensity of melting layer in dB */
  FLT4  fMeltingIntensity;
  /* Wind speed in m/s */
  FLT4  fWindSpeed;
  /* Wind direction in degrees */
  FLT4  fWindDirection;

  /* How to signal the centroids, only AVERAGE and MAXIMUM choices are valid,
   * See product.h for values
   */
  UINT2 icentroid_label;

  /* Minimum time (hundredths of seconds) to wait between sweeps
   */
  UINT2 iaz_sweep_wait ;
  UINT2 iel_sweep_wait ;

  /* Maximum number of status products we are willing to have
   */
  UINT2 istatus_product_quota ;

  /* Tolerable (binary) angle error before going ahead with a scan
   */
  SINT2 iaz_ok_err;
  SINT2 iel_ok_err;

  /* Set to non-zero if we wish continuous scans to go counter clockwise.
   */
  UINT1 lcon_clockwise;

  /* Type of angle synching used by IRIS.  Set to one of the ANGSYN_???
   * values defined in dsp_lib.
   */
  SINT1 isyn_mode;

  /* When DSP is used, angle information will be obtained in one
   * of the following ways:
   */
#define ANG_SRC_TAG_BIN16   (1)	/* 16-bit binary angles on TAG lines */
#define ANG_SRC_RCP         (3)	/* Angles from antenna controller */
  SINT1 iIngestAngleSource;

  UINT1 lWindSpeedValid;       /* Wind speed is valid */

  /* Set to non-zero if we wish to allow ingest to set the time automatically.
   */
  UINT1 lauto_time_set;
  UINT1 lClutMapReingest;	/* Apply Zc Clutter map correction in reingest */

  /* Priorities for IRIS.  These are broken out with greater detail (May 94)
   * to allow better tuning on different platforms.
   */
#define MIN_PRIORITY (-20)
#define MAX_PRIORITY  (20) 

  SINT2 ipri_ingest, ipri_ingfio ;
  SINT2 ipri_product  ;
  SINT2 ipri_reingest ;
  SINT2 ipri_network  ;
  SINT2 ipri_output   ;
  SINT2 ipri_archive  ;
  SINT2 ipri_server   ;
  SINT2 ipri_watchdog ;
  char  ipad_176x2[2];

  /* Allow RCP mode control
   */
  UINT2 lrcp_mode_control;

  /* Relative priorities of products -- these are used by the product
   * generator to help decide the order of running products.  Check
   * that the array is dimensioned properly.  It must be a multiple
   * of 4 and not less than the number of products.
   */
#define NUM_DEFINED_PRIORITIES 36
#if defined(NUM_DEFINED_PRODUCTS) && (NUM_DEFINED_PRIORITIES < NUM_DEFINED_PRODUCTS)
#error Please manually maintain the dimension of iprod_priorities[]
#endif
  UINT1 iprod_priorities[ NUM_DEFINED_PRIORITIES ] ;

  /* The following flag is set TRUE if the WATCHDOG process
   * should automatically restart processes that terminate due to
   * a fatal internal error.
   */
  UINT2 lrestart_fatal ;

  /* TRUE iff the product generator should make products from
   * incomplete INGEST volume scans (i.e., those that were halted
   * before completing fully).
   */
  UINT2 luse_partial_ingest ;

  /* TRUE iff "R2" algorithms are to be used to estimate SNR and
   * spectral width when INGEST configures the DSP.
   */
  UINT2 lr2_processing ;

  /* When a product that contains a warning is received by the
   * network, a signal and beep will be produced if the data time
   * is within the following number of seconds of the current
   * time.  Zero means do not signal incoming warnings.
   */
  SINT2 ircv_beep_time ;

  /* Default K/R relationship numbers
   */
  FLT4 fkr_const ;
  FLT4 fkr_exp ;

  /* Allow alternate polarization features in product generation
   */
  UINT1 lprod_alt_pol ;

  /* Whether INGEST runs in Active or Passive mode.
   */
  UINT1 iIngestActPsv ;		/* Ingest Active/Passive mode */
#define INGESTACTPSV_ACTIVE  0	/*   Active only */
#define INGESTACTPSV_PASSIVE 1	/*   Passive only */
#define INGESTACTPSV_BOTH    2	/*   Both are allowed */

  SINT2 ipri_input;  /* Priority used for input processes */

  /* Maximum number of product files allowed on a single archive
   */
  UINT4 imax_archive_products ;

  /* Maximum number of product files allowed on the disk
   */
  UINT4 imax_disk_products ;
  
  /* Extra space allowed in product inventory for slow deleting.
   */
#define PRODUCT_FILES_CUSHION (0x00000080)
#define PRODUCT_FILES_MAX     (0x00030d40)
#define PRODUCT_FILES_SEARCH  (0x00020000)  /* Larger than 1/2 of sum above */

  /* INGEST Clutter map control variables
   */
  FLT4  fcmap_dbzover ;		/* Data dBZ must exceed clutter ray by this much */
  BIN2  icmap_eltol ;		/* EL angle tolerance in matching rays */
  UINT1 lcmap_usevel ;		/* Use velocity criteria in masking */

  /* Control for attenuation correction */
  UINT1 lAttnReingest;   	/* Enable Zc attenuation correction in ReINGEST */
  FLT4  fAttnConstant;
  FLT4  fAttnExponent;
  FLT4  fAttnMaxZ;
  FLT4  fAttnMaxCorrection;

  /* INGEST data simulator control variables.
   */
  FLT4  fIngSimClutterStrength; /* Strength of clutter in simulation (0=none) */
  SINT2 ingsim_lat ;		/* Lat/Lon of simulation point.  Note SINT2 */
  SINT2 ingsim_lon ;		/*   rather than BIN2 for signed setup_limits(). */

  SINT2 ingsim_timeoffset ;	/* Virtual simulation time offset (seconds) */

  UINT1 ingsim_flags ;		/* Simulation control flags */
#define INGSIM_RADAR     0	/*   Simulation is at the radar (else above Lat/Lon) */
#define INGSIM_SHEARLINE 1	/*   Simulate shearline */
#define INGSIM_FALLSPEED 2	/*   Simulate particle fallspeeds */
#define INGSIM_WINDFIELD 3	/*   Simulate overall wind field */

  SINT1 ingsim_u0 ;		/* Horizontal winds at origin, 5 * m/sec */
  SINT1 ingsim_v0 ;

  UINT1 ingsim_wamp ;		/* VertVel sine amplitude, 100 * m/sec */
  UINT1 ingsim_whgt ;		/* VertVel period height, 10 * km */

  UINT1 ingsim_def ;		/* Deformation, 10 * m/sec/100km */

  UINT2 iNetworkWait;           /* Wait time for products to arrive */

  /* Allow Socket mode control
   */
  UINT2 lsocket_mode_control;

  /* VVP unfolding corrections for INGEST and ReINGEST
   */
  FLT4  fvvpunf_maxsep_km ;	/* Maximum VVP site separation (km) */
  UINT2 ivvpunf_maxage_sec ;	/* Maximum age of "UNFOLD" VVP (seconds) */
  UINT1 lvvpunf_reingest ;	/* Enable velocity unfolding in ReINGEST */
  UINT1 lMeltHeightValid;       /* Melting levels are valid */

  /* Fallspeed corrections for INGEST and ReINGEST
   */
  FLT4  ffallspd_vtz_coef[2] ;	/* Vt-Z coefficients below/above melting layer */
  FLT4  ffallspd_vtz_exp[2] ;	/* Vt-Z exponents below/above melting layer */
  SINT1 ifallspd_melts[12] ;	/* Melting heights for each month in km*10 (above MSL) */
  UINT1 lfallspd_reingest ;	/* Enable fall speed correction in ReINGEST */

  /* Use gradient to correct data in CAPPI and XSECT.
   */
  UINT1 lApplyGradient;

  /* When INGEST powers up, it can optionally reset the antenna and
   * signal processor.
   */
  UINT1 lIngestResetsDsp ;
  UINT1 lIngestResetsRcp ;

  /* The maximum time difference for APO of fcast type in seconds.
   */
  SINT4 iMaxFcastDiff;

  /* Reference height for making products (meters above MSL).
   */
  SINT2 iReferenceHeight;

  UINT2 iRainGageWait;           /* Wait time for RainGage data to arrive */

  /* Configuration for window alerts
   */
  UINT1 iWindowAlertStyle;
#define WINDOW_ALERT_DISABLED   (0)
#define WINDOW_ALERT_X_AND_TEXT (1)
#define WINDOW_ALERT_X_ONLY     (2)
#define WINDOW_ALERT_TEXT_ONLY  (3)
  UINT1 lWindowAlertOnFault;
  UINT1 iWindowFaultScheme;
#define WINDOW_FAULT_ONE (0)
#define WINDOW_FAULT_ALL (1)
  UINT1 lWindowAlertOnStale;

  /* Time delay in seconds until the image is flagged as stale
   */
  UINT2 iWindowStaleTime;

  SINT2 iNumKeptLogs ;		/* Number of LOG files to keep around */

  /* Further information that is used for INGEST Active/Passive modes,
   * sometimes as clues for what to do.
   */
  char  sPassiveSiteCode[4] ;	/* Site code supplying status product */
  UINT1 iPassiveType;	/* Type of passive mode to run */
#define PASSIVE_TYPE_MULTIPLE   (0)   /* Select from multiple continuous scans */
#define PASSIVE_TYPE_SINGLE     (1)   /* Single task scheduled at a time */
#define PASSIVE_TYPE_STATUS     (2)   /* Slaved to a status product */
#define PASSIVE_TYPE_TSPLAYBACK (3)   /* Time Series playback */
  UINT1 lPassiveTrigRate ;	/* Use external trigger rate */
  UINT1 lTargetDetReingest;	/* Enable target detection correction in ReINGEST */
  UINT1 lStatusModeChange;      /* Change modes based on a status product */
  char  sStatusSiteCode[4];     /* Site code for status product to switch on */

  UINT1 lLabelBottomSline;      /* Label the SLINE display at bottom */
  UINT1 lLabelBottomTdwr;       /* Label the TDWR display at bottom */
  UINT1 lLabelBottomTrack;      /* Label the TRACK display at bottom */
  UINT1 lLabelBottomWarn;       /* Label the WARN display at bottom */

  FLT4  fAzVelocityTolerance;   /* Azimuth velocity tolerance */

  UINT2 iProductBusyTime;       /* Time before signalling product overload (seconds) */
  UINT1 lHydroClassReingest;	/* Enable hydrometeor classification in ReINGEST */
  char  ipad_end[1];

} ;

struct rtdisp_channel_setup
{
  char sXmtName[20];		/* Name of the transmitter program */
  char sBroadcastAddress[20];   /* RTD Broadcast address in string form */
  UINT4 iPortNum;               /* Port number for real time display broadcast */
};

#define RTD_CHANNEL_COUNT (6)

struct rtdisp_setup
{
  char sVersion[8] ;		/* IRIS version when saved */

  /* Indicates who should be sourcing the display.  Previously
   * was a logical flag
   * */
#define RTD_ENABLE_OFF  (0)     /* No display generated */
#define RTD_ENABLE_APP  (1)     /* Display sourced an application program like IRIS/Ingest */
#define RTD_ENABLE_RVP  (2)     /* Display sourced directly by the RVP8 */
  UINT1 lEnabled;             
  char ipad9x3[3];

  /* The maximum number of range bins that will be sent over the network.
   * Network constraints may lower the actual transmission.
   */
  SINT2 irtd_max_bins;
  SINT2 iPriority;               /* RTD transmitter priority */
  UINT1 lrtd_send_refl;
  UINT1 lrtd_send_velocity;
  UINT1 lrtd_send_width;
  char  ipad19x1[1];
  struct rtdisp_channel_setup Channel[RTD_CHANNEL_COUNT];
};

/* --------------------------------------------------
 * The following protected region structures appear in some of the IRIS
 * data file formats, and therefore must not be changed.
 */

/* Structure defining a protected region for the warning product.
 * Each region is a rectangle having adjustable size, location,
 * and orientation.
 */
#define ONE_PROT_REGION_SIZE (32)
struct one_protected_region	/* !!! DO NOT CHANGE SIZE !!! */
{
  SINT4 ixcenter;  /* Center of region (cm from radar) */
  SINT4 iycenter;
  SINT4 ixsize;    /* Size of region, before rotation */
  SINT4 iysize;
  UINT2 iangle;    /* Orientation binary angle (-45 to +45 degrees) */
  char  ipad18x2[2];
  char  sname[12]; /* Space padded name of region, first char space means unused */
};

#define IMAX_PROT_REGIONS (32)
#define PROTECT_SETUP_SIZE (1024)
struct protect_setup		/* !!! DO NOT CHANGE SIZE !!! */
{
  struct one_protected_region protected_regions[IMAX_PROT_REGIONS];
};

/* --------------------------------------------------
 * Define the list of corridors.
 */
struct one_corridor
{
  char sCorridor[16];
};
struct corridor_list
{
  SINT4 iCount;
  struct one_corridor List[IMAX_PROT_REGIONS];
};

struct device_setup
{
  char sVersion[8] ;		/* IRIS version when saved */
  SINT4 idevcount;		/* Number of devices defined */
  struct device_def def[MAX_OUT_DEVICES];
};


struct one_input_setup		/* Definitions for input device */
{	
  char  sName[16];		/* Name of input device */
  char  sDirectory[48];		/* Directory to search */
  char  sPipeName[16];		/* Name of pipe to envoke */
#define COMMAND_LINE_PIPE  (0)
#define COMMAND_LINE_PATHS (1)
  UINT1 iCommandLineSyntax;     /* Type of command line arguments */
  /* Choices are NET_NOTIFY_NONE for polling, and NET_NOTIFY_TCPIP for tcpip socket */
  UINT1 iNotifyScheme;          /* Notification scheme */
  UINT2 iSocketPort;            /* Port number if tcpip socket notification */
} ;

struct input_setup
{
  char sVersion[8] ;		/* IRIS version when saved */
  UINT4 iInputCount;
  struct one_input_setup Def[MAX_INPUT_DEVICES];
};

/*
 * ======================================================================
 *                           SITES Information
 * ======================================================================
 * This structure is provided to hold information about the site.  A "site"
 * can have several radars and several DSP's.
 */
#define MAX_SITES (31)
struct site_list
{
  char site_name16[20];
  char site_name3[4];
  UINT1 lChecked;
  UINT1 pad_25x3[3];
};

struct site_setup
{
  char sVersion[8] ;		/* IRIS version when saved */

  /* Flag indicating whether the operating system can perform mapped I/O
   */
  UINT1 lmmap_okay ;
  char  pad1x3[3] ;

  /* Site number for link indentifier
   */
  SINT4 isite_number;

  /* The maximum number of IRIS clients allowed
   */
#define MAX_IRIS_CLIENTS    (30)
  SINT4 imax_clients;

  struct site_list sites[MAX_SITES];
} ;

/* Site dependent setup information, for example the license number
 */
struct license_setup
{
  char sVersion[8] ;		/* IRIS version when saved */

  /* License structures for enabling/forbiding various features
   */
#define MAX_LICENSE_COUNT (6)
  char sLicenses[MAX_LICENSE_COUNT][60];

  char sSitename[16];              /* Name of current site */
  char sSiteCode[8];               /* Short code for the current site, null terminated */
  char sPassword[16];              /* Password for window operator privilege */
  char sHardwareName[16];          /* Name of hardware site */
  /* What style of IRIS we will have.
   */
  UINT2 iris_style;
#define STYLE_RADAR      (0)       /* full function IRIS */
#define STYLE_ANALYSIS   (2) 

  char pad_end[2] ;
};


struct one_web_user		/* Definitions for one web user */
{	
  char  sHost[16];		/* Host of user */
  char  sName[16];		/* Name of user */
  char  sPassword[16];		/* Password of user */
};

#define MAX_WEB_USERS (20)
struct web_setup
{
  char sVersion[8] ;		/* IRIS version when saved */
  UINT4 iClientCount;           /* Max number of simultaneous clients */
  UINT4 iUserCount;             /* Number of users defined */
  UINT1 lUserLoginRequired;     /* We require that users log in */
  char  pad17x7[7] ;
  struct one_web_user User[MAX_WEB_USERS];
};

/* Accumulate lots of setup information here, don't worry about which
 * files they are stored in.
 */
struct iris_setup
{
  struct link_setup    link;
  struct misc_setup    misc;
  struct protect_setup protect;
  struct device_setup  device;
  struct site_setup    Site;
  struct input_setup   Input;
  struct web_setup     Web;
};

/* ======================================================================
 * Color Definition Structures
 */

#define SPECIAL_MAP_MAX (17)	/* Maximum number of special colors in map */
struct special_colors		/* Color values for all the special colors */
{
  struct color_def background;
  struct color_def legend;
  struct color_def overlay1;
  struct color_def drop_shadow;

  struct color_def overlay2;
  struct color_def overlay3;
  struct color_def overlay_txt_back;
  struct color_def underlay1;
  struct color_def underlay2;
  struct color_def underlay3;
  struct color_def centroid;
  struct color_def blink;
  struct color_def track;
  struct color_def track_highlight;
  struct color_def Shearline;
  struct color_def WindBarbs;
  struct color_def RangeRings;
};

struct colorset_setup
{
  char sname[20];
  UINT2 icolors[16];   /* Color number table */
};

#define COLOR_SET_COUNT (8)
#define COLOR_MAP_MAX (32)	/* Maximum number of colors in map */
#define COLOR_MAP_ZOOM (2)
#define COLOR_MAP_BASE (COLOR_SPECIAL_COUNT)
#define COLOR_CELL_COUNT (COLOR_MAP_BASE+(COLOR_MAP_ZOOM*COLOR_MAP_MAX))
struct colormap_setup {
  struct special_colors special; /* Special colors for display */
  struct color_def colormap[COLOR_MAP_ZOOM][COLOR_MAP_MAX]; /* The IRIS color map*/
  struct colorset_setup set[COLOR_SET_COUNT];               /* Color number tables */
};

struct setup_scale_def		/* Color scale definition structure */
{
  char sname[20];
  UINT2 ilevel_seams[16];
  UINT4 iflags;
#define SCALE_TOP_SATURATE     (0x0001)
#define SCALE_BOTTOM_SATURATE  (0x0002)
#define SCALE_RAINRATE_IN_HOUR (0x1000)
#define SCALE_RAIN_INCHES      (0x1000)
#define SCALE_HEIGHT_KFT       (0x2000)  /* Only partly implemented */
  UINT1 iset_number;	      /*Which color set to use, origin 1*/
  
  UINT1 inum_levels;          /*Number of levels to use*/
  char  pad58x2[2];
};

#define COLOR_SCALE_COUNT (8)
struct one_dtype_scales
{
  struct setup_scale_def scales[COLOR_SCALE_COUNT];
};

/* ===================
 * This is what is contained in the color setup file.
 */
struct color_setup
{
  char sVersion[8] ;		/* IRIS version when saved */
  struct colormap_setup colormap;
  struct one_dtype_scales dtype[SETUP_DTYPE_COUNT];
};

/* ======================================================================
 *                          DSP Setup Structure
 * ======================================================================
 * This structure is provided to hold information about a particular signal
 * processor. 
 */
struct customTrig {		   /* Custom trigger period sequence */
  SINT4 iNumPeriods ;		   /*   Number of periods defined */
  SINT4 iPeriods[MAXTRIGPERIODS] ; /*   Trigger periods in nanoseconds */
} ;

struct dsp_losses_setup
{
  /* Transmitt loss from transmitter to antenna (1/10 of dB)
   */
  SINT2 iXmtLossSingle;   /* XMT single channel */
  SINT2 iXmtLossHAndV;    /* XMT simultanious */

  /* Receiver losses from antenna to receiver (1/10 of dB)
   */
  SINT2 iRcvLoss;

  /* Losses between the test signal input point and the receiver (1/10
   * of dB)
   */
  SINT2 iTestLoss;
};

struct dsp_manual_setup
{
  char sVersion[8] ;		/* IRIS version when saved */

  UINT1 ldsp_available ;	/* Flag indicates that system has a DSP */
  UINT1 itype ;			/* Type of DSP */

  UINT1 lCheckByteOrder ;	/* Check byte order on powerup */

  UINT1 interface;		/* Interface type */
  char  sdevice[40] ;		/* SCSI: Device file name; SOCKET: IP address */
  UINT4 iPortNumber;            /* Port number if socket interface */

  SINT2 isync_fuzz;		/* Static sync mode fuzz angle */

  /* The number of pulswidths available on the radar
   */
  SINT2 iwidcnt;

  /* The 4 pulswidths available in 1/100 of a microsecond.  Note that
   * if less than 4 are available, the remaining will be filled in
   * with one of the other pulsewidths.
   */
  SINT2 ipwidths[4];

  /* This is an array containing the 4 bits to be output for each of
   * the four pulse widths available.
   */
  UINT2 ipwbits[4];

  /* The wavelength of the radar in 1/100 of a centimeter
   */
  SINT4 iwavelength;
  /* Note that all PRFs below are in hertz.  This is the prf to use
   * during the calibration of the radar
   */
  SINT4 idspprf;

  SINT4 iminprf[4];		/* The minimum PRF available */
  SINT4 imaxprf[4];		/* MAX PRFs for each of the pulsewidths */

  SINT4 inoiseprf;		/* PRF at which to take the noise sample */

  /* Time in milliseconds to wait after turning off radiate before 
   * changing the pulse width.  If set to zero, then the feature is
   * disabled.  The radiate is turned back on as soon as the ipw_wait
   * time after pulse width change has elapsed.
   */
  SINT4 iPwRadiateOffWait;

  /* Time in milliseconds to wait after changing the pulse width before
   * raising PRF
   */
  SINT4 ipw_wait;

  /* Horizontal full beamwidth in 1/100 of a degrees
   */
  SINT2 ihorizwidth;

  /* Vertical full beamwidth in 1/100 of a degree
   */
  SINT2 ivertwidth;

  SINT4 iantgain;		/* The antenna gain in 1/10 of dB */
  FLT4  fNoiseSourceENR;        /* The noise source ENR value */
  struct dsp_losses_setup Horiz;
  struct dsp_losses_setup Vert;

  SINT2 idspagcode;		/* The desired AGC decay code */

  SINT2 idspdualdelay;		/* The dual PRF stabilization delay */

  SINT2 ildr_bias;		/* LDR bias in dB*100 (XDR) */  
  SINT2 izdr_bias;		/* ZDR bias in dB*16  (GDR) */

  /* Type of transmitter and phase control
   */
  UINT1 iXmtTubeType;           /* Type of transmitter tube */
#define XMT_MAGNETRON (1)	/*   Magnetron */
#define XMT_KLYSTRON  (2)	/*   Klystron  */
#define XMT_TWT       (3)	/*   Travelling Wave Tube */

  UINT1 lXmtPhaseControl;	/* System has XMT phase control hardware */

  UINT1 lPolarAvailable;	/* Set non-zero if radar supports dual polarization */
  UINT1 iSinglePolarization;    /* Which polarization on signal pol radars */

  /* Time in milliseconds to wait after turning off radiate before 
   * changing the polarization.  If set to zero, then the feature is
   * disabled.  The radiate is turned back on as soon as the antenna 
   * notifies us that the new polarization is working, or the iMaxPolarWait
   * time has elapsed.
   */
  SINT4 iPolarRadiateOffWait;
  SINT4 iMaxPolarWait;          /* Maximum polarization wait time after setting */

  char strid[40];		/* Transmitter or receiver id, space terminated */

  UINT1 lDualReceiver;          /* System has dual receivers */

  UINT1 lPhidpAvailable ;	/* PHIDP is available from the DSP */
  UINT1 lRhohvAvailable ;	/* RHOHV is available from the DSP */
  UINT1 lSqiAvailable ;		/* SQI is available from the DSP */

  UINT1 lLdrAvailable ;     	/* LDR is available from the DSP */
  UINT1 lPhiAvailable ;         /* PHI is available from the DSP */
  UINT1 lRhoAvailable ;  	/* RHO is available from the DSP */

  UINT1 lXmtHorizontalOnly;     /* Radar is capable of horizontal only transmitting */
  UINT1 lXmtVerticalOnly;       /* Radar is capable of vertical only transmitting */
  UINT1 lXmtAlternating;        /* Radar is capable of alternating transmitting */
  UINT1 lXmtSimultaneous;       /* Radar is capable of simultaneous transmitting */
  UINT1 iCalSignalType;         /* Type of calibration signal */
#define CAL_SIGNAL_NARROW (0)	/* Narrow band signal generator */
#define CAL_SIGNAL_BROAD  (1)	/* Broadband noise source */

  SINT4 itpower[4] ;		/* Transmitted power in watts for each pulse width */

  SINT4 iRangeMaskSpacing[4];	/* Range mask bin spacing in cm */

  UINT1 iwindow ;		/* Window to use for computing spectra */

  /* Flag indicating that the sign of velocities from the DSP should
   * be inverted.
   */
  UINT1 linvert_velocities;

  /* Flag indicating that the DSP uses digital gain control
   */
  UINT1 ldigital_gain ;

  /* Choice of 8-bit only (1), or both 8- and 16-bit (2) data from DSP
   */
  UINT1 iDataWidths ;
#define DSP_DATA_8ONLY  (1)
#define DSP_DATA_8AND16 (2)

  SINT4 iaqclock ;		/* Acquisition clock frequency in Hz */

  /* Gas attenuation as 100000 * db/km
   */
  UINT4 iGasAtten ;

  /* Custom trigger periods
   */
  struct customTrig customTrig[CUSTOMTRIGS] ;

#define NUMPMODENAMES 4		/* Names of PMODE_USERn major modes */
  char sUserPModeNames[NUMPMODENAMES][16] ;

  FLT4  fRvp6InterferenceThreshold; /* Threshold used to detect noise sample interference */

  /* Simulation parameters
   */
  UINT4 lSimClutterWidNorm ;	/* Simulated clutter width is normalized, */
  FLT4  fSimClutterWidth ;	/*   else expressed in meters/sec */
} ;

/* --------------------------------------------------
 * Keep this here because it is used in ascope recording format.
 * Do not change.
 */
#define DSP_MANUAL_SIZE722 (400)
struct dsp_manual_setup722
{
  UINT1 ldsp_available ;
  UINT1 itype ;
  SINT2 iwidcnt;
  SINT2 ipwidths[4];
  UINT2 ipwbits[4];
  SINT4 iwavelength;
  SINT2 isync_fuzz;
  UINT1 interface;
  UINT1 lCheckByteOrder ;
  SINT4 idspprf;
  SINT4 iminprf[4];
  SINT4 imaxprf[4];
  SINT4 inoiseprf;
  SINT4 ipw_wait;
  SINT2 ihorizwidth;
  SINT2 ivertwidth;
  SINT2 iantgain;
  SINT2 itrloss;
  SINT2 irecloss;
  SINT2 itestloss;
  char  ipad_84x2[2] ;
  SINT2 idspagcode;
  SINT2 idspdualdelay;
  SINT2 iang_form;
  UINT1 lPolarAvailable;
  UINT1 lPolSimultaneous;
  char strid[40];
  SINT2 izdr_bias;
  SINT4 itpower[4] ;
  SINT4 imask_res ;
  UINT1 iwindow ;
  UINT1 linvert_velocities;
  UINT1 ldigital_gain ;
  UINT1 idata_widths ;
  SINT4 iaqclock ;
  char sdevice[40] ;
  UINT1 lPhidpAvailable ;
  UINT1 lRhohvAvailable ;
  UINT1 lSqiAvailable ;
  char ipad207x1;
  char sVersion[8];
  UINT4 iGasAtten ;
  char ipad220x180[180] ;
};

/* ======================================================================
 *                          DSP Server Setup Structure
 * ======================================================================
 * This structure is provided to hold information about a particular signal
 * processor.   This is the structure that is passed to the Client 
 *
 */
struct serv_dsp_manual_setup
{
  SINT4 iwavelength;
  SINT4 iwidcnt;
  SINT4 ipwidths[4];
  SINT4 ipwbits[4];
  /*  SINT4 isync_fuzz; */
  SINT4 idspprf;
  SINT4 iminprf[4];
  SINT4 imaxprf[4];
  SINT4 inoiseprf;
  /*  SINT4 idspagcode; */
  /*  SINT4 idspdualdelay; */
  /*  SINT4 iang_form; */
  SINT4 lPolarAvailable;
  UINT4 lXmtVerticalOnly;       /* Radar is capable of vertical only transmitting */
  UINT4 lXmtAlternating;        /* Radar is capable of alternating transmitting */
  UINT4 lXmtSimultaneous;       /* Radar is capable of simultaneous transmitting */
  char sUserPModeNames[NUMPMODENAMES][16] ;
  UINT4 iCustomTrigMask ;
  UINT4 linvert_velocities;
  SINT4 itpower[4] ;
  UINT4 ldigital_gain ;
};

/* --------------------------------------------------------------------
 * This structure hold the numbers defining the radar calibration
 * for one pulse width, one polarization.
 */
struct dsp_cal_pw
{
  /* The slope of the fit in dB/Machine number */
  FLT4 fRvp6Slope;
  /* The slope of the fit in dB/dB */
  FLT4 fRvp7Slope;

  /* The calibration offset in dBZ at 1 kilometer for each of the
   * pulse widths.
   */
  FLT4 fZCal;

  FLT4 fstd_dev;                /* Standard deviation of the fit */
  FLT4 fRvp6LogDc;
  /* Noise level, dBm for RVP7, A/D counts for RVP6 */
  FLT4 fNoiseLevel;
  FLT4 fRvp6LinRms;
  FLT4 fi0;			/* I0 value from calibration */
  struct ymds_time time;	/* Local time calibration was done */
  UINT4 iflag;
#define ZCAL_OK   (0)
#define ZCAL_ZERO (1)

  struct ymds_time SiggenTime;	/* Local time siggen calibration was done */
  char             sSiggenId[40];
};
/* --------------------------------------------------------------------
 * This structure hold the numbers defining the radar calibration
 */
struct dsp_cal_polar
{
  struct dsp_cal_pw PW[4];
};

struct dsp_cal
{
  struct dsp_cal_polar Horiz;
  struct dsp_cal_polar Vert;
};

struct dsp_refl_cal
{
  char             sVersion[8] ;		/* IRIS version when saved */
  struct ymds_time CurrentSiggenTime;           /* Local time */
  char             sCurrentSiggenId[40];
  struct dsp_cal   Reference;
  struct dsp_cal   Stored;
};

/* --------------------------------------------------------------------
 * This structure hold signal generator calibration results.  If no calibration
 * file is found, then time is set to zero, max value zero, factual set to
 * 1-to-1 mapping, and id set to "No siggen calibration file".
 */
#define DSP_SIGGEN_CAL_SIZE (568)

struct dsp_siggen_cal
{
  struct ymds_time siggen_time;	/* Local time siggen calibration was done */
  char siggen_id[40];		/* Signal generator ID string */
  SINT4 ical_max_value;		/* The maximum setting that was calibrated */

  /* The actual values for signal generator settings.
   * index 0 is for max value, index 1 for 1db less, ...
   */
  FLT4 factual[128];
};

/* --------------------------------------------------------------------
 * Structure to hold information for the various type of gain controls
 * that a DSP may have.  Both the analog (STC/ACG voltage) and the
 * digital (6-bit IAGC) calibrations appear here.
 */
#define IANALOG_GCAL_SIZE  ( 101)
#define IDIGITAL_GCAL_SIZE (  64)
struct dsp_gain_cal {
  FLT4 fanalog_curve[IANALOG_GCAL_SIZE] ;      /* dB vs. percent full scale volts */

  FLT4  fdigital_nominal_gain[IDIGITAL_GCAL_SIZE] ;  /* Nominal and actual dB vs     */
  FLT4  fdigital_actual_gain [IDIGITAL_GCAL_SIZE] ;  /*   6-bit attenuator setting.  */
  UINT2 idigital_flags[IDIGITAL_GCAL_SIZE] ;         /* usage flags for each setting */
};

/* --------------------------------------------------------------------
 * This structure holds the STC table.  This is the table of numbers to load
 * into the signal processor.  The exact format and size of this table is
 * dependent on the signal processor type, thus if the signal processor type
 * is changed.
 */
#define DSP_STC_TABLE_SIZE (16384)
struct dsp_stc_table
{
  UINT2 istctable[ DSP_STC_TABLE_SIZE/2 ];
};

/* --------------------------------------------------------------------
 * This structure holds the AGC calibration information.  In the analog
 * gain control case, this consists of a table of 256 values, and the two dB
 * values that led to the creation of that table.  In the digital gain
 * control case, the DSP signal power feedback constants are stored.
 */
#define DSP_AGC_TABLE_SIZE (256)
struct dsp_agc_cal
{
  UINT2 iagctable[DSP_AGC_TABLE_SIZE] ; /* Analog AGC map */
  FLT4 fsaturation ;           /* dBM level of saturation */
  FLT4 fmargin ;               /* saturation margin */

  FLT4 fiagc_hi ;              /* IAGC high dB limit */
  FLT4 fiagc_goal ;            /* IAGC feedback goal */
  FLT4 fiagc_low ;             /* IAGC low dB limit */
};


#ifdef __cplusplus
}
#endif
#endif /* #ifndef SIGMET_SETUP_H */
