/**---------------------------------------------------------------------------
 ** 
 ** gps.h -- 
 ** 
 ** Author          : Pierre Jaccard
 ** Created On      : 1999/08/03 22:00:54
 ** Last Modified By: Pierre Jaccard
 ** Last Modified On: 1999/08/03 22:08:37
 ** Update Count    : 7
 ** Directory       : /home/pego/pcd1/codas3c/gfi/src/apps/nav/
 ** Version         : 0.0
 ** Status          : Unknown
 ** ---------------------------------------------------------------------- ** 
 ** DESCRIPTION: 
 ** 
 **    Undocumented.
 ** 
 ** ---------------------------------------------------------------------- ** 
 ** REVISIONS: 
 ** ---------------------------------------------------------------------- ** 
 ** CHANGES: 
 **------------------------------------------------------------------------**/

#include "geninc.h"
#include "ioserv.h"
#include "dbsource.h"
#include "use_db.h"
#include "gfimisc.h"

/* ------------------------------------------------------------------
	 -Definitions:
	 ------------------------------------------------------------------ */

#define ONLY_GOOD_FIX_CODE 0
#define LON_180_CODE       1

#define ONLY_GOOD_FIX_BIT   ((ULONG) to_bit(ONLY_GOOD_FIX_CODE))
#define LON_180_BIT   ((ULONG) to_bit(LON_180_CODE))

#define NO_FIX     0
#define GOOD_FIX   1
#define BAD_FIX   -1
#define NEXT_FIX  -2

/* ------------------------------------------------------------------
	 -Type Definitions:
	 ------------------------------------------------------------------ */

typedef struct
{
	double start, end;
} FIX_RANGE_TYPE;

typedef struct
{
	int day_0;
	FIX_RANGE_TYPE day, lon, lat;
} GPS_RANGE_TYPE;

typedef struct 
{ 
	BYTE status;
	double day, lon, lat;
	FILE_NAME_TYPE file;
	FILE *fp;
	int day_0;
	GPS_RANGE_TYPE gps;
} GPS_FIX_TYPE;

/* ------------------------------------------------------------------
	 -Global Variables:
	 ------------------------------------------------------------------ */

static int year_base; 
static FILE_NAME_TYPE dbname;
FILE_NAME_TYPE gps_out_file, gps_lst_file;
int tolerance;
ULONG control_bits = 0x0;

/* ------------------------------------------------------------------
	 -Parameters:
	 ------------------------------------------------------------------ */

static PARAMETER_LIST_ENTRY_TYPE parameters[] =
{
	{ " dbname:"     , " %79s", dbname,              TYPE_STRING },
	{ " year_base:"  , " %d"  , (char *) &year_base, TYPE_INT    },
	{ " gps_list:"   , " %79s", gps_lst_file,        TYPE_STRING },
	{ " output:"     , " %79s", gps_out_file,        TYPE_STRING },
	{ " tolerance="   , " %d" , (char *) &tolerance, TYPE_INT    },
	{ (char *) NULL, (char *) NULL, NULL, 0 }
};

/* ------------------------------------------------------------------
	 -Options:
	 ------------------------------------------------------------------ */

static OPTION_TYPE options[]=
{
	{"end", 0, NULL, (char *) NULL},
	{"OPTIONS:", 0, NULL, (char *) NULL},
	{"only_good_fixes", ONLY_GOOD_FIX_CODE, set_long_bit, 
	 (char *) &control_bits },
	{"longitude_180",   LON_180_CODE,       set_long_bit, 
	 (char *) &control_bits },
	{NULL, 0, NULL, (char *) NULL}
};









