#!/usr/bin/env python2 # -*- coding: utf-8 -*- ################################################## # GNU Radio Python Flow Graph # Title: IQ Transmitter # Generated: Mon Jan 27 16:30:38 2020 ################################################## if __name__ == '__main__': import ctypes import sys if sys.platform.startswith('linux'): try: x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: print "Warning: failed to XInitThreads()" from gnuradio import blocks from gnuradio import eng_notation from gnuradio import gr from gnuradio import wxgui from gnuradio.eng_option import eng_option from gnuradio.fft import window from gnuradio.filter import firdes from gnuradio.wxgui import fftsink2 from gnuradio.wxgui import scopesink2 from grc_gnuradio import wxgui as grc_wxgui from optparse import OptionParser import limesdr import wx class iq_transmitter(grc_wxgui.top_block_gui): def __init__(self): grc_wxgui.top_block_gui.__init__(self, title="IQ Transmitter") _icon_path = "/usr/share/icons/hicolor/32x32/apps/gnuradio-grc.png" self.SetIcon(wx.Icon(_icon_path, wx.BITMAP_TYPE_ANY)) ################################################## # Variables ################################################## self.samp_rate = samp_rate = 2e6 ################################################## # Blocks ################################################## self.wxgui_scopesink2_0_0 = scopesink2.scope_sink_c( self.GetWin(), title='Scope Plot', sample_rate=samp_rate, v_scale=0, v_offset=0, t_scale=0, ac_couple=False, xy_mode=False, num_inputs=1, trig_mode=wxgui.TRIG_MODE_AUTO, y_axis_label='Counts', ) self.Add(self.wxgui_scopesink2_0_0.win) self.wxgui_fftsink2_0_0 = fftsink2.fft_sink_c( self.GetWin(), baseband_freq=0, y_per_div=10, y_divs=10, ref_level=0, ref_scale=2.0, sample_rate=samp_rate, fft_size=1024, fft_rate=15, average=False, avg_alpha=None, title='FFT Plot', peak_hold=False, ) self.Add(self.wxgui_fftsink2_0_0.win) self.limesdr_sink_0 = limesdr.sink('', 0, '', '') self.limesdr_sink_0.set_sample_rate(samp_rate) self.limesdr_sink_0.set_center_freq(433.92e6, 0) self.limesdr_sink_0.set_bandwidth(5e6,0) self.limesdr_sink_0.set_gain(60,0) self.limesdr_sink_0.set_antenna(255,0) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) self.blocks_multiply_const_vxx_0 = blocks.multiply_const_vcc((1, )) self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, '/home/user/Dev/Git Repos/ism-band-trollkit-spoofer/output.complex', True) ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_multiply_const_vxx_0, 0)) self.connect((self.blocks_multiply_const_vxx_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.limesdr_sink_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_0_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.wxgui_scopesink2_0_0, 0)) def get_samp_rate(self): return self.samp_rate def set_samp_rate(self, samp_rate): self.samp_rate = samp_rate self.wxgui_scopesink2_0_0.set_sample_rate(self.samp_rate) self.wxgui_fftsink2_0_0.set_sample_rate(self.samp_rate) self.blocks_throttle_0.set_sample_rate(self.samp_rate) def main(top_block_cls=iq_transmitter, options=None): tb = top_block_cls() tb.Start(True) tb.Wait() if __name__ == '__main__': main()