📄 tsip_rpt.c
字号:
{
unsigned char
op_code, data_type, sv_prn,
data_length, data_packet[250];
ALM_INFO
*almanac;
ALH_PARMS
*almh;
UTC_INFO
*utc;
ION_INFO
*ionosphere;
EPHEM_CLOCK
*cdata;
EPHEM_ORBIT
*edata;
NAV_INFO
*nav_data;
unsigned char
curr_t_oa;
short
curr_wn_oa;
const char
*datname[MAX_DAT_MESSAGE] =
{"", "", "Almanac",
"Health Page, T_oa, WN_oa", "Ionosphere", "UTC ",
"Ephemeris"};
/* unload rptbuf */
if (rpt_0x58 (rpt, &op_code, &data_type, &sv_prn,
&data_length, data_packet)) {
parsed = BADLEN_PARSE;
return;
}
xprintf ("System data [%d]: %s SV%2.2d",
data_type, datname[data_type], sv_prn);
switch (op_code)
{
case 1:
xprintf (" Acknowledged");
show_crlf ();
break;
case 2:
xprintf (" length = %d bytes", data_length);
show_crlf ();
switch (data_type) {
case 2:
/* Almanac */
if (sv_prn == 0 || sv_prn > 32) {
xprintf ("Binary PRN invalid");
return;
}
almanac = (ALM_INFO*)data_packet;
xprintf ("t_oa_raw = %12d ", almanac->t_oa_raw );
xprintf ("SV_hlth = %12d ", almanac->SV_health );
show_crlf ();
xprintf ("e = % -12g ", almanac->e );
xprintf ("t_oa = % -12g ", almanac->t_oa );
show_crlf ();
xprintf ("i_0 = % -12g ", almanac->i_0 );
xprintf ("OMEGADOT = % -12g ", almanac->OMEGADOT );
show_crlf ();
xprintf ("sqrt_A = % -12g ", almanac->sqrt_A );
xprintf ("OMEGA_0 = % -12g ", almanac->OMEGA_0 );
show_crlf ();
xprintf ("omega = % -12g ", almanac->omega );
xprintf ("M_0 = % -12g ", almanac->M_0 );
show_crlf ();
xprintf ("a_f0 = % -12g ", almanac->a_f0 );
xprintf ("a_f1 = % -12g ", almanac->a_f1 );
show_crlf ();
xprintf ("Axis = % -12g ", almanac->Axis );
xprintf ("n = % -12g ", almanac->n );
show_crlf ();
xprintf ("OMEGA_n = % -12g ", almanac->OMEGA_n );
xprintf ("ODOT_n = % -12g ", almanac->ODOT_n );
show_crlf ();
xprintf ("t_zc = % -12g ", almanac->t_zc );
xprintf ("weeknum = %12d ", almanac->weeknum );
show_crlf ();
xprintf ("wn_oa = %12d", almanac->wn_oa );
break;
case 3:
/* Almanac health page */
almh = (ALH_PARMS*)data_packet;
xprintf ("t_oa = %d, wn_oa&0xFF = %d ", almh->t_oa, almh->WN_a);
show_crlf ();
xprintf ("%02X %02X %02X %02X %02X %02X %02X %02X ",
almh->SV_health[0], almh->SV_health[1], almh->SV_health[2],
almh->SV_health[3], almh->SV_health[4], almh->SV_health[5],
almh->SV_health[6], almh->SV_health[7]);
show_crlf ();
xprintf ("%02X %02X %02X %02X %02X %02X %02X %02X ",
almh->SV_health[8], almh->SV_health[9], almh->SV_health[10],
almh->SV_health[11], almh->SV_health[12], almh->SV_health[13],
almh->SV_health[14], almh->SV_health[15]);
show_crlf ();
xprintf ("%02X %02X %02X %02X %02X %02X %02X %02X ",
almh->SV_health[16], almh->SV_health[17], almh->SV_health[18],
almh->SV_health[19], almh->SV_health[20], almh->SV_health[21],
almh->SV_health[22], almh->SV_health[23]);
show_crlf ();
xprintf ("%02X %02X %02X %02X %02X %02X %02X %02X ",
almh->SV_health[24], almh->SV_health[25], almh->SV_health[26],
almh->SV_health[27], almh->SV_health[28], almh->SV_health[29],
almh->SV_health[30], almh->SV_health[31]);
show_crlf ();
curr_t_oa = data_packet[34];
curr_wn_oa = (data_packet[35]<<8) + data_packet[36];
xprintf ("current t_oa = %d, wn_oa = %d ", curr_t_oa, curr_wn_oa);
show_crlf();
break;
case 4:
/* Ionosphere */
ionosphere = (ION_INFO*)data_packet;
xprintf ("alpha_0 = % -12g ", ionosphere->alpha_0);
xprintf ("alpha_1 = % -12g ", ionosphere->alpha_1);
show_crlf ();
xprintf ("alpha_2 = % -12g ", ionosphere->alpha_2);
xprintf ("alpha_3 = % -12g ", ionosphere->alpha_3);
show_crlf ();
xprintf ("beta_0 = % -12g ", ionosphere->beta_0);
xprintf ("beta_1 = % -12g ", ionosphere->beta_1);
show_crlf ();
xprintf ("beta_2 = % -12g ", ionosphere->beta_2);
xprintf ("beta_3 = % -12g ", ionosphere->beta_3);
show_crlf ();
break;
case 5:
/* UTC */
show_crlf ();
utc = (UTC_INFO*)data_packet;
xprintf ("A_0 = %g ", utc->A_0);
show_crlf ();
xprintf ("A_1 = %g ", utc->A_1);
show_crlf ();
xprintf ("delta_t_LS = %d ", utc->delta_t_LS);
show_crlf ();
xprintf ("t_ot = %f ", utc->t_ot );
show_crlf ();
xprintf ("WN_t = %d ", utc->WN_t );
show_crlf ();
xprintf ("WN_LSF = %d ", utc->WN_LSF );
show_crlf ();
xprintf ("DN = %d ", utc->DN );
show_crlf ();
xprintf ("delta_t_LSF = %d ", utc->delta_t_LSF );
break;
case 6: /* Ephemeris */
show_crlf ();
if (sv_prn == 0 || sv_prn > 32) {
xprintf ("Binary PRN invalid");
show_crlf ();
return;
}
nav_data = (NAV_INFO*)data_packet;
xprintf (" SV_PRN = % -12d . ", nav_data->sv_number );
xprintf (" t_ephem = % -12g . ", nav_data->t_ephem );
show_crlf ();
cdata = &(nav_data->ephclk);
xprintf (" weeknum = % -12d . ", cdata->weeknum );
xprintf (" codeL2 = % -12d . ", cdata->codeL2 );
xprintf (" L2Pdata = % -12d", cdata->L2Pdata );
show_crlf ();
xprintf ("SVacc_raw = % -12d . ", cdata->SVacc_raw );
xprintf ("SV_health = % -12d . ", cdata->SV_health );
xprintf (" IODC = % -12d", cdata->IODC );
show_crlf ();
xprintf (" T_GD = % -12g . ", cdata->T_GD );
xprintf (" t_oc = % -12g . ", cdata->t_oc );
xprintf (" a_f2 = % -12g", cdata->a_f2 );
show_crlf ();
xprintf (" a_f1 = % -12g . ", cdata->a_f1 );
xprintf (" a_f0 = % -12g . ", cdata->a_f0 );
xprintf (" SVacc = % -12g", cdata->SVacc );
show_crlf ();
edata = &(nav_data->ephorb);
xprintf (" IODE = % -12d . ", edata->IODE );
xprintf ("fit_intvl = % -12d . ", edata->fit_interval );
xprintf (" C_rs = % -12g", edata->C_rs );
show_crlf ();
xprintf (" delta_n = % -12g . ", edata->delta_n );
xprintf (" M_0 = % -12g . ", edata->M_0 );
xprintf (" C_uc = % -12g", edata->C_uc );
show_crlf ();
xprintf (" ecc = % -12g . ", edata->e );
xprintf (" C_us = % -12g . ", edata->C_us );
xprintf (" sqrt_A = % -12g", edata->sqrt_A );
show_crlf ();
xprintf (" t_oe = % -12g . ", edata->t_oe );
xprintf (" C_ic = % -12g . ", edata->C_ic );
xprintf (" OMEGA_0 = % -12g", edata->OMEGA_0 );
show_crlf ();
xprintf (" C_is = % -12g . ", edata->C_is );
xprintf (" i_0 = % -12g . ", edata->i_0 );
xprintf (" C_rc = % -12g", edata->C_rc );
show_crlf ();
xprintf (" omega = % -12g . ", edata->omega );
xprintf (" OMEGADOT = % -12g . ", edata->OMEGADOT );
xprintf (" IDOT = % -12g", edata->IDOT );
show_crlf ();
xprintf (" Axis = % -12g . ", edata->Axis );
xprintf (" n = % -12g . ", edata->n );
xprintf (" r1me2 = % -12g", edata->r1me2 );
show_crlf ();
xprintf (" OMEGA_n = % -12g . ", edata->OMEGA_n );
xprintf (" ODOT_n = % -12g", edata->ODOT_n );
break;
}
}
}
/* 0x59: */
static void rpt_SVs_enabled (TSIPPKT *rpt)
{
unsigned char
code_type, status_code[32];
short
iprn;
/* unload rptbuf */
if (rpt_0x59 (rpt, &code_type, status_code)) {
parsed = BADLEN_PARSE;
return;
}
if (code_type == 3) {
xprintf ("SVs Enable/Disable");
show_crlf ();
for (iprn=0; iprn<32; iprn++) {
xprintf ("%c%c", (iprn%10) ? ' ' : '.',
status_code[iprn] ? 'D' : 'E');
}
}
if (code_type == 6) {
xprintf ("SVs Heed/Ignore Health");
show_crlf ();
for (iprn=0; iprn<32; iprn++) {
xprintf ("%c%c", (iprn%10) ? ' ' : '.',
status_code[iprn] ? 'I' : 'H');
}
}
}
/* 0x5A */
static void rpt_raw_msmt (TSIPPKT *rpt)
{
unsigned char
sv_prn;
float
sample_length, signal_level, code_phase, Doppler;
double
time_of_fix;
/* unload rptbuf */
if (rpt_0x5A (rpt, &sv_prn, &sample_length, &signal_level,
&code_phase, &Doppler, &time_of_fix)) {
parsed = BADLEN_PARSE;
return;
}
xprintf (" %02d %5.0f %7.1f %10.2f %10.2f %12.3f ",
sv_prn, sample_length, signal_level, code_phase, Doppler, time_of_fix);
show_time ((float)time_of_fix);
}
/* 0x5C */
static void rpt_SV_tracking_status (TSIPPKT *rpt)
{
unsigned char
sv_prn, chan, slot, acq_flag, eph_flag,
old_msmt_flag, integer_msec_flag, bad_data_flag,
data_collect_flag;
float
signal_level, time_of_last_msmt,
elev, azim;
/* unload rptbuf */
if (rpt_0x5C (rpt,
&sv_prn, &slot, &chan, &acq_flag, &eph_flag,
&signal_level, &time_of_last_msmt, &elev, &azim,
&old_msmt_flag, &integer_msec_flag, &bad_data_flag,
&data_collect_flag)) {
parsed = BADLEN_PARSE;
return;
}
xprintf (" %2d %1d %1d %1d %1d %4.1f ",
sv_prn, chan, slot, acq_flag, eph_flag, signal_level);
show_time (time_of_last_msmt);
xprintf (" %5.1f %5.1f %d %d %d %d",
elev*R2D, azim*R2D, old_msmt_flag,
integer_msec_flag, bad_data_flag, data_collect_flag);
}
/**/
/* 0x6D */
static void rpt_allSV_selection (TSIPPKT *rpt)
{
unsigned char
manual_mode, nsvs, sv_prn[8], ndim;
short
islot;
float
pdop, hdop, vdop, tdop;
/* unload rptbuf */
if (rpt_0x6D (rpt,
&manual_mode, &nsvs, &ndim, sv_prn,
&pdop, &hdop, &vdop, &tdop)) {
parsed = BADLEN_PARSE;
return;
}
xprintf ("Mode: %s %d SV (%d-D):",
manual_mode ? "Manual" : "Auto",
nsvs, ndim - 1);
for (islot = 0; islot < nsvs; islot++) {
if (sv_prn[islot]) xprintf (" %2d", sv_prn[islot]);
}
show_crlf ();
xprintf (" P, H, V, TDOP = %.2f, %.2f, %.2f, %.2f",
pdop, hdop, vdop, tdop);
}
/* 0x6E */
static void rpt_full_msmt_packet_controls (TSIPPKT *rpt)
{
unsigned char
subcode,
enable,
interval;
if (rpt_0x6E (rpt, &subcode, &enable, &interval)) {
parsed = BADLEN_PARSE;
return;
}
if (enable) xprintf ("Full msmt packet enabled with %d sec interval",
interval);
else xprintf ("Full msmt packet disabled");
}
/* 0x6F */
static void rpt_full_msmt_packet (TSIPPKT *rpt)
{
int
ichan;
struct cph1_msg_struct
cph1;
struct cph1_datablock_struct
*cph1d;
double
gtime;
if (rpt->buf[0] != 1) {
xprintf ("Measurement package 6F-%02d not supported", rpt->buf[0]);
parsed = BADID_PARSE;
return;
}
/* unload rptbuf */
if (rpt_0x6F01 (rpt, &cph1)) {
parsed = BADLEN_PARSE;
return;
}
gtime = cph1.receive_time*.001;
xprintf ("Time = %.4f secs, off = %.3f msec, numsvs = %d",
gtime, cph1.clock_offset, cph1.numsvs);
show_crlf();
for (ichan = 0; ichan < cph1.numsvs; ichan++) {
cph1d = &cph1.db[ichan];
xprintf ("*SV%02d (%02X) S %5.2f PR %10.1f Cph %12.2f Dp %8.2f",
cph1d->prn,
cph1d->flagbyte,
(double)cph1d->signal_strength * 0.25,
cph1d->pseudorange,
cph1d->carrier_phase,
cph1d->Doppler);
show_crlf();
}
return;
}
/**/
/* 0x70 */
static void show_pv_operation (TSIPPKT *rpt)
{
unsigned char dyn_switch, static_switch, alt_switch, extra;
if (rpt_0x70 (rpt, &dyn_switch, &static_switch, &alt_switch, &extra)) {
parsed = BADLEN_PARSE;
return;
}
/* If dynamic filter is off, then static filter cannot run, so just
inform user that the entire PV filter is disabled */
if (dyn_switch == 0) {
xprintf ("PV filter disabled");
show_crlf();
}
else {
xprintf ("PV dynamic filter %s", dyn_switch?"enabled":"disabled");
show_crlf();
xprintf ("PV static filter %s", static_switch?"enabled":"disabled");
show_crlf();
}
xprintf ("Altitude filter %s", alt_switch?"enabled":"disabled");
show_crlf();
}
/* 0x7B */
static void rpt_nmea_parameters (TSIPPKT *rpt)
/* NMEA Control parameters */
{
unsigned char
subcode,
interval;
unsigned long
nmeamask;
if (rpt_0x7B (rpt,
&subcode, &interval, &nmeamask)) {
parsed = BADLEN_PARSE;
return;
}
xprintf("NMEA output interval: %d", interval);
show_crlf();
xprintf("NMEA output mask: 0x%08lX", nmeamask);
}
/**/
/* 0x82 */
static void rpt_DGPS_position_mode (TSIPPKT *rpt)
{
unsigned char
diff_mode;
/* unload rptbuf */
if (rpt_0x82 (rpt, &diff_mode)) {
parsed = BADLEN_PARSE;
return;
}
xprintf ("DGPS mode is %d, ", diff_mode);
switch (diff_mode) {
case 0:
xprintf ("diff off");
break;
case 1:
xprintf ("report diff fixes only");
break;
case 2:
xprintf ("auto diff, diff off");
break;
case 3:
xprintf ("auto diff, diff on");
break;
}
}
/* 0x83 */
static void rpt_double_ECEF_position (TSIPPKT *rpt)
{
double
ECEF_pos[3], clock_bias;
float
time_of_fix;
/* unload rptbuf */
if (rpt_0x83 (rpt, ECEF_pos, &clock_bias, &time_of_fix)) {
parsed = BADLEN_PARSE;
return;
}
xprintf ("DPos:%12.2f %13.2f %13.2f %12.2f",
ECEF_pos[0], ECEF_pos[1], ECEF_pos[2], clock_bias);
show_time (time_of_fix);
}
/* 0x84 */
static void rpt_double_lla_position (TSIPPKT *rpt)
{
short
lat_deg, lon_deg;
double
lat, lon, lat_min, lon_min,
alt, clock_bias;
float
time_of_fix;
unsigned char
north_south, east_west;
/* unload rptbuf */
if (rpt_0x84 (rpt,
&lat, &lon, &alt, &clock_bias, &time_of_fix)) {
parsed = BADLEN_PARSE;
return;
}
lat *= R2D;
lon *= R2D;
if (lat < 0.0) {
north_south = 'S';
lat = -lat;
} else {
north_south = 'N';
}
lat_deg = (short)lat;
lat_min = (lat - lat_deg) * 60.0;
if (lon < 0.0) {
east_west = 'W';
lon = -lon;
} else {
east_west = 'E';
}
lon_deg = (short)lon;
lon_min = (lon - lon_deg) * 60.0;
xprintf ("DPos: %2d:%08.5f %c; %3d:%08.5f %c; %10.2f %12.2f",
lat_deg, lat_min, north_south,
lon_deg, lon_min, east_west,
alt, clock_bias);
show_time (time_of_fix);
}
/* 0x85 */
static void rpt_dgps_info (TSIPPKT *rpt)
{
const char
*dm_text[6] = {"Good", "Delt", "StaH", " Age", "UDRE", "IODE" };
unsigned char
sv_prn, summary_status, station_health, SV_UDRE_parm,
iode1, iode2;
float
z_cnt_tow, range_corr, range_rate_corr, delta_range_corr;
/* unload rptbuf */
if (rpt_0x85 (rpt,
&sv_prn, &summary_status, &station_health,
&SV_UDRE_parm, &iode1, &iode2,
&z_cnt_tow, &range_corr,
&range_rate_corr, &delta_range_corr)) {
parsed = BADLEN_PARSE;
return;
}
xprintf (" %2d %d=%s %d %d %02X %02X ",
sv_prn, summary_status,
(summary_status < 6) ? dm_text[summary_status] : "Unkn",
station_health, SV_UDRE_parm, iode1, iode2);
show_time (z_cnt_tow);
xprintf (" %6.1f %6.1f %6.1f", range_corr, range_rate_corr, delta_range_corr);
}
/* 0x8F15 */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -