Closed mjsneijders closed 2 years ago
I prefer to use double for real world values. E.g., range is real value even message can internally handle it only as int.
I prefer to use NMEA0183Msg.AddDoubleField, since that handles NA. On parser use NMEA0183GetDouble. And result should be true or false.
bool NMEA0183ParseDPT_nc(const tNMEA0183Msg &NMEA0183Msg, double &DepthBelowTransducer, double &Offset, double &Range ) {
bool result=( NMEA0183Msg.FieldCount()>= 2);
if ( result ) {
DepthBelowTransducer=NMEA0183GetDouble(NMEA0183Msg.Field(0));
Offset=NMEA0183GetDouble(NMEA0183Msg.Field(1));
if ( NMEA0183Msg.FieldCount()>2 ) Range=NMEA0183GetDouble(NMEA0183Msg.Field(2));
}
return result;
}
bool NMEA0183SetDPT(tNMEA0183Msg &NMEA0183Msg, double DepthBelowTransducer, double Offset, double Range, const char *Src="II");
but in .cpp bool NMEA0183SetDPT(tNMEA0183Msg &NMEA0183Msg, double DepthBelowTransducer, double Offset, uint32_t Range, const char *Src)
add the parser for DPT,
as mentioned in issue #30