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

📄 tsip_ifc.h

📁 gps开发专用的源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
 * *************************************************************************
 *
 * Trimble Navigation, Ltd.
 * OEM Products Development Group
 * P.O. Box 3642
 * 645 North Mary Avenue
 * Sunnyvale, California 94088-3642
 *
 * Corporate Headquarter:
 *    Telephone:  (408) 481-8000
 *    Fax:        (408) 481-6005
 *
 * Technical Support Center:
 *    Telephone:  (800) 767-4822	(U.S. and Canada)
 *                (408) 481-6940    (outside U.S. and Canada)
 *    Fax:        (408) 481-6020
 *    BBS:        (408) 481-7800
 *    e-mail:     trimble_support@trimble.com
 *
 * *************************************************************************
 *
 * Vers	Date		   Changes										 Author
 * ----	---------   ----------------------------------------	   ----------
 * v1.40
 * 7.52a			   	matched 7.52 manual							pvwl
 * *************************************************************************
 *
 * This header file contains definitions for general TSIP structures and
 * prototypes for general functions.
 *
 * This source code is supplied without warranty and is intended only as
 * sample source code for exercising the TSIP interface.  We do appreciate
 * comments and try to support the software as much as possible.
 *
 * Developers of new applications are encouraged to use the functions
 * defined in TSIP_IFC.C, and pattern their drivers on the function main()
 * in TSIPCHAT.C
 *
 * *************************************************************************
 *
 */
#define TSIP_H_DEFINED 140
#define TSIP_VERNUM "7.52a"
#define v752

#define FALSE 	(0)
#define TRUE 	(!FALSE)
#define GPS_PI 	(3.1415926535898)
#define	D2R		(GPS_PI/180.0)
#define	R2D		(180.0/GPS_PI)
#define WEEK 	(604800.)
#define MAXCHAN  (8)

/* control characters for TSIP packets */
#define DLE 	(0x10)
#define ETX 	(0x03)

#define MAX_RPTBUF (256)

/* values of TSIPPKT.status */
#define TSIP_PARSED_EMPTY 	0
#define TSIP_PARSED_FULL 	1
#define TSIP_PARSED_DLE_1 	2
#define TSIP_PARSED_DATA 	3
#define TSIP_PARSED_DLE_2 	4

/* TSIP packets have the following structure, whether report or command. */
typedef struct {
	short
		cnt;				/* size of buf; < MAX_RPTBUF unsigned chars */
	unsigned char
		status,			 /* TSIP packet format/parse status */
		code;				/* TSIP code */
	unsigned char
		buf[MAX_RPTBUF];	/* report or command string */
} TSIPPKT;

/* TSIP binary data structures */
typedef struct {
	unsigned char
		t_oa_raw, SV_health;
	float
		e, t_oa, i_0, OMEGADOT, sqrt_A,
		OMEGA_0, omega, M_0, a_f0, a_f1,
		Axis, n, OMEGA_n, ODOT_n, t_zc;
	short
		weeknum, wn_oa;
} ALM_INFO;

typedef struct {     /*  Almanac health page (25) parameters  */
	unsigned char
		WN_a, SV_health[32], t_oa;
} ALH_PARMS;

typedef struct {     /*  Universal Coordinated Time (UTC) parms */
	double
		A_0;
	float
		A_1;
	short
		delta_t_LS;
	float
		t_ot;
	short
		WN_t, WN_LSF, DN, delta_t_LSF;
} UTC_INFO;

typedef struct {      /*  Ionospheric info (float)  */
	float
		alpha_0, alpha_1, alpha_2, alpha_3,
		beta_0, beta_1, beta_2, beta_3;
} ION_INFO;

typedef struct {      /*  Subframe 1 info (float)  */
	short
		weeknum;
	unsigned char
		codeL2, L2Pdata, SVacc_raw, SV_health;
	short
		IODC;
	float
		T_GD, t_oc, a_f2, a_f1, a_f0, SVacc;
} EPHEM_CLOCK;

typedef	struct {     /*  Ephemeris info (float)  */
	unsigned char
		IODE, fit_interval;
	float
		C_rs, delta_n;
	double
		M_0;
	float
		C_uc;
	double
		e;
	float
		C_us;
	double
		sqrt_A;
	float
		t_oe, C_ic;
	double
		OMEGA_0;
	float
		C_is;
	double
		i_0;
	float
		C_rc;
	double
		omega;
	float
		OMEGADOT, IDOT;
	double
		Axis, n, r1me2, OMEGA_n, ODOT_n;
} EPHEM_ORBIT;

typedef struct {     /* Navigation data structure */
	short
		sv_number;     /* SV number (0 = no entry) */
	float
		t_ephem;       /* time of ephemeris collection */
	EPHEM_CLOCK
		ephclk;        /* subframe 1 data */
	EPHEM_ORBIT
		ephorb;        /* ephemeris data */
} NAV_INFO;

typedef struct {
	float
		flt1;
	unsigned char
		chr1, chr2, chr3, chr4;
	float
		flt2, flt3, flt4, flt5;
	unsigned char
		chr5;
} TSIP_POS_FILT_PARMS;

typedef struct {
	unsigned char		bSubcode ;
	unsigned char		bProdOptionsPre ;
	unsigned char 		bProdNumberExt ;
	unsigned short		iCaseSerialNumberPre ;
	unsigned long		iiCaseSerialNumber ;
	unsigned long		iiProdNumber ;
	unsigned short		iReservedOp ;
	unsigned short		iMachineID ;
	unsigned short		iReserved ;
} GL_8x42_DATA ;

typedef struct {
	unsigned char
		bSubcode, 	/* subcode = 03 */
		operating_mode,
		dgps_mode,
		dyn_code,
		reserved04,
		reserved05,
		trackmode,
		reserved07, reserved08,
		reserved09, reserved10,
		reserved11, reserved12,
		reserved13, reserved14;
	float
		elev_mask,
		cno_mask,
		pdop_mask,
		pdop_switch;
	unsigned char
		reserved31, reserved32,
		reserved33, reserved34,
		dgps_age_limit,
		reserved36, reserved37,
		reserved38, reserved39;
} TSIP_RCVR_CFG_03;

typedef struct cph1_datablock_struct {
	unsigned char prn, flagbyte, reserved;
	signed char elev;
	short azim;
	unsigned char signal_strength;
	double pseudorange, carrier_phase;
	float Doppler;
};

typedef struct cph1_msg_struct {
	unsigned char subcode, preamble;
	unsigned short length;
	double receive_time, clock_offset;
	unsigned char numsvs;
	struct cph1_datablock_struct db[MAXCHAN];
	unsigned short checksum;
	unsigned char postamble;
};

/*******************        PROTOYPES            *****************/
/*******************        PROTOYPES            *****************/
/*******************        PROTOYPES            *****************/

/*
 * This routine sends a command to the receiver.  It calls a
 * function sendb() that must be supplied by the user.  All
 * calls to this subroutine are within TSIP_IFC.C.
 */

void send_cmd
	(TSIPPKT *cmd);

/* functions to add a byte from the receiver and "unstuffs" it */
void tsip_input_proc (
	TSIPPKT *rpt, short newbyte);

/**/
/*************************** in TSIP_IFC.C ************************/
/* Functions for low-level serial port access calls.              */
/******************************************************************/
short getb
	(void);
short sendb
	(unsigned char db);


/* gets time of most recent report; returns zero until week number known */
double get_tsip_time (void);

/* functions to get items from a TSIP report packet character buffer */
/* Byte order is reversed for Intel machines; controlled by BYTESWAP */
short bgetint
	(unsigned char *bp);
float bgetsingle
	(unsigned char *bp);
double bgetdouble
	(unsigned char *bp);

/* This routine puts floats into a TSIP command packet character  */
/* buffer.  Byte order is reversed for Intel machines. */
void bputsingle
	(float a, unsigned char *cmdbuf);

/**/
/* prototypes for command-encode primitives with suffix convention:  */
/* c = clear, s = set, q = query, e = enable, d = disable            */
void cmd_0x1Dc (void);
void cmd_0x1Ds (
	float offset);
void cmd_0x1E  (
	unsigned char reset_type);
void cmd_0x1F  (void);
void cmd_0x21  (void);
void cmd_0x23  (
	float pos_ECEF[3]);
void cmd_0x24  (void);
void cmd_0x25  (void);
void cmd_0x26  (void);
void cmd_0x27  (void);
void cmd_0x28  (void);
void cmd_0x29  (void);
void cmd_0x2As  (
	float alt);
void cmd_0x2Ad  (void);
void cmd_0x2Aq  (void);
void cmd_0x2B  (
	float lat,
	float lon,
	float alt);
void cmd_0x2Cq (void);
void cmd_0x2Cs (
	unsigned char dyn_code,
	float elev_mask,
	float snr,
	float dop_mask,
	float dop_switch);
void cmd_0x2D  (void);
void cmd_0x2E  (
	float time_of_week,
	short week_num);
void cmd_0x2F  (void);
void cmd_0x31  (
	float ECEF_pos[3]);
void cmd_0x32  (
	float lat,
	float lon,
	float alt);
void cmd_0x35q (void);

⌨️ 快捷键说明

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