/* ***********************************************************************
 * *                                                                     *
 * *               IRIS Task Configuration Structure                     *
 * *                                                                     *
 * *********************************************************************** 
 * File: include/iris_task.h
 *
 * COPYRIGHT (c) 1988, 1989, 1991, 1996, 1997, 1998, 1999, 2000, 2004,
 *                             2005 BY
 *       SIGMET INCORPORATED, 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. 
 *
 * Include Requirements: sigtypes.h
 *                       headers.h
 */
#ifndef SIGMET_TASK_H
#define SIGMET_TASK_H 1

#ifdef __cplusplus
extern "C" {
#endif

  /* -------------------- Task Scheduling Information --------------------
   */
#define TASK_SCHED_INFO_SIZE  120

struct task_sched_info
{
  /* There are six times stored for each task.  All times are in
   * seconds offset from the start of a 24-hour day.  Invalid times
   * are indicated by a value of -1.
   *
   * START and STOP are absolute times that define when the task can
   * be running at all.  SKIP is the desired time between individual
   * runs. Each time a task is run the beginning time is stored in
   * LAST_RUN.  When a run finishes, the time used is written to
   * TIME_USED.  LAST_RUN_DAY is a relative day number that is used to
   * resolve very old last run times.
   */
  SINT4 istart;			/* Start time for task */
  SINT4 istop;			/* Stop time for task */
  SINT4 iskip;			/* Desired skip between runs */
  SINT4 ilast_run_sec;		/* Time that task was last run (seconds within the day) */
  SINT4 itime_used_sec;		/* Time used on last run (seconds)*/
  
  SINT4 ilast_run_day;		/* Day that task was last run (days since 1970) */
  
  /* The flag word modifies the scheduling details.
   *  * ASAP indicates that the scheduling times should be ignored and that the
   *    task should be run once as soon as possible, after which the ASAP bit 
   *    will be cleared.
   *  * MAND indicates that the task can preempt a non-MAND task that is already
   *    running, and also defines a separate level of priority for normal time-
   *    based scheduling.
   *  * LSKIP is a late skip flag which indicates that the task must run within
   *    a certain tolerance of its expected starting times, else it will be 
   *    skipped.
   *  * STOP indicates to INGEST that the task should be descheduled after 
   *    running it, i.e., its state should go to INACTIVE, rather than SCHEDULED.
   */
  UINT2 iflag;
#define TASK_SCH_ASAP      (0x0001) /* Start as_soon_as_possible */
#define TASK_SCH_MAND      (0x0002) /* Task has mandatory status */
#define TASK_SCH_LSKIP     (0x0004) /* Late Skip */
#define TASK_SCH_MESTU     (0x0008) /* TIME_USED is measured, else estimated. */
#define TASK_SCH_DESCHED   (0x0010) /* Deschedule task after running it. */
#define TASK_SCH_INTR      (0x0020) /* Interrupt this task right now */
#define TASK_SCH_FLIP      (0x0040) /* Offer to flip control to other system */

#define TASK_SCHED_INFO_PAD (94)
  char ipad_end[TASK_SCHED_INFO_PAD];
};

struct serv_task_sched_info
{
  SINT4 istart;			/* Start time for task */
  SINT4 istop;			/* Stop time for task */
  SINT4 iskip;			/* Desired skip between runs */
  SINT4 ilast_run;		/* Time that task was last run */
  SINT4 itime_used;		/* Time used on last run */
  SINT4 ilast_run_day;		/* Relative day # for ILAST_RUN */
  UINT4 iflag;
};

/* -------------------- Task DSP Information -------------------- */

/* The following Union contains dsp configuration information, the format of 
 * which varies according to the major mode.
 */

#define TASK_DSP_MODE_SIZE  32
struct task_dsp_mode_batch
{
  UINT2 iLoPrf;          /* Low PRF in Hz */
  UINT2 iLoPrfFract;     /* Low PRF fractions of Hz */
  SINT2 iLoSampleSize;   /* Sample size for low PRF */
  SINT2 iLoAvgSide;      /* Averaging applied to low PRF */
  SINT2 idBOverRefl;     /* Reflectivity dB threshold (1/100 dB)*/
  SINT2 idBOverVel;      /* Velocity dB threshold (1/100 dB)*/
  SINT2 idBOverWid;      /* Width dB threshold (1/100 dB ) */
#define TASK_DSP_MODE_BATCH_PAD (18)
  char ipad_end[TASK_DSP_MODE_BATCH_PAD];
};
struct task_dsp_mode_other
{
  SINT2 imisc[TASK_DSP_MODE_SIZE/2];
};
union task_dsp_mode_u
{
  struct task_dsp_mode_batch batch;
  struct task_dsp_mode_other other;
} ;

#define TASK_DSP_INFO_SIZE  320
struct task_dsp_info
{
  UINT2 imajor_mode ;		/* DSP mode (from dsp_lib.h) */

  UINT2 idsptype ;		/* DSP type (from dsp_lib.h) */

  /* The type(s) of data being recorded by the DSP are summarized in
   * DataMask.  IDATA is an array of 160 bit positions,
   * indicating which types of data are to be ingested.
   * For DB_XHDR, the iXhdrType gives information about which type
   * of extended header data is recorded.
   * For definitions see the dsp_lib.h file.
   */
  /* UINT4 idata; */
  struct dsp_data_mask DataMask;

  /* We can optionally block recording of some data types when
   * making the RAW product.  This records the original data types.
   * Unused if all zero.  Added on 2-Nov-2004 in release 8.07.
   */
  struct dsp_data_mask OriginalDataMask;

  union task_dsp_mode_u u;
  char  ipad_84x52[52];

  /* Trigger and related Info 
   */
  SINT4 iprf;			/* PRF in hertz */
  SINT4 ipw;			/* Pulse Width in 1/100 usec. */

  UINT2 itrig;			/* Trigger rate flag, see dsp_lib.h */

  SINT2 idual_delay;		/* Stabilization # pulses for multi-PRF */
  UINT2 iagc_code;		/* Selected coefficient for AGC feedback */

  /* Miscellaneous
   */
  SINT2 isamp;			/* # Pulses used (Sample Size) */

  UINT2 igain;
#define GAIN_FIXED     0	/* Fixed receiver gain */
#define GAIN_STC       1	/* STC Gain */
#define GAIN_AGC       2	/* AGC Gain */

  /* File defining clutter filter.  If the file name is blank, then
   * the first filter code is used at all ranges.
   */
  char sfilter[12];		/* Space terminated */
  UINT1 idop_filter_first;	/* Doppler based filter used on first bin */
  UINT1 ilog_filter_first;	/* Z based filter (unused, for legacy RVP6 data only) */

  SINT2 ifixed_gain;		/* 1000 * fixed gain level (0-1) */

  UINT2 igas_atten ;		/* 100000 * db/km, up to 10000, thereafter 10 times slope */

  UINT2 lclutmap_used ;		/* Clutter map applied to DSP data */

  UINT2 iXmtPhaseSequence;      /* Phase sequence to use, if major_mode=PMODE_RPH */

  UINT4 iCfgHdrMask;            /* Mask sent to CFGHDR command in RVP8 */
  UINT2 iFlagsTS;               /* Time series playback related flags, see OPTS_* */
#define TASK_DSP_INFO_PAD (138)
  char ipad_end[TASK_DSP_INFO_PAD];
};


struct serv_dsp_mode_batch
{
  UINT4 iLoPrf16;        /* PRF in Hz*2**16 */
  SINT4 iLoSampleSize;   /* Sample size for low PRF */
  SINT4 iLoAvgSide;      /* Averaging applied to low PRF */
  SINT4 idBOverRefl;     /* Reflectivity dB threshold (1/100 dB)*/
  SINT4 idBOverVel;      /* Velocity dB threshold (1/100 dB)*/
  SINT4 idBOverWid;      /* Width dB threshold (1/100 dB ) */
};
struct serv_dsp_mode_other
{
  SINT4 imisc[16];
};
union serv_task_dsp_mode_u
{
  struct serv_dsp_mode_batch batch;
  struct serv_dsp_mode_other other;
} ;

struct serv_task_dsp_info
{
  UINT4 imajor_mode ;
  UINT4 idsptype;

  struct dsp_data_mask DataMask;

  union serv_task_dsp_mode_u u;
  /* Trigger and related Info
   */
  SINT4 iprf;			/* PRF in hertz */
  SINT4 ipw;			/* Pulse Width in 1/100 usec. */

  UINT4 itrig;			/* Trigger rate flag, see dsp_lib.h */

  SINT4 idual_delay;		/* Stabilization # pulses for multi-PRF */
  UINT4 iagc_code;		/* Selected coefficient for AGC feedback */

  /* Miscellaneous
   */
  SINT4 isamp;			/* # Pulses used (Sample Size) */
  SINT4 igain;

  /* File defining clutter filter.  If the file name is blank, then
   * the first filter code is used at all ranges.
   */
  char sfilter[12];		/* Space terminated */
  UINT4 idop_filter_first;	/* Filter used on first bin */
  UINT4 iFlagsTS;               /* Time series playback related flags, see OPTS_* */

  SINT4 ifixed_gain;		/* 1000 * fixed gain level (0-1) */
  UINT4 lclutmap_used ;		/* Clutter map applied to DSP data */
  UINT4 iXmtPhaseSequence;      /* Phase sequence to use, if major_mode=PMODE_RPH */
};

/* ----------- Task Calibration and Thresholding Information ----------------- */

#define TASK_CALIB_INFO_SIZE  320
struct task_calib_info
{
  /* Various calibration slopes and thresholds
   */
  SINT2 iz_slope;		/* LOG slope in dB*4096/ A/D count */
  
  SINT2 izns_thr;		/* LOG noise threshold in dB*16 */
  SINT2 iccr_thr;		/* Clutter Correction threshold in dB*16 */
  SINT2 isqi_thr;		/* SQI threshold * 256 */
  SINT2 isig_thr;		/* Signal power threshold in dBm*16 */
  char  ipad10x8[8];
  SINT2 iz_calib;		/* Calibration reflectivity, dBZ*16 @ 1Km */

  /* Threshold control flags for various parameters.
   */
  UINT2 iuz_tcf;		/* UnCorrected Z flags */
  UINT2 icz_tcf;		/* Corrected Z flags */
  UINT2 ivl_tcf;		/* Velocity flags */
  UINT2 iwd_tcf;		/* Width flags */
  UINT2 izdr_tcf;		/* ZDR flags */
  char  ipad30x6[6];

  /* Miscellaneous processing flags.
   */
  UINT2 iflags;
#define TCF_CAL_ZSPECKLE      0x0001 /* Log channel speckle remover ON */
#define TCF_CAL_VSPECKLE      0x0004 /* Linear channel speckle remover ON */
#define TCF_CAL_RANGENORM     0x0010 /* Data is range normalized */
#define TCF_CAL_BEG_PULSE     0x0020 /* DSP issues pulse at beginning of rays */
#define TCF_CAL_END_PULSE     0x0040 /* DSP issues pulse at end of rays */
#define TCF_CAL_VAR_PULSES    0x0080 /* DSP varies # pulses in Dual PRF mode */
#define TCF_CAL_3LAG_WIDTHS   0x0100 /* Use 3-lag Doppler processing (else 2) */
#define TCF_CAL_SHIP_COR      0x0200 /* Velocities corrected for ship motion */
#define TCF_CAL_VC_UNFOLD     0x0400 /* Vc has unfolding via VVP */
#define TCF_CAL_CVEL_UNFOLD   0x0400 
#define TCF_CAL_VC_FALLSPD      0x0800 /* Vc has fallspeed correction */
#define TCF_CAL_CVEL_FALLSPD    0x0800
#define TCF_CAL_ZC_BEAMBLOCK    0x1000 /* Zc has Partial beam blockage correction */
#define TCF_CAL_BEAMBLOCK       0x1000
#define TCF_CAL_ZC_ATTENUATION  0x2000 /* Zc has Intervening attenuation correction */
#define TCF_CAL_ATTENUATION     0x2000 
#define TCF_CAL_ZC_TARGET_DET   0x4000 /* Zc has Target Detection correction */

  char ipad38x2[2] ;

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

  SINT2 iPointClutterThreshold; /* Threshold in dB*100 */
  UINT2 iPointClutterSkip;      /* Side skip in low 4 bits, 0=feature off */

#define TASK_CALIB_INFO_PAD (272)
  char ipad_end[TASK_CALIB_INFO_PAD];
};

struct serv_task_calib_info
{
  /* Various calibration slopes and thresholds
   */
  SINT4 iz_slope;		/* LOG slope in dB*4096/ A/D count */
  
  SINT4 izns_thr;		/* LOG noise threshold in dB*16 */
  SINT4 iccr_thr;		/* Clutter Correction threshold in dB*16 */
  SINT4 isqi_thr;		/* SQI threshold * 256 */
  SINT4 isig_thr;		/* Signal power threshold in dBm*16 */
  SINT4 iz_calib;		/* Calibration reflectivity, dBZ*16 @ 1Km */

    /* Threshold control flags for various parameters.
     */
  UINT4 iuz_tcf;		/* UnCorrected Z flags */
  UINT4 icz_tcf;		/* Corrected Z flags */
  UINT4 ivl_tcf;		/* Velocity flags */
  UINT4 iwd_tcf;		/* Width flags */
  UINT4 izdr_tcf;		/* ZDR flags */

  /* Miscellaneous processing flags.
     */
  UINT4 iflags;
  SINT4 iPointClutterThreshold; /* Threshold in dB*100 */
  UINT4 iPointClutterSkip;      /* Side skip in low 4 bits, 0=feature off */
};

/* -------------------- Task Range Selection Information --------------------*/

#define TASK_RANGE_INFO_SIZE  160
struct  task_range_info 
{
  SINT4 ibin_first;		/* Range of first (input) bin in cm */
  SINT4 ibin_last;		/* Range of last (input) bin in cm */
  SINT2 ibin_in_num;		/* Number of input bins */
  SINT2 ibin_out_num;		/* Number of output bins */

  SINT4 ibin_in_step;		/* Step between input bins in cm */
  SINT4 ibin_out_step;		/* Step between output bins in cm */

  /* If IBIN_VAR is zero the input bins are equally spaced, in which
   * case the input and output bin spacings and any bin averaging are
   * defined.  If IBIN_VAR is non-zero, then it indicates that some
   * type of variable input spacing has been selected.  In that case,
   * there are (up to) 48 bytes reserved to describe the variable
   * format specifically.
   */
  UINT2 ibin_var;		/* Non-Zero ==> variable resolution */

  SINT2 ibin_avg;		/* 0:No Avg,  1:Avg Pairs, ... */
  SINT2 ibin_smooth;		/* 0:No Avg,  1:Avg Pairs, ... */
#define TASK_RANGE_INFO_PAD (134)
  char ipad_end[TASK_RANGE_INFO_PAD];
};

struct  serv_task_range_info 
{
  SINT4 ibin_first;		/* Range of first (input) bin in cm */
  SINT4 ibin_last;		/* Range of last (input) bin in cm */
  SINT4 ibin_in_num;		/* Number of input bins */
  SINT4 ibin_out_num;		/* Number of output bins */

  UINT4 ibin_var;		/* Non-Zero ==> variable resolution */
  SINT4 ibin_in_step;		/* Step between input bins in cm */
  SINT4 ibin_out_step;		/* Step between output bins in cm */
  SINT4 ibin_avg;		/* 0:No Avg,  1:Avg Pairs, ... */
  SINT4 ibin_smooth;		/* 0:No Avg,  1:Avg Pairs, ... */
  char ipad36x12[12] ;
};


/* -------------------- Task Antenna Scan Information --------------------*/
#define TASK_PSCAN_INFO_SIZE (200)

/* --- RHI Azimuth List ---
 *   Starting and ending elevation angles, followed by
 *   AZ list of binary angles 
 */
struct task_rhi_scan_info
{
  UINT2 istartel;
  UINT2 iendel;
  UINT2 iazlst[MAX_SWEEPS];
#define TASK_RHI_SCAN_INFO_PAD (115)
  char ipad_end[TASK_RHI_SCAN_INFO_PAD];
#define TASK_SCAN_RHI_NEAREST  (0)
#define TASK_SCAN_RHI_LOWER    (1)
#define TASK_SCAN_RHI_UPPER    (2)
  UINT1 iStartEnd;            /* Which end of the sector to start at */
};

struct serv_task_rhi_scan_info
{
  UINT4 istartel;
  UINT4 iendel;
  UINT4 iazlst[MAX_SWEEPS];
  UINT4 iStartEnd;
};

/* --- PPI Elevation List ---
 * Actual # of items in IELLST followed by
 * EL list of binary angles
 */
struct task_ppi_scan_info
{
  UINT2 istartaz;
  UINT2 iendaz;
  UINT2 iellst[MAX_SWEEPS];
#define TASK_PPI_SCAN_INFO_PAD (115)
  char ipad_end[TASK_PPI_SCAN_INFO_PAD];
#define TASK_SCAN_PPI_NEAREST  (0)
#define TASK_SCAN_PPI_LEFT     (1)
#define TASK_SCAN_PPI_RIGHT    (2)
  UINT1 iStartEnd;  /* Which end of the sector to start at */
};

struct serv_task_ppi_scan_info
{
  UINT4 istartaz;
  UINT4 iendaz;
  UINT4 iellst[MAX_SWEEPS];
  UINT4 iStartEnd;
};

/* --- File Scan Info ---
 * First azimuth and elevation from the file, followed by
 * the file name.
 */
struct task_file_scan_info
{
  UINT2 ifirstaz;
  UINT2 ifirstel;
  char scan_file[12];		/* Space terminated */
  char ipad[184];
};   

struct serv_task_file_scan_info
{
  UINT4 ifirstaz;
  UINT4 ifirstel;
  char scan_file[12];		/* Space terminated */
};   

/* --- Manual Scan Info --- 
 */
struct task_manual_scan_info
{
#define TCF_SCAN_MAN_CONT_MASK (0x0001)
#define TCF_SCAN_CONT_MASK     (0x0001)
#define TCF_SCAN_SET_AZ        (0x0002)
#define TCF_SCAN_SET_EL        (0x0004)
  UINT2 iman_flags;		/* bit 0: continuous */
#define TASK_MANUAL_SCAN_INFO_PAD (188)
  char  ipad2x2[2];
  BIN4  iStartAz;
  BIN4  iStartEl;
  char ipad_end[TASK_MANUAL_SCAN_INFO_PAD];
};

struct serv_task_manual_scan_info
{
  UINT4 iman_flags;		/* bit 0: continuous */
  BIN4  iStartAz;
  BIN4  iStartEl;
};

#define TASK_SCAN_INFO_SIZE  320
/* The following Union contains scan information, the format of which varies
 * according to the scan mode.
 */
union task_scan_info_u
{
  struct task_rhi_scan_info rhi;
  struct task_ppi_scan_info ppi;
  struct task_file_scan_info fil;
  struct task_manual_scan_info man;
} ;

struct task_scan_info
{
  UINT2 iscan;			/* Antenna Scan Mode (SCAN_xxx) */

  /* IRES is the desired angular resolution expressed as an integer
   * number of thousandths of degrees.  This format was chosen (rather
   * than binary angle) so that user-units of resolution could be
   * expressed exactly.  In manual scans, this is the number of rays
   * to record.
   */
  SINT2 ires1000;

  /* In the PPI scan modes, ISCAN_SPEED indicates the azimuth rotation
   * rate in binary angles per second.  If this value is initially
   * zero, then INGEST will calculate a scan rate based on the other
   * task parameters and overwrite the zero with the computed
   * value.
   */
  BIN2 iscan_speed ;

  SINT2 isweeps;		/* # Sweeps to perform */

  union task_scan_info_u u;

#define TASK_SCAN_INFO_PAD (112)
  char ipad_end[TASK_SCAN_INFO_PAD];
};

/* The following Union contains scan information, the format of which
 * varies according to the scan mode.
 */
union serv_task_scan_info_u
{
  struct serv_task_rhi_scan_info rhi;
  struct serv_task_ppi_scan_info ppi;
  struct serv_task_file_scan_info fil;
  struct serv_task_manual_scan_info man;
} ;

struct serv_task_scan_info
{
  UINT4 iscan;			/* Antenna Scan Mode */

  SINT4 ires1000;
  BIN4  iscan_speed ;
  SINT4 isweeps;		/* # Sweeps to perform */

  union serv_task_scan_info_u u ;
};

/* -------------------- Task Miscellaneous Information -------------------- */

#define TASK_MISC_INFO_SIZE  320
struct task_misc_info 
{
  SINT4 ilambda;		/* Radar wavelength in cm*100 */
  char str_id[16];		/* User's id of xmitter, receiver, etc, space term. */
  SINT4 ixmt_pwr;		/* Transmit power in watts */

  UINT2 iflags;
#define TASK_MSC_DSSIM       0x0001	/* Digital Signal Simulator in use */
#define TASK_MSC_PARTIAL     0x0002	/* Volume scan was halted prematurely */
#define TASK_MSC_KEEP        0x0010	/* Keep this file (WATCHDOG info) */
#define TASK_MSC_CLUTMAP     0x0020	/* File tagged as a clutter map (INGEST info) */

  UINT2 ipolar;			/* Type of polarization, see dsp_lib.h */
  SINT4 itrunc;			/* Truncation height (cm above radar) */
  char  ipad32x18[18];		/* Reserved for polarization description */

  char ipad50x12[12];

  /* Users comments are associated with tasks.  The comment buffer
   * itself is part of the Task Configuration Structure, and the
   * number of bytes inserted in that buffer so far is given below.
   */
  SINT2 icomnt_num;		/*# Bytes of comments */
  BIN4  iHorzBeamWidth;         /* Horizontal full beamwidth */
  BIN4  iVertBeamWidth;         /* Vertical full beamwidth */
  UINT4 iUser[10];              /* Space for users to put things */
#define TASK_MISC_INFO_PAD (208)
  char ipad_end[TASK_MISC_INFO_PAD];
};

struct serv_task_misc_info 
{
  SINT4 ilambda;		/* Radar wavelength in cm*100 */
  char  str_id[16];		/* User's id of xmitter, receiver, etc, space term. */
  SINT4 ixmt_pwr;		/* Transmit power in watts */

  UINT4 iflags;

  UINT4 ipolar;			/* Type of polarization, see dsp_lib.h */

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

  SINT4 icomnt_num;		/* # Bytes of comments */
};

/* -------------------- Task ending structure --------------------------- 
 * Remainder of structure (up to the comment buffer section) must consist of
 * no more than TASK_CONF_END_SIZE bytes. 
 */

#define TASK_CONF_END_SIZE  320 /* Size of struct's end area: */

struct task_end_info
{
  /* The task number consists of a "major" and "minor" number.  The
   * major number is what we usually refer to the task by.  The minor
   * number is used for "hybrid" tasks i.e., when more than one task
   * configuration is used to define an overall task.  If the minor
   * number is zero, then there are no additional tasks. Otherwise the
   * minor numbers represent an ordering of a set of task
   * configurations, all of which have the same major number. The
   * minor numbers always run from 1...N, where N is the total number
   * of tasks involved in this hybrid.
   */
  SINT2 id_major, id_minor;

  /* There are two character strings associated with a task.  One is
   * the task name, i.e., file name of the .TCO file.  The other is an
   * optional brief description of what the task does.  Both strings
   * are end-padded with spaces.
   */
  char stname[12]; 
  char sdscript[80];

  SINT4 ihybrid_count;		/* Number of tasks in this hybrid set */

  /* STATE is the current state of the task.  It can be modified by the menus
   * or INGEST processes.
   */
  UINT2 istate;
#define TASK_VOID         0	/* No task defined here (empty slot) */
#define TASK_MODIFY       1	/* Being modified by someone */
#define TASK_INACTIVE     2	/* Exists, but not used in any way */
#define TASK_SCHED        3	/* Waiting to run */
#define TASK_RUNNING      4	/* Running */

  char  ipad102x2[2];
  struct ymds_time ing_time;    /* Task time, set when running */

#define TASK_END_INFO_PAD (204)
  char ipad_end[TASK_END_INFO_PAD];

};

struct serv_task_end_info
{
  SINT4 id_major, id_minor;
  char stname[12]; 
  char sdscript[80];

  UINT4 istate;

  SINT4 ihybrid_count;		/* Number of tasks in this hybrid set */
};


/* -------------------- Task Configuration Structure -------------------- */

#define TASK_COMNT_SIZE     720          /* Size of Comment buffer */

#define TASK_CONFIG_SIZE ( STRUCT_HEADER_SIZE + TASK_SCHED_INFO_SIZE + \
   TASK_DSP_INFO_SIZE  + TASK_CALIB_INFO_SIZE + TASK_RANGE_INFO_SIZE + \
   TASK_SCAN_INFO_SIZE + TASK_MISC_INFO_SIZE  + TASK_CONF_END_SIZE   + \
   TASK_COMNT_SIZE )

struct task_configuration 
{
  struct structure_header    hdr; 
  struct task_sched_info     sch;
  struct task_dsp_info       dsp;
  struct task_calib_info     cal;
  struct task_range_info     rng;
  struct task_scan_info      scan;
  struct task_misc_info      misc;
  struct task_end_info       end;

  /* The comment buffer is the last part of the Task Configuration
   * Stucture.
   */
  UINT1  comnts[ TASK_COMNT_SIZE ];
};
typedef struct  task_configuration TCF;


/* This structure is for server client communication
 */
struct serv_task_configuration 
{
  struct serv_structure_header    hdr; 
  struct serv_task_sched_info     sch;
  struct serv_task_dsp_info       dsp;
  struct serv_task_calib_info     cal;
  struct serv_task_range_info     rng;
  struct serv_task_scan_info      scan;
  struct serv_task_misc_info      misc;
  struct serv_task_end_info       end;

  /* The comment buffer is the last part of the Task Configuration
   * Stucture.
   */
  UINT1  comnts[ TASK_COMNT_SIZE ];
};
typedef struct  serv_task_configuration STCF;


/* Task configuration summation entry structure
 */
struct task_config_summary
{
  char  stname[16];		/*Null terminated*/
  SINT4 id_major;
  SINT4 id_minor;
  UINT4 istate;
  UINT4 iscan;
  struct dsp_data_mask DataMask;
  UINT4 idata;
  SINT4 ibin_last;
  UINT4 itrig;
  SINT4 iprf;
  SINT4 istart;
  SINT4 istop;
  SINT4 irepeat;
  SINT4 itime_used;
  UINT4 iflag;

  struct TCF_SUMA_STRUC *fwd;
  struct TCF_SUMA_STRUC *rev;
};
typedef struct task_config_summary TCF_SUM;

struct task_schedule
{
  char  sMasterTask[16];	  /* Master task (for Status product passive mode) */
  struct ymds_time MasterIngTime; /* Master task start time */
  char  ipad28x3[3] ;		  /* To help keep size constant */
  UINT1 lIngestPassive ;	  /* Tasks will run in passive mode */
  TCF   tcf[MAX_TSC_SLOTS];	  /* Array of tasks in the schedule */
  SINT2 ihmap[MAX_TSC_SLOTS];	  /* Array of origin1 pointers into above array */
  char  stsc_file[12];		  /* Name of tsc file */
};
typedef struct task_schedule TSC;

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