public Location(Location original) { lat = original.lat; lon = original.lon; alt = original.alt; speed = original.speed; ha = original.ha; va = original.va; time = original.time; }
private static string NmeaFormat(Location location) { var lat = NmeaCoord(location.lat, true); var lon = NmeaCoord(location.lon, false); var alt = location.alt.ToString("F1"); var speed = (location.speed * 1.94384449).ToString("F3"); var time = location.time.ToString("HHmmss.ff"); var date = location.time.ToString("ddMMyy"); var gga = String.Format("GPGGA,{0},{1},{2},1,12,,{3},M,,M,,,", time, lat, lon, alt); var gll = String.Format("GPGLL,{0},{1},{2},V", lat, lon, time); var rmc = String.Format("GPRMC,{0},A,{1},{2},{3},0,{4},0,0,A", time, lat, lon, speed, date); gga = "$" + gga + NmeaChecksum(gga); gll = "$" + gll + NmeaChecksum(gll); rmc = "$" + rmc + NmeaChecksum(rmc); return gga + "\n\r" + gll + "\n\r" + rmc + "\n\r"; }
public void GpsUpdate(Location location) { lock (lockGps) location = new Location(location); lock (lockClients) foreach (var client in clients.ToArray()) Send(client, NmeaFormat(location)); }