Skip to content

a lot of new sentences#88

Merged
icholy merged 3 commits intoadrianmo:masterfrom
aldas:sentences
Jan 3, 2022
Merged

a lot of new sentences#88
icholy merged 3 commits intoadrianmo:masterfrom
aldas:sentences

Conversation

@aldas
Copy link
Copy Markdown
Collaborator

@aldas aldas commented Jan 2, 2022

  • Added a lot of sentences
* [AAM](./aam.go) - Waypoint Arrival Alarm
* [ALA](./ala.go) - System Faults and alarms
* [APB](./apb.go) - Autopilot Sentence "B"
* [BEC](./bec.go) - Bearing and distance to waypoint (dead reckoning)
* [BOD](./bod.go) - Bearing waypoint to waypoint (origin to destination).
* [BWC](./bwc.go) - Bearing and distance to waypoint, great circle
* [BWR](./bwr.go) - Bearing and distance to waypoint (Rhumb Line)
* [BWW](./bww.go) - bearing (from destination) destination waypoint to origin waypoint
* [DBK](./dbk.go) - Depth Below Keel (obsolete, use DPT instead)
* [DOR](./dor.go) - Door Status Detection
* [DSC](./dsc.go) - Digital Selective Calling Information
* [DSE](./dse.go) - Expanded digital selective calling
* [EVE](./eve.go) - General Event Message
* [FIR](./fir.go) - Fire Detection event with time and location
* [HSC](./hsc.go) - Heading steering command
* [MTA](./mta.go) - Air Temperature (obsolete, use XDR instead)
* [RMB](./rmb.go) - Recommended Minimum Navigation Information
* [RPM](./rpm.go) - Engine or Shaft revolutions and pitch
* [RSA](./rsa.go) - Rudder Sensor Angle
* [VDR](./vdr.go) - Set and Drift
* [VLW](./vlw.go) - Distance Traveled through Water
* [VPW](./vpw.go) - Speed Measured Parallel to Wind
* [VWR](./vwr.go) - Relative Wind Speed and Angle
* [VWT](./vwt.go) - True Wind Speed and Angle
* [XDR](./xdr.go) - Transducer Measurement
* [XTE](./xte.go) - Cross-track error, measured
  • Added parsing of unit related fields to DBS. Although these 'C' fields should be constants just be paranoid and check if type/unit is what we expect and error if not.
    Maybe p.EnumString( could set special error type ala EnumValueError when it sees value that is not in list + instead of returning empty value we return that invalid value. In that case you could check for EnumValueError and ignore it if you want to and that invalid value would be still set to that sentence type so it is usable in that case.

@aldas
Copy link
Copy Markdown
Collaborator Author

aldas commented Jan 2, 2022

About errors. When parsing fails currently only first error is stored and all subsequent errors are discarded. I propose if p.EnumString and other parsing method errors would be distinquishable from each other and parsers would store all errors. it would allow you to introspect what went wrong and some circumstances ignore some error types.

maybe just wrapping them (or storing into slice or multierror)

func (p *Parser) SetErr(context, value string) {
	if p.err == nil {
		p.err = fmt.Errorf("nmea: %s invalid %s: %s", p.Prefix(), context, value)
	} else {
		p.err = fmt.Errorf("nmea: %s invalid %s: %s, err: %w", p.Prefix(), context, value, p.err)
	}
}

@icholy
Copy link
Copy Markdown
Collaborator

icholy commented Jan 2, 2022

This is awesome! Create a separate issue for the error discussion though.

@aldas
Copy link
Copy Markdown
Collaborator Author

aldas commented Jan 2, 2022

added #89

Comment thread aam_test.go Outdated
Comment thread ala_test.go Outdated
icholy
icholy previously approved these changes Jan 3, 2022
Copy link
Copy Markdown
Collaborator

@icholy icholy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@icholy icholy merged commit e6fa0a7 into adrianmo:master Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants