FreeBSD/contrib/ntp/ntpd/refclock_mx4200.c
/*
 * Parse a mx4200 Status sentence
 * Parse a mx4200 Mode Data sentence
 * Parse a mx4200 Software Configuration sentence
 * Parse a mx4200 Time Recovery Parameters Currently in Use sentence
 * (used only for logging raw strings)
 *
 * A typical message looks like this.  Checksum has already been stripped.
 *
 * $PMVXG,000,XXX,XX,X,HHMM,X
 *
 *	Field	Field Contents
 *	-----	--------------
 *		Block Label: $PMVXG
 *		Sentence Type: 000=Status.
 *			Returns status of the receiver to the controller.
 *	1	Current Receiver Status:
 *		ACQ = Satellite re-acquisition
 *		ALT = Constellation selection
 *		COR = Providing corrections (for reference stations only)
 *		IAC = Initial acquisition
 *		IDL = Idle, no satellites
 *		NAV = Navigation
 *		STS = Search the Sky (no almanac available)
 *		TRK = Tracking
 *	2	Number of satellites that should be visible
 *	3	Number of satellites being tracked
 *	4	Time since last navigation status if not currently navigating
 *		(hours, minutes)
 *	5	Initialization status:
 *		0 = Waiting for initialization parameters
 *		1 = Initialization completed
 *
 * A typical message looks like this.  Checksum has already been stripped.
 *
 * $PMVXG,004,C,R,D,H.HH,V.VV,TT,HHHH,VVVV,T
 *
 *	Field	Field Contents
 *	-----	--------------
 *		Block Label: $PMVXG
 *		Sentence Type: 004=Software Configuration.
 *			Defines the navigation mode and criteria for
 *			acceptable navigation for the receiver.
 *	1	Constrain Altitude Mode:
 *		0 = Auto.  Constrain altitude (2-D solution) and use
 *		    manual altitude input when 3 sats avalable.  Do
 *		    not constrain altitude (3-D solution) when 4 sats
 *		    available.
 *		1 = Always constrain altitude (2-D solution).
 *		2 = Never constrain altitude (3-D solution).
 *		3 = Coast.  Constrain altitude (2-D solution) and use
 *		    last GPS altitude calculation when 3 sats avalable.
 *		    Do not constrain altitude (3-D solution) when 4 sats
 *		    available.
 *	2	Altitude Reference: (always 0 for MX4200)
 *		0 = Ellipsoid
 *		1 = Geoid (MSL)
 *	3	Differential Navigation Control:
 *		0 = Disabled
 *		1 = Enabled
 *	4	Horizontal Acceleration Constant (m/sec**2)
 *	5	Vertical Acceleration Constant (m/sec**2) (0 for MX4200)
 *	6	Tracking Elevation Limit (degrees)
 *	7	HDOP Limit
 *	8	VDOP Limit
 *	9	Time Output Mode:
 *		U = UTC
 *		L = Local time
 *	10	Local Time Offset (minutes) (absent on MX4200)
 *
 * A typical message looks like this.  Checksum has already been stripped.
 *
 * $PMVXG,030,NNNN,FFF
 *
 *	Field	Field Contents
 *	-----	--------------
 *		Block Label: $PMVXG
 *		Sentence Type: 030=Software Configuration.
 *			This sentence contains the navigation processor
 *			and baseband firmware version numbers.
 *	1	Nav Processor Version Number
 *	2	Baseband Firmware Version Number
 *
 * A typical message looks like this.  Checksum has already been stripped.
 *
 * $PMVXG,523,M,S,M,EEEE,BBBBBB,C,R
 *
 *	Field	Field Contents
 *	-----	--------------
 *		Block Label: $PMVXG
 *		Sentence Type: 523=Time Recovery Parameters Currently in Use.
 *			This sentence contains the configuration of the
 *			time recovery feature of the receiver.
 *	1	Time Recovery Mode:
 *		D = Dynamic; solve for position and time while moving
 *		S = Static; solve for position and time while stationary
 *		K = Known position input, solve for time only
 *		N = No time recovery
 *	2	Time Synchronization:
 *		U = UTC time
 *		G = GPS time
 *	3	Time Mark Mode:
 *		A = Always output a time pulse
 *		V = Only output time pulse if time is valid (as determined
 *		    by Maximum Time Error)
 *	4	Maximum Time Error - the maximum error (in nanoseconds) for
 *		which a time mark will be considered valid.
 *	5	User Time Bias - external bias in nanoseconds
 *	6	Time Message Control:
 *		0 = Do not output the time recovery message
 *		1 = Output the time recovery message (record 830) to
 *		    Control port
 *		2 = Output the time recovery message (record 830) to
 *		    Equipment port
 *	7	Reserved
 *	8	Position Known PRN (absent on MX 4200)
 *
 */
Parse a mx4200 Status sentence
Parse a mx4200 Mode Data sentence
Parse a mx4200 Software Configuration sentence
Parse a mx4200 Time Recovery Parameters Currently in Use sentence
(used only for logging raw strings)

A typical message looks like this.  Checksum has already been stripped.



Field   Field Contents

Block Label: $PMVXG
Sentence Type: 000=Status.
Returns status of the receiver to the controller.

A typical message looks like this.  Checksum has already been stripped.



Field   Field Contents

Block Label: $PMVXG
Sentence Type: 004=Software Configuration.
Defines the navigation mode and criteria for
acceptable navigation for the receiver.
1       Constrain Altitude Mode:
0 = Auto.  Constrain altitude (2-D solution) and use
manual altitude input when 3 sats avalable.  Do
not constrain altitude (3-D solution) when 4 sats
available.
1 = Always constrain altitude (2-D solution).
2 = Never constrain altitude (3-D solution).
3 = Coast.  Constrain altitude (2-D solution) and use
last GPS altitude calculation when 3 sats avalable.
Do not constrain altitude (3-D solution) when 4 sats
available.

A typical message looks like this.  Checksum has already been stripped.



Field   Field Contents

Block Label: $PMVXG
Sentence Type: 030=Software Configuration.
This sentence contains the navigation processor
and baseband firmware version numbers.
1       Nav Processor Version Number
2       Baseband Firmware Version Number

A typical message looks like this.  Checksum has already been stripped.



Field   Field Contents

Block Label: $PMVXG
Sentence Type: 523=Time Recovery Parameters Currently in Use.
This sentence contains the configuration of the
time recovery feature of the receiver.
Parse a mx4200 Status sentence Parse a mx4200 Mode Data sentence Parse a mx4200 Software Configuration sentence Parse a mx4200 Time Recovery Parameters Currently in Use sentence ( used only for logging raw strings ) A typical message looks like this . Checksum has already been stripped . Field Field Contents Block Label : $PMVXG Sentence Type : 000 = Status . Returns status of the receiver to the controller . A typical message looks like this . Checksum has already been stripped . Field Field Contents Block Label : $PMVXG Sentence Type : 004 = Software Configuration . Defines the navigation mode and criteria for acceptable navigation for the receiver . 1 Constrain Altitude Mode : 0 = Auto . Constrain altitude ( 2 - D solution ) and use manual altitude input when 3 sats avalable . Do not constrain altitude ( 3 - D solution ) when 4 sats available . 1 = Always constrain altitude ( 2 - D solution ) . 2 = Never constrain altitude ( 3 - D solution ) . 3 = Coast . Constrain altitude ( 2 - D solution ) and use last GPS altitude calculation when 3 sats avalable . Do not constrain altitude ( 3 - D solution ) when 4 sats available . A typical message looks like this . Checksum has already been stripped . Field Field Contents Block Label : $PMVXG Sentence Type : 030 = Software Configuration . This sentence contains the navigation processor and baseband firmware version numbers . 1 Nav Processor Version Number 2 Baseband Firmware Version Number A typical message looks like this . Checksum has already been stripped . Field Field Contents Block Label : $PMVXG Sentence Type : 523 = Time Recovery Parameters Currently in Use . This sentence contains the configuration of the time recovery feature of the receiver .
static char *
mx4200_parse_s(
	struct peer *peer
	)
{
	struct refclockproc *pp;
	struct mx4200unit *up;
	int sentence_type;
	pp = peer->procptr;
	up = pp->unitptr;
        sscanf ( pp->a_lastcode, "$PMVXG,%d", &sentence_type);
	switch (sentence_type) {
		case PMVXG_D_STATUS:
			msyslog(LOG_DEBUG,
			  "mx4200: status: %s", pp->a_lastcode);
			break;
		case PMVXG_D_MODEDATA:
			msyslog(LOG_DEBUG,
			  "mx4200: mode data: %s", pp->a_lastcode);
			break;
		case PMVXG_D_SOFTCONF:
			msyslog(LOG_DEBUG,
			  "mx4200: firmware configuration: %s", pp->a_lastcode);
			break;
		case PMVXG_D_TRECOVUSEAGE:
			msyslog(LOG_DEBUG,
			  "mx4200: time recovery parms: %s", pp->a_lastcode);
			break;
		default:
			return ("wrong rec-type");
	}
	return (NULL);
}
static char * mx4200_parse_s ( struct peer * peer ) { struct refclockproc * pp ; struct mx4200unit * up ; int sentence_type ; pp = peer -> procptr ; up = pp -> unitptr ; sscanf ( pp -> a_lastcode , " " , & sentence_type ) ; switch ( sentence_type ) { case PMVXG_D_STATUS : msyslog ( LOG_DEBUG , " " , pp -> a_lastcode ) ; break ; case PMVXG_D_MODEDATA : msyslog ( LOG_DEBUG , " " , pp -> a_lastcode ) ; break ; case PMVXG_D_SOFTCONF : msyslog ( LOG_DEBUG , " " , pp -> a_lastcode ) ; break ; case PMVXG_D_TRECOVUSEAGE : msyslog ( LOG_DEBUG , " " , pp -> a_lastcode ) ; break ; default : return ( " " ) ; } return ( NULL ) ; }
Parse a mx4200 Status sentence
 Parse a mx4200 Mode Data sentence
 Parse a mx4200 Software Configuration sentence
 Parse a mx4200 Time Recovery Parameters Currently in Use sentence
 (used only for logging raw strings)
Parse a mx4200 Status sentence Parse a mx4200 Mode Data sentence Parse a mx4200 Software Configuration sentence Parse a mx4200 Time Recovery Parameters Currently in Use sentence ( used only for logging raw strings )
/* Sentence type */