/* ***********************************************************
 * *                                                         *
 * *           Header file for the Scan Library              *
 * *                                                         *
 * ***********************************************************
 * File: include/scan_lib.h
 *
 *                       COPYRIGHT (c) 2002  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.
 */
#ifndef SIGMET_SCAN_LIB_H
#define SIGMET_SCAN_LIB_H 1

/*
 * Maximum number of sweeps which are allowed in a task.
 */
#define SCAN_MAX_SWEEPS   (40)

struct scan_ray_header  /* This structure needs more work */
{
  BIN2 iAzimuth;
  BIN2 iElevation;
};

/*
 * Note that this is an opaque structure.  You do not need to
 * know the internal details.
 */
struct scan_sweep_definition;

/*
 * Typedefs for the various callback procedures
 */
typedef void  (*ScanDataProc)(const scan_ray_header *pHeader, const UINT1 *pData );
typedef UINT1 (*ScanFlagProc)( void );
typedef void  (*ScanNotifyProc)( void );

/* ********************************************
 * *                                          *
 * * Function Prototypes for Library Routines *
 * *                                          *
 * ********************************************
 */

/* Class used to construct a sweep definition */
class ScanSweep
{
 public:
  ScanSweep();          /* Constructor */

  void SetPrf( SINT4 iPrf, SINT4 iPw, UINT4 iDualCase );
  void SetSectorPrfs( BIN2 iSec1, SINT4 iPrf1, BIN2 iSec2, SINT4 iPrf2, BIN2 iSec3, SINT4 iPrf3 );
  void SetFixedAngle( BIN2 iAngle );
  void SetScanSpeed( FLT4  fSpeed );    /* Speed in degrees/second */
  void SetAngleResolution( FLT4 fResolution );  /* Res in degrees, 360/fRes must be integer */
  void SetRanges( FLT4 fStart, FLT4 fStep, SINT4 iCount ); /* In km */

#define SCAN_TYPE_BATCH      (0)
#define SCAN_TYPE_SURV       (1)
#define SCAN_TYPE_DOPPLER    (2)
  void SetScanType( UINT4 iType );  /* Choices are BATCH, SURV, DOPPLER */
  void SetThresholds( UINT2 iThreshold );  /* not defined yet */
  void SetClutterTable( UINT1 iTable, SINT4 iRangeSize, SINT4 iAzimuthSize );

 private:
  scan_sweep_definition *pSweep;
  
};

/* Class used to construct a task definition */
class ScanTask
{
 public:
  ScanTask( SINT4 iSweepCount );          /* Constructor */
  ~ScanTask( );                           /* Destructor */
  void SetGeometry( UINT4 iGeometry );  /* Set PPI, RHI, etc */
  void SetDataCallback( ScanDataProc *Proc );
  void SetInterrupt( ScanFlagProc Interrupt );
  void SetTaskStartCallback( ScanNotifyProc *Interrupt );
  void SetSweepStartCallback( ScanNotifyProc *Interrupt );
  void SetTaskEndCallback( ScanNotifyProc *Interrupt );
  void SetSweepEndCallback( ScanNotifyProc *Interrupt );
  ScanSweep GetSweep( SINT4 iSweep );  /* Origin zero */

 private:
  ScanSweep *Sweeps;
  UINT4  iSweepCount;   /* Number of sweeps in the task */

};

/* function used to run a task.  This function will return only
 * at the end of a task.
 */

MESSAGE RunTask( ScanTask Task );

#endif /* #ifndef SIGMET_SCAN_LIB_H */
