示例#1
0
 def GGA(self, sim):
     "Emit GGA sentence describing the simulation state."
     tm = time.gmtime(sim.ksv.time)
     gga = \
         "$GPGGA,%02d%02d%02d,%09.4f,%c,%010.4f,%c,%d,%02d," % (
         tm.tm_hour,
         tm.tm_min,
         tm.tm_sec,
         self.degtodm(abs(sim.ksv.lat)), "SN"[sim.ksv.lat > 0],
         self.degtodm(abs(sim.ksv.lon)), "WE"[sim.ksv.lon > 0],
         sim.status,
         sim.satellites_used)
     # HDOP calculation goes here
     gga += ","
     if sim.mode == gps.MODE_3D:
         gga += "%.1f,M" % self.ksv.lat
     gga += ","
     gga += "%.3f,M," % gpslib.wg84_separation(sim.ksv.lat, sim.ksv.lon)
     # Magnetic variation goes here
     # gga += "%3.2f,M," % mag_var
     gga += ",,"
     # Time in seconds since last DGPS update goes here
     gga += ","
     # DGPS station ID goes here
     return self.add_checksum(gga)
示例#2
0
文件: gpssim.py 项目: mutability/gpsd
 def GGA(self, sim):
     "Emit GGA sentence describing the simulation state."
     tm = time.gmtime(sim.ksv.time)
     gga = \
         "$GPGGA,%02d%02d%02d,%09.4f,%c,%010.4f,%c,%d,%02d," % (
         tm.tm_hour,
         tm.tm_min,
         tm.tm_sec,
         self.degtodm(abs(sim.ksv.lat)), "SN"[sim.ksv.lat > 0],
         self.degtodm(abs(sim.ksv.lon)), "WE"[sim.ksv.lon > 0],
         sim.status,
         sim.satellites_used)
     # HDOP calculation goes here
     gga += ","
     if sim.mode == gps.MODE_3D:
         gga += "%.1f,M" % self.ksv.lat
     gga += ","
     gga += "%.3f,M," % gpslib.wg84_separation(sim.ksv.lat, sim.ksv.lon)
     # Magnetic variation goes here
     # gga += "%3.2f,M," % mag_var
     gga += ",,"
     # Time in seconds since last DGPS update goes here
     gga += ","
     # DGPS station ID goes here
     return self.add_checksum(gga)