aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-04-02 20:45:01 +0200
committerHarald Welte <laforge@gnumonks.org>2015-04-02 20:45:01 +0200
commitbdced7045dbc4a0e921dc5401c74a9f6064dcca9 (patch)
tree55e5efdbbf4f096a1b172a442b9762c33b9e5a6c
parentdac8eb2ccf59c992d9829e6f1cc4ded9d7b5178f (diff)
add ads-b transmission script without GUI requirementHEADmaster
-rwxr-xr-xadsb_tx_laforge_nogui.py81
1 files changed, 81 insertions, 0 deletions
diff --git a/adsb_tx_laforge_nogui.py b/adsb_tx_laforge_nogui.py
new file mode 100755
index 0000000..7360e0d
--- /dev/null
+++ b/adsb_tx_laforge_nogui.py
@@ -0,0 +1,81 @@
+#!/usr/bin/env python
+##################################################
+# Gnuradio Python Flow Graph
+# Title: Top Block
+# Generated: Thu Apr 2 20:42:21 2015
+##################################################
+
+from gnuradio import blocks
+from gnuradio import eng_notation
+from gnuradio import gr
+from gnuradio import uhd
+from gnuradio.eng_option import eng_option
+from gnuradio.filter import firdes
+from optparse import OptionParser
+import adsbtx
+import time
+import wx
+
+class top_block(gr.top_block):
+
+ def __init__(self):
+ gr.top_block.__init__(self)
+
+ ##################################################
+ # Variables
+ ##################################################
+ self.samp_rate = samp_rate = 4000000
+
+ ##################################################
+ # Blocks
+ ##################################################
+ self.uhd_usrp_sink_0 = uhd.usrp_sink(
+ ",".join(("", "")),
+ uhd.stream_args(
+ cpu_format="fc32",
+ channels=range(1),
+ ),
+ "packet_len",
+ )
+ self.uhd_usrp_sink_0.set_subdev_spec("A:A", 0)
+ self.uhd_usrp_sink_0.set_samp_rate(samp_rate)
+ self.uhd_usrp_sink_0.set_center_freq(1090000000, 0)
+ self.uhd_usrp_sink_0.set_gain(33, 0)
+ self.blocks_tagged_stream_multiply_length_0 = blocks.tagged_stream_multiply_length(gr.sizeof_gr_complex*1, "packet_len", 2)
+ self.blocks_socket_pdu_0 = blocks.socket_pdu("TCP_SERVER", "", "52002", 10000, False)
+ self.blocks_repeat_0 = blocks.repeat(gr.sizeof_char*1, 2)
+ self.blocks_pdu_to_tagged_stream_0 = blocks.pdu_to_tagged_stream(blocks.byte_t, "packet_len")
+ self.blocks_float_to_complex_0 = blocks.float_to_complex(1)
+ self.blocks_char_to_float_0 = blocks.char_to_float(1, 1.25)
+ self.AdsbEncoder_0 = adsbtx.AdsbEncoder(200)
+
+ ##################################################
+ # Connections
+ ##################################################
+ self.connect((self.blocks_char_to_float_0, 0), (self.blocks_float_to_complex_0, 0))
+ self.connect((self.blocks_repeat_0, 0), (self.blocks_char_to_float_0, 0))
+ self.connect((self.blocks_float_to_complex_0, 0), (self.blocks_tagged_stream_multiply_length_0, 0))
+ self.connect((self.blocks_tagged_stream_multiply_length_0, 0), (self.uhd_usrp_sink_0, 0))
+ self.connect((self.blocks_pdu_to_tagged_stream_0, 0), (self.blocks_repeat_0, 0))
+
+ ##################################################
+ # Asynch Message Connections
+ ##################################################
+ self.msg_connect(self.AdsbEncoder_0, "pdus", self.blocks_pdu_to_tagged_stream_0, "pdus")
+ self.msg_connect(self.blocks_socket_pdu_0, "pdus", self.AdsbEncoder_0, "pdus")
+
+
+ def get_samp_rate(self):
+ return self.samp_rate
+
+ def set_samp_rate(self, samp_rate):
+ self.samp_rate = samp_rate
+ self.uhd_usrp_sink_0.set_samp_rate(self.samp_rate)
+
+if __name__ == '__main__':
+ parser = OptionParser(option_class=eng_option, usage="%prog: [options]")
+ (options, args) = parser.parse_args()
+ tb = top_block()
+ tb.start()
+ raw_input('Press Enter to quit: ')
+ tb.stop()