public static string generatePositionSentence_GGA(double lat, double lon, FixQualityType fixQuality, int satellites) { string _lat = ConvertDecimalDegreesToNMEAFormat(lat, Coord.Lat); string _lon = ConvertDecimalDegreesToNMEAFormat(lon, Coord.Lon); string time = UTCTime(); string sentence = $"GPGGA,{time},{_lat},{_lon},{(int) fixQuality},{satellites},0,0,M,,,,"; return(FormatSentence(sentence)); }
public static string generatePositionSentence_GLL(double lat, double lon, FixQualityType fixQuality) { string _lat = ConvertDecimalDegreesToNMEAFormat(lat, Coord.Lat); string _lon = ConvertDecimalDegreesToNMEAFormat(lon, Coord.Lon); string valid = Utils.isValidFix(fixQuality) ? "A" : "V"; // A is valid, V is "receiver warning" string time = UTCTime(); string sentence = $"GPGLL,{_lat},{_lon},{time},{valid}"; return(FormatSentence(sentence)); }
public static bool isValidFix(FixQualityType fixQuality) { switch (fixQuality) { case FixQualityType.REAL_TIME_KINEMATIC: case FixQualityType.FLOAT_RTK: return(false); default: return(true); } }
public static string generateRecommendedMinimumInformationSentence_RMC(double lat, double lon, double speedOverGround, int courseOverGroud, FixQualityType fixQuality) { string _lat = ConvertDecimalDegreesToNMEAFormat(lat, Coord.Lat); string _lon = ConvertDecimalDegreesToNMEAFormat(lon, Coord.Lon); string valid = Utils.isValidFix(fixQuality) ? "A" : "V"; // A is valid, V is "receiver warning" string _sogKnots = speedOverGround.ToString("F1", CultureInfo.InvariantCulture); string time = UTCTime(); string date = dateDDMMYY(); string sentence = $"GPRMC,{time},{valid},{_lat},{_lon},{_sogKnots},{courseOverGroud},{date},,,"; return(FormatSentence(sentence)); }
public static string generateApparentWindSpeedAndAngleSentence_MWV(int apparentWindAngle, double apparentWindSpeed, FixQualityType fixQuality) { string valid = Utils.isValidFix(fixQuality) ? "A" : "V"; // A is valid, V is "receiver warning" string sentence = $"WIMWV,{apparentWindAngle.ToString()},R,{apparentWindSpeed.ToString("F1", CultureInfo.InvariantCulture)},N,{valid}"; return(FormatSentence(sentence)); }