KML at least works some. Need to pass DB filename into KML constructor.

This commit is contained in:
Nick Foster 2010-10-19 10:05:33 -07:00
parent 76f884e81f
commit 0edcc29380
4 changed files with 8 additions and 10 deletions

Binary file not shown.

Binary file not shown.

View File

@ -19,7 +19,6 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
# #
#!/usr/bin/env python
import time, os, sys import time, os, sys
from string import split, join from string import split, join
import modes_parse import modes_parse
@ -28,7 +27,7 @@ import sqlite3
class modes_output_sql(modes_parse.modes_parse): class modes_output_sql(modes_parse.modes_parse):
def __init__(self): def __init__(self):
#create the database #create the database
self.db = sqlite3.connect(':memory:') #RAM-based database, no persistence self.db = sqlite3.connect('wat.db') #RAM-based database, no persistence
#now execute a schema to create the tables you need #now execute a schema to create the tables you need
c = self.db.cursor() c = self.db.cursor()
query = """CREATE TABLE "positions" ( query = """CREATE TABLE "positions" (

View File

@ -1,4 +1,4 @@
# #!/usr/bin/env python
# Copyright 2010 Nick Foster # Copyright 2010 Nick Foster
# #
# This file is part of gr-air-modes # This file is part of gr-air-modes
@ -19,8 +19,6 @@
# Boston, MA 02110-1301, USA. # Boston, MA 02110-1301, USA.
# #
#!/usr/bin/env python
from gnuradio import gr, gru, optfir, eng_notation, blks2, air from gnuradio import gr, gru, optfir, eng_notation, blks2, air
from gnuradio import uhd from gnuradio import uhd
from gnuradio.eng_option import eng_option from gnuradio.eng_option import eng_option
@ -31,6 +29,7 @@ from usrpm import usrp_dbid
from modes_print import modes_output_print from modes_print import modes_output_print
from modes_sql import modes_output_sql from modes_sql import modes_output_sql
from modes_sbs1 import modes_output_sbs1 from modes_sbs1 import modes_output_sbs1
from modes_kml import modes_kml
import gnuradio.gr.gr_threading as _threading import gnuradio.gr.gr_threading as _threading
class top_block_runner(_threading.Thread): class top_block_runner(_threading.Thread):
@ -136,11 +135,11 @@ if __name__ == '__main__':
updates = [] #registry of plugin update functions updates = [] #registry of plugin update functions
if options.kml is not None: if options.kml is not None:
sqlport = modes_output_sql() sqlport = modes_output_sql() #create a SQL parser to push stuff into SQLite
outputs.append(sqlport.insert) outputs.append(sqlport.insert)
#also we spawn a thread to run every 30 seconds (or whatever) to generate KML #also we spawn a thread to run every 30 seconds (or whatever) to generate KML
kmlgen = modes_kml(sqlport.db, options.kml) #this is a thread kmlgen = modes_kml(sqlport.db, options.kml) #create a KML generating thread which reads the database
if options.sbs1 is True: if options.sbs1 is True:
sbs1port = modes_output_sbs1() sbs1port = modes_output_sbs1()
outputs.append(sbs1port.output) outputs.append(sbs1port.output)
@ -176,6 +175,6 @@ if __name__ == '__main__':
except KeyboardInterrupt: except KeyboardInterrupt:
fg.stop() fg.stop()
runner = None runner = None
if kmlgen is not None: #this breaks your nice output registry scheme if options.kml is not None:
kmlgen = None kmlgen.done = True
break break