send/receive gga
This commit is contained in:
parent
3cd9c5cea6
commit
c12ac513ba
|
@ -20,6 +20,7 @@ class GwBoatItemBase{
|
||||||
GWSC(formatDepth);
|
GWSC(formatDepth);
|
||||||
GWSC(kelvinToC);
|
GWSC(kelvinToC);
|
||||||
GWSC(mtr2nm);
|
GWSC(mtr2nm);
|
||||||
|
GWSC(formatDop);
|
||||||
typedef std::vector<GwBoatItemBase*> GwBoatItemMap;
|
typedef std::vector<GwBoatItemBase*> GwBoatItemMap;
|
||||||
protected:
|
protected:
|
||||||
unsigned long lastSet=0;
|
unsigned long lastSet=0;
|
||||||
|
@ -128,6 +129,8 @@ class GwBoatData{
|
||||||
GWBOATDATA(double,MagneticHeading,4000,formatCourse)
|
GWBOATDATA(double,MagneticHeading,4000,formatCourse)
|
||||||
GWBOATDATA(double,Variation,4000,formatCourse)
|
GWBOATDATA(double,Variation,4000,formatCourse)
|
||||||
GWBOATDATA(double,Deviation,4000,formatCourse)
|
GWBOATDATA(double,Deviation,4000,formatCourse)
|
||||||
|
GWBOATDATA(double,HDOP,4000,formatDop)
|
||||||
|
GWBOATDATA(double,PDOP,4000,formatDop)
|
||||||
GWBOATDATA(double,RudderPosition,4000,formatCourse)
|
GWBOATDATA(double,RudderPosition,4000,formatCourse)
|
||||||
GWBOATDATA(double,Latitude,4000,formatLatitude)
|
GWBOATDATA(double,Latitude,4000,formatLatitude)
|
||||||
GWBOATDATA(double,Longitude,4000,formatLongitude)
|
GWBOATDATA(double,Longitude,4000,formatLongitude)
|
||||||
|
|
|
@ -578,6 +578,40 @@ private:
|
||||||
SetN2kSystemTime(n2kMsg,1,DaysSince1970,SecondsSinceMidnight);
|
SetN2kSystemTime(n2kMsg,1,DaysSince1970,SecondsSinceMidnight);
|
||||||
send(n2kMsg);
|
send(n2kMsg);
|
||||||
}
|
}
|
||||||
|
void convertGGA(const SNMEA0183Msg &msg){
|
||||||
|
double GPSTime=NMEA0183DoubleNA;
|
||||||
|
double Latitude=NMEA0183DoubleNA;
|
||||||
|
double Longitude=NMEA0183DoubleNA;
|
||||||
|
int GPSQualityIndicator=NMEA0183Int32NA;
|
||||||
|
int SatelliteCount=NMEA0183Int32NA;
|
||||||
|
double HDOP=NMEA0183DoubleNA;
|
||||||
|
double Altitude=NMEA0183DoubleNA;
|
||||||
|
double GeoidalSeparation=NMEA0183DoubleNA;
|
||||||
|
double DGPSAge=NMEA0183DoubleNA;
|
||||||
|
int DGPSReferenceStationID=NMEA0183Int32NA;
|
||||||
|
if (! NMEA0183ParseGGA_nc(msg,GPSTime, Latitude,Longitude,
|
||||||
|
GPSQualityIndicator, SatelliteCount, HDOP, Altitude,GeoidalSeparation,
|
||||||
|
DGPSAge, DGPSReferenceStationID)){
|
||||||
|
LOG_DEBUG(GwLog::DEBUG, "failed to parse GGA %s", msg.line);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (! updateDouble(boatData->SecondsSinceMidnight,GPSTime,msg.sourceId)) return;
|
||||||
|
if (! updateDouble(boatData->Latitude,Latitude,msg.sourceId)) return;
|
||||||
|
if (! updateDouble(boatData->Longitude,Longitude,msg.sourceId)) return;
|
||||||
|
if (! updateDouble(boatData->Altitude,Altitude,msg.sourceId)) return;
|
||||||
|
if (! updateDouble(boatData->HDOP,HDOP,msg.sourceId)) return;
|
||||||
|
if (! boatData->DaysSince1970->isValid()) return;
|
||||||
|
tN2kMsg n2kMsg;
|
||||||
|
tN2kGNSSmethod method=N2kGNSSm_noGNSS;
|
||||||
|
if (GPSQualityIndicator <=5 ) method= (tN2kGNSSmethod)GPSQualityIndicator;
|
||||||
|
SetN2kGNSS(n2kMsg,1, boatData->DaysSince1970->getData(),
|
||||||
|
GPSTime, Latitude, Longitude, Altitude,
|
||||||
|
N2kGNSSt_GPS, method,
|
||||||
|
SatelliteCount, HDOP, boatData->PDOP->getDataWithDefault(N2kDoubleNA), 0,
|
||||||
|
0, N2kGNSSt_GPS, DGPSReferenceStationID,
|
||||||
|
DGPSAge);
|
||||||
|
send(n2kMsg);
|
||||||
|
}
|
||||||
|
|
||||||
//shortcut for lambda converters
|
//shortcut for lambda converters
|
||||||
#define CVL [](const SNMEA0183Msg &msg, NMEA0183DataToN2KFunctions *p) -> void
|
#define CVL [](const SNMEA0183Msg &msg, NMEA0183DataToN2KFunctions *p) -> void
|
||||||
|
@ -629,7 +663,10 @@ private:
|
||||||
String(F("VTG")), &NMEA0183DataToN2KFunctions::convertVTG);
|
String(F("VTG")), &NMEA0183DataToN2KFunctions::convertVTG);
|
||||||
converters.registerConverter(
|
converters.registerConverter(
|
||||||
129033UL,126992UL,
|
129033UL,126992UL,
|
||||||
String(F("ZDA")), &NMEA0183DataToN2KFunctions::convertZDA);
|
String(F("ZDA")), &NMEA0183DataToN2KFunctions::convertZDA);
|
||||||
|
converters.registerConverter(
|
||||||
|
129029UL,
|
||||||
|
String(F("GGA")), &NMEA0183DataToN2KFunctions::convertGGA);
|
||||||
unsigned long *aispgns=new unsigned long[7]{129810UL,129809UL,129040UL,129039UL,129802UL,129794UL,129038UL};
|
unsigned long *aispgns=new unsigned long[7]{129810UL,129809UL,129040UL,129039UL,129802UL,129794UL,129038UL};
|
||||||
converters.registerConverter(7,&aispgns[0],
|
converters.registerConverter(7,&aispgns[0],
|
||||||
String(F("AIVDM")),&NMEA0183DataToN2KFunctions::convertAIVDX);
|
String(F("AIVDM")),&NMEA0183DataToN2KFunctions::convertAIVDX);
|
||||||
|
|
|
@ -309,8 +309,18 @@ private:
|
||||||
updateDouble(boatData->Longitude, Longitude);
|
updateDouble(boatData->Longitude, Longitude);
|
||||||
updateDouble(boatData->Altitude, Altitude);
|
updateDouble(boatData->Altitude, Altitude);
|
||||||
updateDouble(boatData->SecondsSinceMidnight, SecondsSinceMidnight);
|
updateDouble(boatData->SecondsSinceMidnight, SecondsSinceMidnight);
|
||||||
|
updateDouble(boatData->HDOP,HDOP);
|
||||||
|
updateDouble(boatData->PDOP,PDOP);
|
||||||
if (DaysSince1970 != N2kUInt16NA && DaysSince1970 != 0)
|
if (DaysSince1970 != N2kUInt16NA && DaysSince1970 != 0)
|
||||||
boatData->DaysSince1970->update(DaysSince1970,sourceId);
|
boatData->DaysSince1970->update(DaysSince1970,sourceId);
|
||||||
|
int quality=0;
|
||||||
|
if ((int)GNSSmethod <= 5) quality=(int)GNSSmethod;
|
||||||
|
tNMEA0183AISMsg nmeaMsg;
|
||||||
|
if (NMEA0183SetGGA(nmeaMsg,SecondsSinceMidnight,Latitude,Longitude,
|
||||||
|
quality,nSatellites,HDOP,Altitude,GeoidalSeparation,AgeOfCorrection,
|
||||||
|
ReferenceSationID,talkerId)){
|
||||||
|
SendMessage(nmeaMsg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue