Two options that I know of.
Receiving
NMEA events in which position, cog, sog etc. are returned.
Code:
int YourPlugin::Init(void) {
.....
return WANTS_NMEA_EVENTS;
}
....
void YourPlugin::SetPositionFix(PlugIn_Position_Fix &pfix) {
double YourLatitude = pfix.Lat;
double YourLongitude = pfix.Lon;
}
or parsing
NMEA Sentences (In this case using the NMEA183
classes used by OpenCPN)
Code:
int YourPlugin::Init(void) {
.....
return WANTS_NMEA_SENTENCES;
}
....
void YourPlugin::SetNMEASentence(wxString &sentence) {
// Parse the received NMEA 183 sentence
nmea183 << sentence;
if (nmea183.PreParse()) {
if (nmea183.LastSentenceIDReceived == _T("GLL")) {
......
Welcome to the world of OpenCPN Plugin development .