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

📄 refclock_ripencc.c

📁 网络时间协议NTP 源码 版本v4.2.0b 该源码用于linux平台下
💻 C
📖 第 1 页 / 共 5 页
字号:
	float *alt, float *dummy , unsigned char *alt_flag)/* reference altitude parameters */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 9) return TRUE;	*alt = bGetSingle (buf);	*dummy = bGetSingle (&buf[4]);	*alt_flag = buf[8];	return FALSE;}short rpt_0x4B (TSIPPKT *rpt,	unsigned char *machine_id,	unsigned char *status3,	unsigned char *status4)/* machine ID code, status */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 3) return TRUE;	*machine_id = buf[0];	*status3 = buf[1];	*status4 = buf[2];	return FALSE;}short rpt_0x4C (TSIPPKT *rpt,	unsigned char *dyn_code,	float *el_mask,	float *snr_mask,	float *dop_mask,	float *dop_switch)/* operating parameters and masks */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 17) return TRUE;	*dyn_code = buf[0];	*el_mask = bGetSingle (&buf[1]);	*snr_mask = bGetSingle (&buf[5]);	*dop_mask = bGetSingle (&buf[9]);	*dop_switch = bGetSingle (&buf[13]);	return FALSE;}short rpt_0x4D (TSIPPKT *rpt,	float *osc_offset)/* oscillator offset */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 4) return TRUE;	*osc_offset = bGetSingle (buf);	return FALSE;}short rpt_0x4E (TSIPPKT *rpt,	unsigned char *response)/* yes/no response to command to set GPS time */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 1) return TRUE;	*response = buf[0];	return FALSE;}short rpt_0x4F (TSIPPKT *rpt,	double *a0,	float *a1,	float *time_of_data,	short *dt_ls,	short *wn_t,	short *wn_lsf,	short *dn,	short *dt_lsf)/* UTC data */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 26) return TRUE;	*a0 = bGetDouble (buf);	*a1 = bGetSingle (&buf[8]);	*dt_ls = bGetShort (&buf[12]);	*time_of_data = bGetSingle (&buf[14]);	*wn_t = bGetShort (&buf[18]);	*wn_lsf = bGetShort (&buf[20]);	*dn = bGetShort (&buf[22]);	*dt_lsf = bGetShort (&buf[24]);	return FALSE;}/**/short rpt_0x54 (TSIPPKT *rpt,	float *clock_bias,   float *freq_offset,   float *time_of_fix)/* clock offset and frequency offset in 1-SV (0-D) mode */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 12) return TRUE;	*clock_bias = bGetSingle (buf);	*freq_offset = bGetSingle (&buf[4]);	*time_of_fix = bGetSingle (&buf[8]);	return FALSE;}short rpt_0x55 (TSIPPKT *rpt,	unsigned char *pos_code,	unsigned char *vel_code,	unsigned char *time_code,	unsigned char *aux_code)/* I/O serial options */{	unsigned char *buf;	buf = rpt->buf;		if (rpt->len != 4) return TRUE;	*pos_code = buf[0];	*vel_code = buf[1];	*time_code = buf[2];	*aux_code = buf[3];	return FALSE;}short rpt_0x56 (TSIPPKT *rpt,	float vel_ENU[3], float *freq_offset, float *time_of_fix)/* velocity in east-north-up coordinates */	{	unsigned char *buf;	buf = rpt->buf;		if (rpt->len != 20) return TRUE;	/* east */	vel_ENU[0] = bGetSingle (buf);	/* north */	vel_ENU[1] = bGetSingle (&buf[4]);	/* up */	vel_ENU[2] = bGetSingle (&buf[8]);	*freq_offset = bGetSingle (&buf[12]);	*time_of_fix = bGetSingle (&buf[16]);	return FALSE;}short rpt_0x57 (TSIPPKT *rpt,	unsigned char *source_code, unsigned char *diag_code,	short *week_num,	float *time_of_fix)/* info about last computed fix */{	unsigned char *buf;	buf = rpt->buf;		if (rpt->len != 8) return TRUE;	*source_code = buf[0];	*diag_code = buf[1];	*time_of_fix = bGetSingle (&buf[2]);	*week_num = bGetShort (&buf[6]);	return FALSE;}short rpt_0x58 (TSIPPKT *rpt,	unsigned char *op_code, unsigned char *data_type, unsigned char *sv_prn,	unsigned char *data_length, unsigned char *data_packet)/* GPS system data or acknowledgment of GPS system data load */{	unsigned char *buf, *buf4;	short dl;	ALM_INFO* alminfo;	ION_INFO* ioninfo;	UTC_INFO* utcinfo;	NAV_INFO* navinfo;	buf = rpt->buf;	if (buf[0] == 2) {		if (rpt->len < 4) return TRUE;		if (rpt->len != 4+buf[3]) return TRUE;	}	else if (rpt->len != 3) {		return TRUE;	}	*op_code = buf[0];	*data_type = buf[1];	*sv_prn = buf[2];	if (*op_code == 2) {		dl = buf[3];		*data_length = (unsigned char)dl;		buf4 = &buf[4];		switch (*data_type) {		case 2:			/* Almanac */			if (*data_length != sizeof (ALM_INFO)) return TRUE;			alminfo = (ALM_INFO*)data_packet;			alminfo->t_oa_raw  = buf4[0];			alminfo->SV_health = buf4[1];			alminfo->e         = bGetSingle(&buf4[2]);			alminfo->t_oa      = bGetSingle(&buf4[6]);			alminfo->i_0       = bGetSingle(&buf4[10]);			alminfo->OMEGADOT  = bGetSingle(&buf4[14]);			alminfo->sqrt_A    = bGetSingle(&buf4[18]);			alminfo->OMEGA_0   = bGetSingle(&buf4[22]);			alminfo->omega     = bGetSingle(&buf4[26]);			alminfo->M_0       = bGetSingle(&buf4[30]);			alminfo->a_f0      = bGetSingle(&buf4[34]);			alminfo->a_f1      = bGetSingle(&buf4[38]);			alminfo->Axis      = bGetSingle(&buf4[42]);			alminfo->n         = bGetSingle(&buf4[46]);			alminfo->OMEGA_n   = bGetSingle(&buf4[50]);			alminfo->ODOT_n    = bGetSingle(&buf4[54]);			alminfo->t_zc      = bGetSingle(&buf4[58]);			alminfo->weeknum   = bGetShort(&buf4[62]);			alminfo->wn_oa     = bGetShort(&buf4[64]);			break;		case 3:			/* Almanac health page */			if (*data_length != sizeof (ALH_PARMS) + 3) return TRUE;			/* this record is returned raw */			memcpy (data_packet, buf4, dl);			break;		case 4:			/* Ionosphere */			if (*data_length != sizeof (ION_INFO) + 8) return TRUE;			ioninfo = (ION_INFO*)data_packet;			ioninfo->alpha_0   = bGetSingle (&buf4[8]);			ioninfo->alpha_1   = bGetSingle (&buf4[12]);			ioninfo->alpha_2   = bGetSingle (&buf4[16]);			ioninfo->alpha_3   = bGetSingle (&buf4[20]);			ioninfo->beta_0    = bGetSingle (&buf4[24]);			ioninfo->beta_1    = bGetSingle (&buf4[28]);			ioninfo->beta_2    = bGetSingle (&buf4[32]);			ioninfo->beta_3    = bGetSingle (&buf4[36]);			break;		case 5:			/* UTC */			if (*data_length != sizeof (UTC_INFO) + 13) return TRUE;			utcinfo = (UTC_INFO*)data_packet;			utcinfo->A_0       = bGetDouble (&buf4[13]);			utcinfo->A_1       = bGetSingle (&buf4[21]);			utcinfo->delta_t_LS = bGetShort (&buf4[25]);			utcinfo->t_ot      = bGetSingle(&buf4[27]);			utcinfo->WN_t      = bGetShort (&buf4[31]);			utcinfo->WN_LSF    = bGetShort (&buf4[33]);			utcinfo->DN        = bGetShort (&buf4[35]);			utcinfo->delta_t_LSF = bGetShort (&buf4[37]);			break;		case 6:			/* Ephemeris */			if (*data_length != sizeof (NAV_INFO) - 1) return TRUE;			navinfo = (NAV_INFO*)data_packet;			navinfo->sv_number = buf4[0];			navinfo->t_ephem = bGetSingle (&buf4[1]);			navinfo->ephclk.weeknum = bGetShort (&buf4[5]);			navinfo->ephclk.codeL2 = buf4[7];			navinfo->ephclk.L2Pdata = buf4[8];			navinfo->ephclk.SVacc_raw = buf4[9];			navinfo->ephclk.SV_health = buf4[10];			navinfo->ephclk.IODC = bGetShort (&buf4[11]);			navinfo->ephclk.T_GD = bGetSingle (&buf4[13]);			navinfo->ephclk.t_oc = bGetSingle (&buf4[17]);			navinfo->ephclk.a_f2 = bGetSingle (&buf4[21]);			navinfo->ephclk.a_f1 = bGetSingle (&buf4[25]);			navinfo->ephclk.a_f0 = bGetSingle (&buf4[29]);			navinfo->ephclk.SVacc = bGetSingle (&buf4[33]);			navinfo->ephorb.IODE = buf4[37];			navinfo->ephorb.fit_interval = buf4[38];			navinfo->ephorb.C_rs = bGetSingle (&buf4[39]);			navinfo->ephorb.delta_n = bGetSingle (&buf4[43]);			navinfo->ephorb.M_0 = bGetDouble (&buf4[47]);			navinfo->ephorb.C_uc = bGetSingle (&buf4[55]);			navinfo->ephorb.e = bGetDouble (&buf4[59]);			navinfo->ephorb.C_us = bGetSingle (&buf4[67]);			navinfo->ephorb.sqrt_A = bGetDouble (&buf4[71]);			navinfo->ephorb.t_oe = bGetSingle (&buf4[79]);			navinfo->ephorb.C_ic = bGetSingle (&buf4[83]);			navinfo->ephorb.OMEGA_0 = bGetDouble (&buf4[87]);			navinfo->ephorb.C_is = bGetSingle (&buf4[95]);			navinfo->ephorb.i_0 = bGetDouble (&buf4[99]);			navinfo->ephorb.C_rc = bGetSingle (&buf4[107]);			navinfo->ephorb.omega = bGetDouble (&buf4[111]);			navinfo->ephorb.OMEGADOT=bGetSingle (&buf4[119]);			navinfo->ephorb.IDOT = bGetSingle (&buf4[123]);			navinfo->ephorb.Axis = bGetDouble (&buf4[127]);			navinfo->ephorb.n = bGetDouble (&buf4[135]);			navinfo->ephorb.r1me2 = bGetDouble (&buf4[143]);			navinfo->ephorb.OMEGA_n=bGetDouble (&buf4[151]);			navinfo->ephorb.ODOT_n = bGetDouble (&buf4[159]);			break;		}	}	return FALSE;}short rpt_0x59 (TSIPPKT *rpt,	unsigned char *code_type,	unsigned char status_code[32])/* satellite enable/disable or health heed/ignore list */	{	short iprn;	unsigned char *buf;	buf = rpt->buf;		if (rpt->len != 33) return TRUE;	*code_type = buf[0];	for (iprn = 0; iprn < 32; iprn++)		status_code[iprn] = buf[iprn + 1];	return FALSE;}short rpt_0x5A (TSIPPKT *rpt,	unsigned char *sv_prn,	float *sample_length,	float *signal_level,	float *code_phase,	float *Doppler,	double *time_of_fix)/* raw measurement data - code phase/Doppler */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 25) return TRUE;	*sv_prn = buf[0];	*sample_length = bGetSingle (&buf[1]);	*signal_level = bGetSingle (&buf[5]);	*code_phase = bGetSingle (&buf[9]);	*Doppler = bGetSingle (&buf[13]);	*time_of_fix = bGetDouble (&buf[17]);	return FALSE;}short rpt_0x5B (TSIPPKT *rpt,	unsigned char *sv_prn,	unsigned char *sv_health,	unsigned char *sv_iode,	unsigned char *fit_interval_flag,	float *time_of_collection,	float *time_of_eph,	float *sv_accy)/* satellite ephorb status */	{	unsigned char *buf;	buf = rpt->buf;		if (rpt->len != 16) return TRUE;	*sv_prn = buf[0];	*time_of_collection = bGetSingle (&buf[1]);	*sv_health = buf[5];	*sv_iode = buf[6];	*time_of_eph = bGetSingle (&buf[7]);	*fit_interval_flag = buf[11];	*sv_accy = bGetSingle (&buf[12]);	return FALSE;}short rpt_0x5C (TSIPPKT *rpt,	unsigned char *sv_prn,	unsigned char *slot,	unsigned char *chan,	unsigned char *acq_flag,	unsigned char *eph_flag,	float *signal_level,	float *time_of_last_msmt,	float *elev,	float *azim,	unsigned char *old_msmt_flag,	unsigned char *integer_msec_flag,	unsigned char *bad_data_flag,	unsigned char *data_collect_flag)/* satellite tracking status */{	unsigned char *buf;	buf = rpt->buf;		if (rpt->len != 24) return TRUE;	*sv_prn = buf[0];	*slot = (unsigned char)((buf[1] & 0x07) + 1);	*chan = (unsigned char)(buf[1] >> 3);	if (*chan == 0x10) *chan = 2;	else (*chan)++;	*acq_flag = buf[2];	*eph_flag = buf[3];	*signal_level = bGetSingle (&buf[4]);	*time_of_last_msmt = bGetSingle (&buf[8]);	*elev = bGetSingle (&buf[12]);	*azim = bGetSingle (&buf[16]);	*old_msmt_flag = buf[20];	*integer_msec_flag = buf[21];	*bad_data_flag = buf[22];	*data_collect_flag = buf[23];	return FALSE;}/**/short rpt_0x6D (TSIPPKT *rpt,	unsigned char *manual_mode,	unsigned char *nsvs,	unsigned char *ndim,	unsigned char sv_prn[],	float *pdop,	float *hdop,	float *vdop,	float *tdop)/* over-determined satellite selection for position fixes, PDOP, fix mode */{	short islot;	unsigned char *buf;	buf = rpt->buf;	*nsvs = (unsigned char)((buf[0] & 0xF0) >> 4);	if ((*nsvs)>8) return TRUE;	if (rpt->len != 17 + (*nsvs) ) return TRUE;	*manual_mode = (unsigned char)(buf[0] & 0x08);	*ndim  = (unsigned char)((buf[0] & 0x07));	*pdop = bGetSingle (&buf[1]);	*hdop = bGetSingle (&buf[5]);	*vdop = bGetSingle (&buf[9]);	*tdop = bGetSingle (&buf[13]);	for (islot = 0; islot < (*nsvs); islot++)		sv_prn[islot] = buf[islot + 17];	return FALSE;}/**/short rpt_0x82 (TSIPPKT *rpt,	unsigned char *diff_mode)/* differential fix mode */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 1) return TRUE;	*diff_mode = buf[0];	return FALSE;}short rpt_0x83 (TSIPPKT *rpt,	double ECEF_pos[3],	double *clock_bias,	float *time_of_fix)/* position, ECEF double precision */{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 36) return TRUE;	ECEF_pos[0] = bGetDouble (buf);	ECEF_pos[1] = bGetDouble (&buf[8]);	ECEF_pos[2] = bGetDouble (&buf[16]);	*clock_bias  = bGetDouble (&buf[24]);	*time_of_fix = bGetSingle (&buf[32]);	return FALSE;}short rpt_0x84 (TSIPPKT *rpt,	double *lat,	double *lon,	double *alt,	double *clock_bias,	float *time_of_fix)/* position, lat-lon-alt double precision */	{	unsigned char *buf;	buf = rpt->buf;	if (rpt->len != 36) return TRUE;	*lat = bGetDouble (buf);	*lon = bGetDouble (&buf[8]);	*alt = bGetDouble (&buf[16]);	*clock_bias = bGetDouble (&buf[24]);	*time_of_fix = bGetSingle (&buf[32]);	return FALSE;}short rpt_Paly0xBB(TSIPPKT *rpt,	TSIP_RCVR_CFG *TsipxBB){	unsigned char *buf;	buf = rpt->buf;	/* Palisade is inconsistent with other TSIP, which has a kength of 40 */	/* if (rpt->len != 40) return TRUE; */	if (rpt->len != 43) return TRUE;	TsipxBB->bSubcode		=	buf[0];	TsipxBB->operating_mode	=	buf[1]	;	TsipxBB->dyn_code			=	buf[3]	;	TsipxBB->elev_mask		=  bGetSingle (&buf[5]);	TsipxBB->cno_mask			=	bGetSingle (&buf[9]);	TsipxBB->dop_mask 		=  bGetSingle (&buf[13]);	TsipxBB->dop_switch 	=  bGetSingle (&buf[17]);	return FALSE;}short rpt_0xBC (TSIPPKT *rpt,	unsigned char *port_num,   unsigned char *in_baud,	unsigned char *out_baud,  

⌨️ 快捷键说明

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