public bool Validate(SentenceID id) { switch (id) { case SentenceID.GGA: return(gga != null && gga.IsValid); case SentenceID.GSA: return(gsa != null && gsa.IsValid); case SentenceID.GSV: return(gsv != null && gsv.IsValid); case SentenceID.RMC: return(rmc != null && rmc.IsValid); } return(false); }
public static bool IsNmeaValid(SentenceID sentenceID, TalkerID?talkerID, String nmea) { bool valid = false; if (validateChecksum(nmea)) { valid = sentenceID == NmeaIDTools.ParseSentenceID(nmea); if (talkerID != null) { valid &= talkerID == NmeaIDTools.ParseTalkerID(nmea); } } return(valid); }
public NmeaSentence GetSentenceByPriority(SentenceID id) { switch (id) { case SentenceID.GGA: foreach (TalkerID tid in priorityIds) { if (gga.ContainsKey(tid)) { return(gga[tid]); } } break; case SentenceID.GSA: foreach (TalkerID tid in priorityIds) { if (gsa.ContainsKey(tid)) { return(gsa[tid]); } } break; case SentenceID.RMC: foreach (TalkerID tid in priorityIds) { if (rmc.ContainsKey(tid)) { return(rmc[tid]); } } break; case SentenceID.GSV: foreach (TalkerID tid in priorityIds) { if (gsv.ContainsKey(tid)) { return(gsv[tid]); } } break; } throw new Exception("No Sentence found"); }
public static SentenceID ParseSentenceID(string value) { if (value == null) { throw new ArgumentNullException(); } if (value.StartsWith("$")) { value = value.Substring(3, 3); } SentenceID sid = SentenceID.Unknown; Enum.TryParse(value, true, out sid); return(sid); }
public ExcessiveStringException(SentenceID sentenceID) : base($"An Excessive amount of {sentenceID} type strings were added to the burst.") { }
public MissingNmeaDataException(SentenceID sentenceID) : base($"Missing {sentenceID} sentence data.") { }
public bool Validate(SentenceID id) { switch (id) { case SentenceID.GGA: if (ggaIsValidated) { return(ggaIsValid); } else { if (ggaIsValidated = gga.Count > 0) { ggaIsValid = gga.Values.All(s => s.IsValid); return(ggaIsValid); } } break; case SentenceID.GSA: if (gsaIsValidated) { return(gsaIsValid); } else { if (gsaIsValidated = gsa.Count > 0) { gsaIsValid = gsa.Values.All(s => s.IsValid); return(gsaIsValid); } } break; case SentenceID.GSV: if (gsvIsValidated) { return(gsvIsValid); } else { if (gsvIsValidated = gsv.Count > 0) { gsvIsValid = gsv.Values.All(s => s.IsValid); return(gsvIsValid); } } break; case SentenceID.RMC: if (rmcIsValidated) { return(rmcIsValid); } else { if (rmcIsValidated = rmc.Count > 0) { rmcIsValid = rmc.Values.All(s => s.IsValid); return(rmcIsValid); } } break; } return(false); }