⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 g7to.h

📁 这是经典的卫星编程应用程序
💻 H
📖 第 1 页 / 共 4 页
字号:
#define STARTLOWR	2448623L 	// Julian date for 00:00 01/01/1992 
#define GARMIN_BAUD_RATE	9600
#define LOWR_BAUD_RATE		115200L
#define	COM_SETTINGS	(BITS_8 | STOP_1 | NO_PARITY)
#define NOPARITY            0
#define ODDPARITY           1
#define EVENPARITY          2
#define MARKPARITY          3
#define SPACEPARITY         4
#define ONESTOPBIT          0
#define ONE5STOPBITS        1
#define TWOSTOPBITS         2
#define BYTESIZE			8

extern INT datatype;

extern INT LwrStartPt;				// Set to # in LEI unit where waypoint upload is to start.
extern INT LwrRangeLo;				// If retrieving a range of waypoints from a LEI unit this
                                    //  is the start waypoint #
extern INT LwrRangeHi;				// If retrieving a range of waypoints from a LEI unit this
                                    //  is the finish waypoint #

extern INT D105orD106;				// 1 if current waypoint is to/from a D105 or D106 record

extern INT	Product_ID;				// 72  GPS III  	... 
extern INT	Product_Ver;			// 000 - all		...

extern INT ProductDataProtocol;     // 000 - A000		A000  ALL GPS's support this

extern INT PhysicalProtocol;		// 000 - P000		P000

extern INT	LinkProtocol;			// 001 = L001		L001,L002

extern INT	CommandProtocol;		// 010 = A010		A010,A011

extern INT	WaypXferProtocol;		// 100 = A100		A100
extern INT	WaypDataRecord;			// 104 = D104		D100,D101,D102,D103,D104,D105,D106,D150
									//					D151,D152,D154,D155

extern INT RouteXferProtocol;		// 200 = A200		A200
extern INT RouteHdrType;			// 201 = D201		D200,D201,D202
extern INT	RouteDataRecord;		// 104 = D104		D100,D101,D102,D103,D104,D105,D106,D150
									//					D151,D152,D154,D155

extern INT TrackXferProtocol;		// 300 = A300		A300
extern INT	TrackDataRecord;		// 300 = D300		D300

extern INT ProxXferProtocol;		//  -1 = None		A400
extern INT	ProxDataRecord;			//  -1 = None		D101,D102,D152,D400,D403,D450


extern INT	AlmanacXferProtocol;	// 500 = A500		A500
extern INT AlmanacDataRecord;		// 501 = D501		D500,D501,D550,D551

extern INT UTCXferProtocol;			// 600 = A600		A600
extern INT UTCDataRecord;			// 600 = D600		D600

extern INT	PositionXferProtocol;	// 700 = A700		A700
extern INT PositionDataRecord;		// 700 = D700		D700

extern INT PVTXferProtocol;			// 000 = None		A800
extern INT PVTDataRecord;			// 000 = None		D800

extern INT haveProtocolArray;		// set to 1 if the GPS sends a protocol array

extern INT Protocols[55][12];
extern INT ProtocolIndex;			// index into above table which holds the valid
extern char outputdatum[150];
extern char inputdatum[150];
extern INT nameonly;     			// Handles comment and symbol display options
extern BYTE *SerialMessage;
extern BYTE *SerialMessageOut;
extern BYTE *message;
extern short SerialMsgLen;
//=====================================================================
// File names
//
extern char	*fname_in_all;	 		// current input file
extern char	*fname_out_all;			// current output file
extern char	*os;
//
// File Stream designators
//
extern FILE	*in;
extern FILE	*out;
extern FILE	*trks_out;				// used when sending internal track rcords to a file
extern FILE	*Gdebug_out;			// send serial debug info to this file

extern double	UTMa, UTMf;			// Used in conversion to UTM
extern INT SendLowrInactives;		// set to 1 if inactive waypoints are not to be sent
extern INT to_lowr_track;			// 0,1,2 for 'normal' or to track1 or track2
extern long	port_speed;				// Serial port baud rate
extern long via;					// set to 1 if point is a 'Via' in sa6
extern INT		default_Garmin_icon;// default icon used in icon type conversion
extern INT		default_G12_icon;
extern INT		default_SA5_icon;
extern INT		default_GM2_icon;
extern INT		default_SA52_icon;
extern INT		default_LWR_icon;
extern INT		Gdebug;					// ==1, record input & output RS232
extern char    outfmt[10];				// holds protocol output format
extern long	interval;					// used in get position command
extern INT		Garmin_NAKS_Sent;		// number of NAKs sent to Garmin GPS this session
extern INT		Lowr_NAKS_Sent;			// number of NAKs sent to Lowrance GPS this session
extern unsigned char recordtype;		// record type being sent
extern unsigned INT valid_records;		// number of valid records from input file
extern double	minlat,maxlat;			// min/max latitude.  SA4 Center of map calc
extern double  minlon,maxlon;			// min/max longitude.  SA4 Center of map calc
extern double  NoProximity;				// number of proximity waypoints found
extern INT		proximity;				// processing a proximity waypoint
extern INT		doAsyncStat;			// if 1 print stats from rs232 port
extern INT		new_com;				// if 1 a new com port has been input
extern INT		no_N;					// set to 0 if a 'N' record is read
extern INT		total_dist;				// flag to total distance of track line
extern double	track_d;				// distance of current track segment
extern double	sum_dist;				// total distance of all track segments
extern INT		satnum;					// satellite number for doAlmanac
extern INT		COMtimeout;				// Set to 1 on a receiver timeout
extern INT		PVTvar;					// used in getting PVT data
extern INT		sa_fileout;				// 1 if any output file has suffix .sa(3/4/5)
//
// SA output drawing options
//
extern INT		draw_route_1_19_obj;	// if 1 route waypoints are plotted on sa output
extern INT		draw_route_0;			// if 1 route 0 is drawn in sa4 output
extern INT		draw_route_0_obj;		// if 1 route 0 waypoints are plotted on sa4 output
extern INT		draw_track_lines;		// if 1 track lines are plotted on sa output
extern INT		draw_route_0_line;		// if the output is to an SA5 file lines are drawn
                            			// for route 0
extern INT		draw_route_1_19_lines;	// if 1 draw lines between route points
										//  in routes 1-19 when output is SA4
extern INT		draw_prox_circles;		// if 1 prox waypoints are plotted on sa output
extern INT		draw_waypoints;			// if 1 waypoints are plotted on sa output

extern INT		route_lines;			// Number of lines needed to draw routes
extern INT 		route_pushed;			// set to 1 when a route 0-19 is read
										//  from a SA file

extern INT		gotID;					// set to 1 when the connected GPS has been
										//  ID'd
extern unsigned	INT maxtrkptrs;			// maximum no of track points
extern unsigned	INT maxiconptrs;		// maximum no of icons
//
// used in resending last message
//
extern BYTE 	*LastLowrGPSMsg;
extern BYTE 	*LastGarminGPSMsg;
extern short	LastLowrLen;
extern short	LastGarminLen;
//
// Global variables
//
extern int		UTM;					// Set to one if output is to be UTM
extern INT		dataread;				// Set to 1 when data is read from a GPS
extern char		*Text;					// Used in 'pushing' items
extern INT		route0;					// nth point in route 0
extern INT		Sused;					// Sxxxxx already used up to here
extern long		ZeroL;					// a long 0
extern char		*infiles[20];			// array of input files
extern INT		current_in;				// index into infiles[] for current file
extern INT		input_files;			// number of input files
extern INT		in_file;				// file system file input found
extern char		*outfiles[20];			// array of output files
extern INT		output_files;			// number of output files
extern char		**waypoint_push;		// array of pointer to save waypoints
extern int		waypoints;				// Number of waypoints read into memory
extern char		**track_push;			// array of pointer to save track waypoints
extern char		**icon_push;			// array of pointer to save track waypoints
extern unsigned INT tracks;				// Number of track entries pushed into memory
extern unsigned INT icons;				// Number of icon entries pushed into memory
extern char 	**proximity_push;		// array of pointer to save proximity
extern INT		proximityp;				// Number of proximity waypoints read
extern INT		next_is_new;			// set to 1 when a 'N' record is read
										// and set to 0 when a 'T' record is read

extern INT 		*routeXpts;				// # of waypoints in route number 'x' is
										//    held in routeXpts[x]
extern char		*route_push[MAXROUTES+1][MAXPOINTS+1];// array of pointers to save route
extern INT		routes;					// Number of route points in route 1-> MAXROUTE
extern char		*route_comment;			// route name of current route 
extern INT		route_number;			// route number of current route
extern INT		route_points;			// route number of current route
extern INT		route_point;			// point number in current route
extern char		*routename1;			// used in sa3 -> text for routes
extern INT		in_route;				// set to 1 if reading a route
extern char		rtn[4];					// ASCII of current route number
extern INT		in_track;				// set to 1 if reading a track
extern INT		first_track;			// set to 1 if outputting first track point
										//  after an 'N' record
extern INT		first_track_push;		// pushing the first track
extern INT		first_icon_push;		// pushing the first icon
extern INT		first_waypoint_push;	// pushing the first waypoint
extern INT		first_proximity_push;	// pushing the first proximity waypoint
extern INT		trk_seg;				// number of track segments read
extern INT		*trks;					// elements in xth track seg
extern INT		cur_trk;				// track element currently being read
extern INT		nosort;					//  if 0 waypoints are sorted on input

extern INT 		symb;					// 1 = reading SA Symbol
										// 2 = reading SA Line
										// 3 = reading SA Circle
extern INT		mapCir;					// number of circles read from map

extern char		*drive;					// used by fnsplit
extern char		*dir;					// used by fnsplit
extern char		*file;					// used by fnsplit
extern char		*ext;					// used by fnsplit
extern INT		flags;					// used by fnsplit

extern INT		opterr ;				// argument expansion variable
extern INT		optind ;				// argument expansion variable
extern INT		optopt;					// argument expansion variable
extern char		*optarg;				// argument expansion variable

extern INT		IOaddr;					// COM port I/O address
extern INT		IRQnumber;				// COM port IRQ
extern INT		nocmdline;				// set to 1 if sa3->text is to have
										//   command lines

extern INT		firstR;					// used in nav.exe route processing
extern INT		firstW;					// used in nav.exe route processing

extern INT		input;					// we have valid input to process
extern INT		output;					// we have valid output	to process

extern INT		pwr;					// power off to GPS flag
extern INT		light;					// Backlight on (1) off (0)
extern INT		contrast_val;			// Set Contrast value
extern double  InternalVolts;			// Internal (AA) voltage returned by Garmin
extern double  ExternalVolts;			// External voltage returned by Garmin

/*
 * Structures
 */

extern INT	two;
extern INT	ObjCode;
extern double	setlat;
extern double	setlon;
extern double	lastlat;
extern double	lastlon;

extern INT	setmag;

extern INT 	Last_ObjSize;
extern INT 	Last_ObjColor;
extern INT 	Last_TextSize;
extern INT 	Last_TextColor;
extern INT 	Last_TextAlign;

extern INT 	Last_LineColor;
extern INT 	Last_LineWidth;
extern INT 	Last_LineStyle;

extern INT		Last_CirLineDraw;
extern INT		Last_CirFillArea;
extern INT		Last_CirLineColor;
extern INT		Last_CirLineWidth;
extern INT 	Last_CirFillColor;
extern INT 	Last_CirFillStyle;

//
// 
extern char LowrProducts[20][17];
extern char days[7][4];
extern char months[13][4];

extern unsigned char *genConst;
//===================================================================
extern INT		LowrType;		// 1=Track 1,  2=Track 2, 3=Waypoints
								// 4=Routes,   5=Icons

extern INT		g45type;		// 1=Tracks,  2=Waypoints, 3=Routes
								// 4=iD,      5=tIme,      6=Position
								// 7=Almanac, 8=proXimity waypoints 
								// 9=Voltages 10=Light on, 11=Light off

extern INT intype;				// 	1=txt/gd7 		2=GARMIN GPS i/o 3=SA3
								//  4=almanac data	5=Navigate route 6=SA4
								//  7=unused        8=SA gpl file    9=CSV
								// 10=Fugawi wpt   11=Fugawi track	12=OZI_OWP
								// 13=             14=               5=LOWRANCE GPS i/o
								// 99=GERROR

extern long	numrecords;			// number of input records in file
extern unsigned INT s4o_trk_recs;  // number of line objects in SA4 file
extern INT 	firstwaypoint;
extern INT 	firstPwaypoint;
extern INT 	firsttrackpoint;


extern char	*p;					// general pointer for string functions
extern char	*buf;				// general string

extern unsigned long LatConst;
extern unsigned long LonConst;
extern double	LatC,LonC;

extern INT	sa3number;  		// number of 'items' written to a SA file 
extern INT	Id,
		MagC,
		Mapfeatures;

extern char	*MapTitle;

extern INT	nameonlytxt0;
extern INT	nameonly0; 	// Handles comment and symbol display options
						
						// 0  - all items written
						// 1  - comment not written on regular waypoints
						// 2  - comment not written on route waypoints
						// 4  - the symbol display  parameter not written
						// 8  - route name is not written on first route point

extern INT	noname;		// 1 = no text info is output into SA files
extern INT	ShowGrids, NumObjs;
extern INT	ObjColor,TextColor,TextSize,ObjSize,TextAlign;
extern INT	LineWidth,LineColor,LineStyle;
extern INT	Route_LineWidth,Route_LineColor,Route_LineStyle;

extern INT	CirLineWidth,CirLineColor,CirFillStyle;
extern INT	CirLineDraw,CirFillArea,CirFillColor;

extern INT	ItemType,
		Item;

extern unsigned char MtLen;
extern unsigned long Const1;

extern BYTE	*bin;
extern INT	optchar;
extern INT	navmode,		// 1 = navigate.exe output
    	tmode,				// 1 = text output desired
    	g6,	 				// 1 = garmin64 output
    	s3o,				// 1 = output is sa3 file
		s4o,				// 1 = output is sa4 file
    	s5o,				// 1 = output is sa5 file
    	s6o,				// 1 = output is sa6 file
		gpl_out,			// 1 = output is to SA .gpl file
		csv_out,			// 1 = output is a comma separated file
		getGarminDisp,		// 1 = output GPS III/SP display to a file
		DisplayIsLowrance,	// if set to 1 then Lowrance display is output to .bmp
							//   instead of a Garmin Display
		oziwpt,				// 1 = output is a OziExplorer Saved wpt file
		ozievt,				// 1 = output is a OziExplorer Exported wpt file
		oziplt,				// 1 = output is a Ozi track (plot) file
		ozirte,				// 1 = output is a Ozi route file
		fugawiwpt,			// 1 = output is a FUGAWI wpt file
		fugawitrk,			// 1 = output is a FUGAWI trk file
		igctrackout,	  	// 1 = output is "B" record in an IGC file
		waypoint2trk;		// 1 = output waypoints as a track file

extern INT Lwrout;          // set to 1 is a lowrance unit is one of the outputs
extern INT G45out;          // set to 1 is a Garmin unit is one of the outputs
extern char align[8][3];
extern char sizes[5][3];
extern char colors[5][7];
extern char width[5][3];
extern char style[3][3];
extern char noyes[2][2];
extern INT Isat;  
extern void writeroute(void);
extern void write_mt_waypoints(void);
extern INT routepoint;
extern INT  SPWptNo;
extern BYTE *StreetPilotWptName;
extern BYTE *StreetPilotLnk_ident;
extern BYTE StreetPilotclass;

extern unsigned INT SWVersion;
extern INT ok;
extern char *Text;
extern INT proximity;
extern BYTE	p1[]	; // "\x06\x02\x1b\x00";	// Get 1st packet
extern BYTE	p2[]	; // "\x06\x02\x0c\x00";	// Get last packet
extern BYTE	rte2[]	; // "\x06\x02\x1d\x00";	// Get next route packet
extern BYTE	alm2[]	; // "\x06\x02\x1f\x00";	// Get next almanac packet
extern BYTE	trk2[]	; // "\x06\x02\x22\x00";	// Get next track packet
extern BYTE	wpt2[]	; // "\x06\x02\x23\x00";	// Get next waypoint packet
extern BYTE	ack1[]	; // "\x06\x02\xff\x00";	// ack for received mod/ver info

extern BYTE	Gabort[]; // "\x0a\x02\x00\x00";	// Abort Transfer
extern BYTE	alm1[]	; // "\x0a\x02\x01\x00";	// Send almanac
extern BYTE	GPSPos[]; // "\x0a\x02\x02\x00";	// send position
extern BYTE	pwpt1[]	; // "\x0a\x02\x03\x00";	// send Proximity waypoints
extern BYTE	rte1[]	; // "\x0a\x02\x04\x00";	// send routes
extern BYTE	display[];// "\x0a\x02\x20\x00";	// send gps III display
extern BYTE	GPStime[];// "\x0a\x02\x05\x00";	// send UTC time
extern BYTE	trk1[]	; // "\x0a\x02\x06\x00";	// send tracks
extern BYTE	wpt1[]	; // "\x0a\x02\x07\x00";	// send waypoints
extern BYTE	pwroff[]; // "\x0a\x02\x08\x00";	// Power off command
extern BYTE	VoltsM[]; // "\x0a\x02\x11\x00";	// send voltages
extern BYTE	PVTon[] ; // "\x0a\x02\x31\x00";	// start sending PVT records
extern BYTE	PVToff[]; // "\x0a\x02\x32\x00";	// stop sending PVT records

extern BYTE	almt[]	; // "\x0c\x02\x01\x00";	// Almanac data base terminator
extern BYTE	prxt[]	; // "\x0c\x02\x03\x00";	// Proximity data base terminator
extern BYTE	rtet[]	; // "\x0c\x02\x04\x00";	// Route data base terminator
extern BYTE	trkt[]	; // "\x0c\x02\x06\x00";	// Track data base terminator
extern BYTE	wptt[]	; // "\x0c\x02\x07\x00";	// Waypoint data base terminator

extern BYTE	nak1[]	; // "\x15\x02\xff\x00";	// nak for received mod/ver info

extern BYTE	bgnxfr[]; // "\x1b\x02\x00\x00";   // 0000 filled in with number

extern BYTE	lighton[]; //  "\x0f\x01\x00";		// send light on (some units)
extern BYTE	lightoff[]; // "\x0f\x01\x01";		// send light off (some units)
extern BYTE	lightiiP[]; // "\x0f\x01\x80";		// send light on II+
extern BYTE	contrast[]; // "\x0b\x01\x08";		// set contrast
extern BYTE	m1[]	  ; // "\xfe\x01\x20";		// Get the model and version number
extern INT VersionSubStrings;
extern char VersionString[99];  /* model/version in string format    */
extern char *VersionSubString[10];// version substrings
extern BYTE newTrack;  		/* 255 no track records this session */
extern INT	AlmanacEOF;
extern INT	RouteEOF;
extern INT	TrackEOF;
extern INT	ProxWaypointEOF;
extern INT	ProxWaypointEOF;
extern INT	WaypointEOF;
extern INT	WinNT;
extern unsigned INT len;               // misc length param

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -