Beispiel #1
0
 def get(self):
   AprsStorage.get()
   MockTelemetry.inject_packets()
   top_altitudes = map(TrackingManager.get().get_top_altitude, KmlStyleUtils.TOP_ALTITUDES_CALLSIGNS)
   if self.request.path == '/alt/v':
     for callsign, top_altitude in zip(KmlStyleUtils.TOP_ALTITUDES_CALLSIGNS, top_altitudes):
       label = callsign+KmlStyleUtils.get_callsign_info(callsign)
       self.response.out.write('%f %f %s<br>\n' % (top_altitude, 3.281 * top_altitude, label))
   elif self.request.path == '/trk/':
     self.response.out.write('<table cellpadding="0" cellspacing="15">\n')
     self.response.out.write('<tr><th align="left">Callsign</th><th align="left">Last reported position</th>\n')
     for id_, tpm in TrackingManager.get().placemarks.items():
       callsign = tpm.callsign
       last_packet = tpm.last_packet
       if (last_packet is not None) and (last_packet.position is not None):
         position = last_packet.position
         zoom_level = 19
         pos_url = 'geo:%.5f,%.5f?z=%d&q=loc:%.5f%%2c%.5f' % (position[0], position[1], 20, position[0], position[1])
         label = '<a href="%s">%s</a>%s' % (pos_url, callsign, KmlStyleUtils.get_callsign_info(callsign))
         pos_info = 'lat=%10.5f lon=%10.5f alt=%8.1f' % (position[0], position[1], position[2])
       else:
         label = callsign+KmlStyleUtils.get_callsign_info(callsign)
         pos_info = 'n/a'
       self.response.out.write('<tr><td>%s</td><td>%s</td></tr>\n' % (label, pos_info))
     self.response.out.write('</table>\n')
   else:
     self.response.out.write(int(max(top_altitudes)))
Beispiel #2
0
 def _inject_packets(self, tracking_manager=None):
     if tracking_manager is None:
         tracking_manager = TrackingManager.get()
     for i in range(len(self.tracks)):
         index = self.indexes[i]
         track = self.tracks[i]
         while index < len(track):
             packet = track[index]
             if packet.timestamp > time.time():
                 break
             tracking_manager.add_packet(packet)
             index += 1
         self.indexes[i] = index
Beispiel #3
0
 def _inject_packets(self, tracking_manager=None):
   if tracking_manager is None:
     tracking_manager = TrackingManager.get()
   for i in range(len(self.tracks)):
     index = self.indexes[i]
     track = self.tracks[i]
     while index < len(track):
       packet = track[index]
       if packet.timestamp > time.time():
         break
       tracking_manager.add_packet(packet)
       index += 1
     self.indexes[i] = index
Beispiel #4
0
 def _post_packet(self, raw_packet):
   TrackingManager.get().add_packet(TelemetryPacket.create_from_json(raw_packet))
   self.data.append(raw_packet)
Beispiel #5
0
 def update_placemarks(self):
   for id_, pm in TrackingManager.get().placemarks.items():
     if id_ not in self.placemarks:
       self.placemarks[id_] = KmlPlacemark(pm)