Temp commit while adding a modes_report class using named tuples. Mlat server definitely broken as a result.

This commit is contained in:
Nick Foster
2013-01-09 23:26:49 -08:00
parent 7f6a3c7779
commit 1a0ebab29c
9 changed files with 102 additions and 79 deletions
-23
View File
@@ -43,29 +43,6 @@ import bisect
pickle_prot = 0
#pickle_prot = pickle.HIGHEST_PROTOCOL
class stamp:
def __init__(self, clientinfo, secs, frac_secs):
self.clientinfo = clientinfo
self.secs = secs
self.frac_secs = frac_secs
def __lt__(self, other):
if self.secs == other.secs:
return self.frac_secs < other.frac_secs
else:
return self.secs < other.secs
def __gt__(self, other):
if self.secs == other.secs:
return self.frac_secs > other.frac_secs
else:
return self.secs > other.secs
def __eq__(self, other):
return self.secs == other.secs and self.frac_secs == other.frac_secs
def __ne__(self, other):
return self.secs != other.secs or self.frac_secs != other.frac_secs
#good to within ms for comparison
def tofloat(self):
return self.secs + self.frac_secs
def ordered_insert(a, item):
a.insert(bisect.bisect_right(a, item), item)
+6 -1
View File
@@ -27,6 +27,8 @@ from optparse import OptionParser
import time, os, sys, threading
from string import split, join
import air_modes
from air_modes.types import modes_report, stamp
from air_modes.parse import modes_reply
import gnuradio.gr.gr_threading as _threading
import csv
from air_modes.exceptions import *
@@ -240,9 +242,12 @@ if __name__ == '__main__':
if not queue.empty_p() :
while not queue.empty_p() :
msg = queue.delete_head() #blocking read
[data, ecc, reference, timestamp_int, timestamp_frac] = msg.to_string().split()
#error handling? creating a modes_reply can throw NoHandlerError, but you really want that to be handled by the output plugin in question.
msg_tuple = modes_report(modes_reply(long(data, 16)), long(ecc, 16), float(reference), stamp(int(timestamp_int), float(timestamp_frac)))
for out in outputs:
try:
out(msg.to_string())
out(msg_tuple)
except air_modes.ADSBError:
pass