Closed Andrei-Errapart closed 1 year ago
Do you really need 2 decimals instead of default 1?
Yes. The digital files we produce when surveying small harbors are all centimeter precision.
Actually I don't want to force this decision on the library, because users have different requirements for the precision.
Would an overload of NMEA0183SetDPT, with an additional parameter "int numberOfDecimalPlaces", be a way out?
That may be better. There has been problems with some devices that they are strict of number of decimals.
You could make it with alias: bool NMEA0183SetDPT(tNMEA0183Msg &NMEA0183Msg, double DepthBelowTransducer, double Offset, double Range, const char DepthFormat, const char Src="II");
inline bool NMEA0183SetDPT(tNMEA0183Msg &NMEA0183Msg, double DepthBelowTransducer, double Offset, double Range, const char *Src="II") { NMEA0183SetDPT(NMEA0183Msg,DepthBelowTransducer,Offset,Range,tNMEA0183Msg::DefDoubleFormat,Src); }
There are now new aliases. I dropped the default values for Source for the new aliases, because otherwise the compiler is unable to decide between aliases to call.
Other option is to use different order: bool NMEA0183SetDPT(tNMEA0183Msg &NMEA0183Msg, const char DepthFormat, double DepthBelowTransducer, double Offset, double Range, const char Src="II");
Reordered differently and simplified by dropping two overloads.
Rationale: this is useful in cases when the depth is computed and can have many places after comma. To the best of my knowledge, in nautical applications centimeter precision is sufficient.