From 35ed1f519f2f1ac4a0c7a3ce830d4d4176b0dc84 Mon Sep 17 00:00:00 2001 From: Clayton Smith Date: Tue, 1 Oct 2019 14:51:09 -0400 Subject: [PATCH] Convert blocks and sample flowgraphs to 3.8 --- apps/lora_receive_file.grc | 897 ++---- apps/lora_receive_file.py | 193 +- apps/lora_receive_realtime.grc | 3219 +++++++--------------- apps/lora_receive_realtime.py | 204 +- cmake/Modules/targetConfig.cmake.in | 26 + grc/CMakeLists.txt | 11 +- grc/lora_controller.block.yml | 11 + grc/lora_controller.xml | 9 - grc/lora_message_file_sink.block.yml | 20 + grc/lora_message_file_sink.xml | 19 - grc/lora_message_mongodb_sink.block.yml | 36 + grc/lora_message_mongodb_sink.xml | 47 - grc/lora_message_socket_sink.block.yml | 30 + grc/lora_message_socket_sink.xml | 45 - grc/lora_message_socket_source.block.yml | 25 + grc/lora_message_socket_source.xml | 28 - grc/lora_receiver.block.yml | 87 + grc/lora_receiver.xml | 166 -- 18 files changed, 1789 insertions(+), 3284 deletions(-) create mode 100644 cmake/Modules/targetConfig.cmake.in create mode 100644 grc/lora_controller.block.yml delete mode 100644 grc/lora_controller.xml create mode 100644 grc/lora_message_file_sink.block.yml delete mode 100644 grc/lora_message_file_sink.xml create mode 100644 grc/lora_message_mongodb_sink.block.yml delete mode 100644 grc/lora_message_mongodb_sink.xml create mode 100644 grc/lora_message_socket_sink.block.yml delete mode 100644 grc/lora_message_socket_sink.xml create mode 100644 grc/lora_message_socket_source.block.yml delete mode 100644 grc/lora_message_socket_source.xml create mode 100644 grc/lora_receiver.block.yml delete mode 100644 grc/lora_receiver.xml diff --git a/apps/lora_receive_file.grc b/apps/lora_receive_file.grc index 10d5c99..8ac6066 100644 --- a/apps/lora_receive_file.grc +++ b/apps/lora_receive_file.grc @@ -1,622 +1,275 @@ - - - - Tue Apr 12 11:23:34 2016 - - options - - author - - - - window_size - - - - category - Custom - - - comment - - - - description - - - - _enabled - True - - - _coordinate - (8, 12) - - - _rotation - 0 - - - generate_options - wx_gui - - - hier_block_src_path - .: - - - id - lora_receive_file - - - max_nouts - 0 - - - qt_qss_theme - - - - realtime_scheduling - - - - run_command - {python} -u {filename} - - - run_options - prompt - - - run - True - - - thread_safe_setters - - - - title - - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (552, 13) - - - _rotation - 0 - - - id - bitrate - - - value - sf * (1 / (2**sf / float(bw))) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (456, 13) - - - _rotation - 0 - - - id - bw - - - value - 125000 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (280, 13) - - - _rotation - 0 - - - id - capture_freq - - - value - 866.0e6 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (800, 13) - - - _rotation - 0 - - - id - firdes_tap - - - value - firdes.low_pass(1, samp_rate, bw, 10000, firdes.WIN_HAMMING, 6.67) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (184, 13) - - - _rotation - 0 - - - id - samp_rate - - - value - 10e6 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (384, 12) - - - _rotation - 0 - - - id - sf - - - value - 7 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (664, 13) - - - _rotation - 0 - - - id - symbols_per_sec - - - value - float(bw) / (2**sf) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (184, 76) - - - _rotation - 0 - - - id - target_freq - - - value - 868.1e6 - - - - blocks_file_source - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - file - counting_cr4_sf7.cfile - - - _coordinate - (8, 188) - - - _rotation - 0 - - - id - blocks_file_source_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - type - complex - - - repeat - True - - - vlen - 1 - - - - blocks_throttle - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - _coordinate - (232, 196) - - - _rotation - 0 - - - id - blocks_throttle_0 - - - ignoretag - True - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - samples_per_second - samp_rate - - - type - complex - - - vlen - 1 - - - - lora_lora_receiver - - bandwidth - bw - - - alias - - - - crc - True - - - center_freq - capture_freq - - - channel_list - [target_freq] - - - cr - 4 - - - comment - - - - conj - False - - - affinity - - - - decimation - 10 - - - disable_channelization - False - - - disable_drift_correction - False - - - _enabled - 1 - - - _coordinate - (416, 156) - - - _rotation - 0 - - - id - lora_lora_receiver_0 - - - implicit - False - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - reduced_rate - False - - - samp_rate - samp_rate - - - sf - sf - - - - wxgui_fftsink2 - - avg_alpha - 0 - - - average - False - - - baseband_freq - capture_freq - - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - fft_size - 1024 - - - freqvar - None - - - _coordinate - (416, 300) - - - _rotation - 0 - - - grid_pos - - - - id - wxgui_fftsink2_1 - - - notebook - - - - peak_hold - False - - - ref_level - 0 - - - ref_scale - 2.0 - - - fft_rate - 15 - - - samp_rate - samp_rate - - - title - FFT Plot - - - type - complex - - - win_size - - - - win - None - - - y_divs - 10 - - - y_per_div - 10 - - - - blocks_file_source_0 - blocks_throttle_0 - 0 - 0 - - - blocks_throttle_0 - lora_lora_receiver_0 - 0 - 0 - - - blocks_throttle_0 - wxgui_fftsink2_1 - 0 - 0 - - +options: + parameters: + author: '' + category: Custom + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: lora_receive_file + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: '' + window_size: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 12] + rotation: 0 + state: enabled + +blocks: +- name: bitrate + id: variable + parameters: + comment: '' + value: sf * (1 / (2**sf / float(bw))) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [552, 13] + rotation: 0 + state: enabled +- name: bw + id: variable + parameters: + comment: '' + value: '125000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 13] + rotation: 0 + state: enabled +- name: capture_freq + id: variable + parameters: + comment: '' + value: 866.0e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [280, 13] + rotation: 0 + state: enabled +- name: samp_rate + id: variable + parameters: + comment: '' + value: 10e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 13] + rotation: 0 + state: enabled +- name: sf + id: variable + parameters: + comment: '' + value: '7' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [384, 12] + rotation: 0 + state: enabled +- name: symbols_per_sec + id: variable + parameters: + comment: '' + value: float(bw) / (2**sf) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [664, 13] + rotation: 0 + state: enabled +- name: target_freq + id: variable + parameters: + comment: '' + value: 868.1e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 76] + rotation: 0 + state: enabled +- name: blocks_file_source_0 + id: blocks_file_source + parameters: + affinity: '' + alias: '' + begin_tag: pmt.PMT_NIL + comment: '' + file: counting_cr4_sf7.cfile + length: '0' + maxoutbuf: '0' + minoutbuf: '0' + offset: '0' + repeat: 'True' + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 164.0] + rotation: 0 + state: enabled +- name: blocks_throttle_0 + id: blocks_throttle + parameters: + affinity: '' + alias: '' + comment: '' + ignoretag: 'True' + maxoutbuf: '0' + minoutbuf: '0' + samples_per_second: samp_rate + type: complex + vlen: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [240, 196.0] + rotation: 0 + state: enabled +- name: lora_lora_receiver_0 + id: lora_lora_receiver + parameters: + affinity: '' + alias: '' + bandwidth: bw + center_freq: capture_freq + channel_list: '[target_freq]' + comment: '' + conj: 'False' + cr: '4' + crc: 'True' + decimation: '10' + disable_channelization: 'False' + disable_drift_correction: 'False' + implicit: 'False' + maxoutbuf: '0' + minoutbuf: '0' + reduced_rate: 'False' + samp_rate: samp_rate + sf: sf + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [440, 148.0] + rotation: 0 + state: enabled +- name: qtgui_freq_sink_x_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: samp_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: capture_freq + fftsize: '1024' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + label: Relative Gain + label1: '' + label10: '''''' + label2: '''''' + label3: '''''' + label4: '''''' + label5: '''''' + label6: '''''' + label7: '''''' + label8: '''''' + label9: '''''' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '1' + showports: 'False' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: firdes.WIN_BLACKMAN_hARRIS + ymax: '10' + ymin: '-140' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [440, 304.0] + rotation: 0 + state: true + +connections: +- [blocks_file_source_0, '0', blocks_throttle_0, '0'] +- [blocks_throttle_0, '0', lora_lora_receiver_0, '0'] +- [blocks_throttle_0, '0', qtgui_freq_sink_x_0, '0'] + +metadata: + file_format: 1 diff --git a/apps/lora_receive_file.py b/apps/lora_receive_file.py index 605de53..3045346 100755 --- a/apps/lora_receive_file.py +++ b/apps/lora_receive_file.py @@ -1,10 +1,14 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -################################################## + +# +# SPDX-License-Identifier: GPL-3.0 +# # GNU Radio Python Flow Graph # Title: Lora Receive File -# Generated: Mon Jan 8 15:44:58 2018 -################################################## +# GNU Radio version: 3.8.0.0 + +from distutils.version import StrictVersion if __name__ == '__main__': import ctypes @@ -14,95 +18,145 @@ if __name__ == '__main__': x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: - print "Warning: failed to XInitThreads()" + 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 PyQt5 import Qt +from gnuradio import qtgui from gnuradio.filter import firdes -from gnuradio.wxgui import fftsink2 -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser +import sip +from gnuradio import blocks +import pmt +from gnuradio import gr +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation import lora -import wx +from gnuradio import qtgui - -class lora_receive_file(grc_wxgui.top_block_gui): +class lora_receive_file(gr.top_block, Qt.QWidget): def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="Lora Receive File") + gr.top_block.__init__(self, "Lora Receive File") + Qt.QWidget.__init__(self) + self.setWindowTitle("Lora Receive File") + qtgui.util.check_set_qss() + try: + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) + except: + pass + self.top_scroll_layout = Qt.QVBoxLayout() + self.setLayout(self.top_scroll_layout) + self.top_scroll = Qt.QScrollArea() + self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) + self.top_scroll_layout.addWidget(self.top_scroll) + self.top_scroll.setWidgetResizable(True) + self.top_widget = Qt.QWidget() + self.top_scroll.setWidget(self.top_widget) + self.top_layout = Qt.QVBoxLayout(self.top_widget) + self.top_grid_layout = Qt.QGridLayout() + self.top_layout.addLayout(self.top_grid_layout) + + self.settings = Qt.QSettings("GNU Radio", "lora_receive_file") + + try: + if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + else: + self.restoreGeometry(self.settings.value("geometry")) + except: + pass ################################################## # Variables ################################################## self.sf = sf = 7 - self.samp_rate = samp_rate = 10e6 self.bw = bw = 125000 self.target_freq = target_freq = 868.1e6 self.symbols_per_sec = symbols_per_sec = float(bw) / (2**sf) - self.firdes_tap = firdes_tap = firdes.low_pass(1, samp_rate, bw, 10000, firdes.WIN_HAMMING, 6.67) + self.samp_rate = samp_rate = 10e6 self.capture_freq = capture_freq = 866.0e6 self.bitrate = bitrate = sf * (1 / (2**sf / float(bw))) ################################################## # Blocks ################################################## - self.wxgui_fftsink2_1 = fftsink2.fft_sink_c( - self.GetWin(), - baseband_freq=capture_freq, - 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.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( + 1024, #size + firdes.WIN_BLACKMAN_hARRIS, #wintype + capture_freq, #fc + samp_rate, #bw + "", #name + 1 ) - self.Add(self.wxgui_fftsink2_1.win) - self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, ([target_freq]), bw, sf, False, 4, True, False, False, 10, False, False) + self.qtgui_freq_sink_x_0.set_update_time(0.10) + self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) + self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') + self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") + self.qtgui_freq_sink_x_0.enable_autoscale(False) + self.qtgui_freq_sink_x_0.enable_grid(False) + self.qtgui_freq_sink_x_0.set_fft_average(1.0) + self.qtgui_freq_sink_x_0.enable_axis_labels(True) + self.qtgui_freq_sink_x_0.enable_control_panel(False) + + + + labels = ['', '', '', '', '', + '', '', '', '', ''] + widths = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + colors = ["blue", "red", "green", "black", "cyan", + "magenta", "yellow", "dark red", "dark green", "dark blue"] + alphas = [1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in range(1): + if len(labels[i]) == 0: + self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) + else: + self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) + self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) + self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) + self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) + + self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) + self.lora_lora_receiver_0 = lora.lora_receiver(samp_rate, capture_freq, [target_freq], bw, sf, False, 4, True, False, False, 10, False, False) self.blocks_throttle_0 = blocks.throttle(gr.sizeof_gr_complex*1, samp_rate,True) - self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, 'counting_cr4_sf7.cfile', True) + self.blocks_file_source_0 = blocks.file_source(gr.sizeof_gr_complex*1, 'counting_cr4_sf7.cfile', True, 0, 0) + self.blocks_file_source_0.set_begin_tag(pmt.PMT_NIL) + + ################################################## # Connections ################################################## self.connect((self.blocks_file_source_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.blocks_throttle_0, 0), (self.lora_lora_receiver_0, 0)) - self.connect((self.blocks_throttle_0, 0), (self.wxgui_fftsink2_1, 0)) + self.connect((self.blocks_throttle_0, 0), (self.qtgui_freq_sink_x_0, 0)) + + def closeEvent(self, event): + self.settings = Qt.QSettings("GNU Radio", "lora_receive_file") + self.settings.setValue("geometry", self.saveGeometry()) + event.accept() def get_sf(self): return self.sf def set_sf(self, sf): self.sf = sf + self.set_bitrate(self.sf * (1 / (2**self.sf / float(self.bw)))) self.set_symbols_per_sec(float(self.bw) / (2**self.sf)) self.lora_lora_receiver_0.set_sf(self.sf) - self.set_bitrate(self.sf * (1 / (2**self.sf / float(self.bw)))) - - def get_samp_rate(self): - return self.samp_rate - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.wxgui_fftsink2_1.set_sample_rate(self.samp_rate) - self.set_firdes_tap(firdes.low_pass(1, self.samp_rate, self.bw, 10000, firdes.WIN_HAMMING, 6.67)) - self.blocks_throttle_0.set_sample_rate(self.samp_rate) def get_bw(self): return self.bw def set_bw(self, bw): self.bw = bw - self.set_symbols_per_sec(float(self.bw) / (2**self.sf)) - self.set_firdes_tap(firdes.low_pass(1, self.samp_rate, self.bw, 10000, firdes.WIN_HAMMING, 6.67)) self.set_bitrate(self.sf * (1 / (2**self.sf / float(self.bw)))) + self.set_symbols_per_sec(float(self.bw) / (2**self.sf)) def get_target_freq(self): return self.target_freq @@ -116,18 +170,21 @@ class lora_receive_file(grc_wxgui.top_block_gui): def set_symbols_per_sec(self, symbols_per_sec): self.symbols_per_sec = symbols_per_sec - def get_firdes_tap(self): - return self.firdes_tap + def get_samp_rate(self): + return self.samp_rate - def set_firdes_tap(self, firdes_tap): - self.firdes_tap = firdes_tap + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.blocks_throttle_0.set_sample_rate(self.samp_rate) + self.qtgui_freq_sink_x_0.set_frequency_range(self.capture_freq, self.samp_rate) def get_capture_freq(self): return self.capture_freq def set_capture_freq(self, capture_freq): self.capture_freq = capture_freq - self.wxgui_fftsink2_1.set_baseband_freq(self.capture_freq) + self.lora_lora_receiver_0.set_center_freq(self.capture_freq) + self.qtgui_freq_sink_x_0.set_frequency_range(self.capture_freq, self.samp_rate) def get_bitrate(self): return self.bitrate @@ -136,11 +193,33 @@ class lora_receive_file(grc_wxgui.top_block_gui): self.bitrate = bitrate + def main(top_block_cls=lora_receive_file, options=None): + if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + style = gr.prefs().get_string('qtgui', 'style', 'raster') + Qt.QApplication.setGraphicsSystem(style) + qapp = Qt.QApplication(sys.argv) + tb = top_block_cls() - tb.Start(True) - tb.Wait() + tb.start() + tb.show() + + def sig_handler(sig=None, frame=None): + Qt.QApplication.quit() + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + timer = Qt.QTimer() + timer.start(500) + timer.timeout.connect(lambda: None) + + def quitting(): + tb.stop() + tb.wait() + qapp.aboutToQuit.connect(quitting) + qapp.exec_() if __name__ == '__main__': diff --git a/apps/lora_receive_realtime.grc b/apps/lora_receive_realtime.grc index a5331f8..4897946 100644 --- a/apps/lora_receive_realtime.grc +++ b/apps/lora_receive_realtime.grc @@ -1,2219 +1,1000 @@ - - - - Tue Apr 12 11:23:34 2016 - - options - - author - - - - window_size - - - - category - Custom - - - comment - - - - description - - - - _enabled - True - - - _coordinate - (8, 12) - - - _rotation - 0 - - - generate_options - wx_gui - - - hier_block_src_path - .: - - - id - lora_receive_realtime - - - max_nouts - 0 - - - qt_qss_theme - - - - realtime_scheduling - - - - run_command - {python} -u {filename} - - - run_options - prompt - - - run - True - - - thread_safe_setters - - - - title - - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (544, 12) - - - _rotation - 0 - - - id - bitrate - - - value - sf * (1 / (2**sf / float(bw))) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (456, 12) - - - _rotation - 0 - - - id - bw - - - value - 125000 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (280, 13) - - - _rotation - 0 - - - id - capture_freq - - - value - 868e6 - - - - variable - - comment - The decimation determines the oversampling rate. -A sample rate of 1e6 and decimation of 1 equals -8 times oversampling, a decimation of 2 is 4 times -oversampling, and so on. Set higher decimation -for better performance, but worse accuracy. - - - _enabled - True - - - _coordinate - (640, 76) - - - _rotation - 0 - - - id - decimation - - - value - 1 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (384, 76) - - - _rotation - 0 - - - id - downlink - - - value - False - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (768, 12) - - - _rotation - 0 - - - id - firdes_tap - - - value - firdes.low_pass(1, samp_rate, bw, 10000, firdes.WIN_HAMMING, 6.67) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (184, 13) - - - _rotation - 0 - - - id - samp_rate - - - value - 1e6 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (384, 12) - - - _rotation - 0 - - - id - sf - - - value - 11 - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (640, 12) - - - _rotation - 0 - - - id - symbols_per_sec - - - value - float(bw) / (2**sf) - - - - variable - - comment - - - - _enabled - True - - - _coordinate - (280, 76) - - - _rotation - 0 - - - id - target_freq - - - value - 868.1e6 - - - - lora_lora_receiver - - bandwidth - bw - - - alias - - - - crc - True - - - center_freq - capture_freq - - - channel_list - [target_freq] - - - cr - 4 - - - comment - - - - conj - downlink - - - affinity - - - - decimation - decimation - - - disable_channelization - False - - - disable_drift_correction - False - - - _enabled - 1 - - - _coordinate - (392, 212) - - - _rotation - 0 - - - id - lora_lora_receiver_0 - - - implicit - False - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - reduced_rate - False - - - samp_rate - 1e6 - - - sf - sf - - - - lora_message_socket_sink - - alias - - - - comment - - - - affinity - - - - _enabled - True - - - _coordinate - (640, 236) - - - _rotation - 0 - - - id - lora_message_socket_sink_0 - - - ip - 127.0.0.1 - - - layer - 0 - - - port - 40868 - - - - osmosdr_source - - alias - - - - ant0 - - - - bb_gain0 - 20 - - - bw0 - 0 - - - dc_offset_mode0 - 0 - - - corr0 - 0 - - - freq0 - capture_freq - - - gain_mode0 - False - - - if_gain0 - 20 - - - iq_balance_mode0 - 0 - - - gain0 - 10 - - - ant1 - - - - bb_gain1 - 20 - - - bw1 - 0 - - - dc_offset_mode1 - 0 - - - corr1 - 0 - - - freq1 - 100e6 - - - gain_mode1 - False - - - if_gain1 - 20 - - - iq_balance_mode1 - 0 - - - gain1 - 10 - - - ant2 - - - - bb_gain2 - 20 - - - bw2 - 0 - - - dc_offset_mode2 - 0 - - - corr2 - 0 - - - freq2 - 100e6 - - - gain_mode2 - False - - - if_gain2 - 20 - - - iq_balance_mode2 - 0 - - - gain2 - 10 - - - ant3 - - - - bb_gain3 - 20 - - - bw3 - 0 - - - dc_offset_mode3 - 0 - - - corr3 - 0 - - - freq3 - 100e6 - - - gain_mode3 - False - - - if_gain3 - 20 - - - iq_balance_mode3 - 0 - - - gain3 - 10 - - - ant4 - - - - bb_gain4 - 20 - - - bw4 - 0 - - - dc_offset_mode4 - 0 - - - corr4 - 0 - - - freq4 - 100e6 - - - gain_mode4 - False - - - if_gain4 - 20 - - - iq_balance_mode4 - 0 - - - gain4 - 10 - - - comment - - - - affinity - - - - args - - - - _enabled - 1 - - - _coordinate - (24, 188) - - - _rotation - 0 - - - id - osmosdr_source_0 - - - maxoutbuf - 0 - - - minoutbuf - 0 - - - nchan - 1 - - - type - fc32 - - - sample_rate - samp_rate - - - - uhd_usrp_source - - alias - - - - ant0 - RX2 - - - bw0 - 0 - - - center_freq0 - capture_freq - - - dc_offs_enb0 - "" - - - iq_imbal_enb0 - "" - - - norm_gain0 - False - - - gain0 - 15 - - - lo_export0 - False - - - lo_source0 - internal - - - ant10 - - - - bw10 - 0 - - - center_freq10 - 0 - - - dc_offs_enb10 - "" - - - iq_imbal_enb10 - "" - - - norm_gain10 - False - - - gain10 - 0 - - - lo_export10 - False - - - lo_source10 - internal - - - ant11 - - - - bw11 - 0 - - - center_freq11 - 0 - - - dc_offs_enb11 - "" - - - iq_imbal_enb11 - "" - - - norm_gain11 - False - - - gain11 - 0 - - - lo_export11 - False - - - lo_source11 - internal - - - ant12 - - - - bw12 - 0 - - - center_freq12 - 0 - - - dc_offs_enb12 - "" - - - iq_imbal_enb12 - "" - - - norm_gain12 - False - - - gain12 - 0 - - - lo_export12 - False - - - lo_source12 - internal - - - ant13 - - - - bw13 - 0 - - - center_freq13 - 0 - - - dc_offs_enb13 - "" - - - iq_imbal_enb13 - "" - - - norm_gain13 - False - - - gain13 - 0 - - - lo_export13 - False - - - lo_source13 - internal - - - ant14 - - - - bw14 - 0 - - - center_freq14 - 0 - - - dc_offs_enb14 - "" - - - iq_imbal_enb14 - "" - - - norm_gain14 - False - - - gain14 - 0 - - - lo_export14 - False - - - lo_source14 - internal - - - ant15 - - - - bw15 - 0 - - - center_freq15 - 0 - - - dc_offs_enb15 - "" - - - iq_imbal_enb15 - "" - - - norm_gain15 - False - - - gain15 - 0 - - - lo_export15 - False - - - lo_source15 - internal - - - ant16 - - - - bw16 - 0 - - - center_freq16 - 0 - - - dc_offs_enb16 - "" - - - iq_imbal_enb16 - "" - - - norm_gain16 - False - - - gain16 - 0 - - - lo_export16 - False - - - lo_source16 - internal - - - ant17 - - - - bw17 - 0 - - - center_freq17 - 0 - - - dc_offs_enb17 - "" - - - iq_imbal_enb17 - "" - - - norm_gain17 - False - - - gain17 - 0 - - - lo_export17 - False - - - lo_source17 - internal - - - ant18 - - - - bw18 - 0 - - - center_freq18 - 0 - - - dc_offs_enb18 - "" - - - iq_imbal_enb18 - "" - - - norm_gain18 - False - - - gain18 - 0 - - - lo_export18 - False - - - lo_source18 - internal - - - ant19 - - - - bw19 - 0 - - - center_freq19 - 0 - - - dc_offs_enb19 - "" - - - iq_imbal_enb19 - "" - - - norm_gain19 - False - - - gain19 - 0 - - - lo_export19 - False - - - lo_source19 - internal - - - ant1 - - - - bw1 - 0 - - - center_freq1 - 0 - - - dc_offs_enb1 - "" - - - iq_imbal_enb1 - "" - - - norm_gain1 - False - - - gain1 - 0 - - - lo_export1 - False - - - lo_source1 - internal - - - ant20 - - - - bw20 - 0 - - - center_freq20 - 0 - - - dc_offs_enb20 - "" - - - iq_imbal_enb20 - "" - - - norm_gain20 - False - - - gain20 - 0 - - - lo_export20 - False - - - lo_source20 - internal - - - ant21 - - - - bw21 - 0 - - - center_freq21 - 0 - - - dc_offs_enb21 - "" - - - iq_imbal_enb21 - "" - - - norm_gain21 - False - - - gain21 - 0 - - - lo_export21 - False - - - lo_source21 - internal - - - ant22 - - - - bw22 - 0 - - - center_freq22 - 0 - - - dc_offs_enb22 - "" - - - iq_imbal_enb22 - "" - - - norm_gain22 - False - - - gain22 - 0 - - - lo_export22 - False - - - lo_source22 - internal - - - ant23 - - - - bw23 - 0 - - - center_freq23 - 0 - - - dc_offs_enb23 - "" - - - iq_imbal_enb23 - "" - - - norm_gain23 - False - - - gain23 - 0 - - - lo_export23 - False - - - lo_source23 - internal - - - ant24 - - - - bw24 - 0 - - - center_freq24 - 0 - - - dc_offs_enb24 - "" - - - iq_imbal_enb24 - "" - - - norm_gain24 - False - - - gain24 - 0 - - - lo_export24 - False - - - lo_source24 - internal - - - ant25 - - - - bw25 - 0 - - - center_freq25 - 0 - - - dc_offs_enb25 - "" - - - iq_imbal_enb25 - "" - - - norm_gain25 - False - - - gain25 - 0 - - - lo_export25 - False - - - lo_source25 - internal - - - ant26 - - - - bw26 - 0 - - - center_freq26 - 0 - - - dc_offs_enb26 - "" - - - iq_imbal_enb26 - "" - - - norm_gain26 - False - - - gain26 - 0 - - - lo_export26 - False - - - lo_source26 - internal - - - ant27 - - - - bw27 - 0 - - - center_freq27 - 0 - - - dc_offs_enb27 - "" - - - iq_imbal_enb27 - "" - - - norm_gain27 - False - - - gain27 - 0 - - - lo_export27 - False - - - lo_source27 - internal - - - ant28 - - - - bw28 - 0 - - - center_freq28 - 0 - - - dc_offs_enb28 - "" - - - iq_imbal_enb28 - "" - - - norm_gain28 - False - - - gain28 - 0 - - - lo_export28 - False - - - lo_source28 - internal - - - ant29 - - - - bw29 - 0 - - - center_freq29 - 0 - - - dc_offs_enb29 - "" - - - iq_imbal_enb29 - "" - - - norm_gain29 - False - - - gain29 - 0 - - - lo_export29 - False - - - lo_source29 - internal - - - ant2 - - - - bw2 - 0 - - - center_freq2 - 0 - - - dc_offs_enb2 - "" - - - iq_imbal_enb2 - "" - - - norm_gain2 - False - - - gain2 - 0 - - - lo_export2 - False - - - lo_source2 - internal - - - ant30 - - - - bw30 - 0 - - - center_freq30 - 0 - - - dc_offs_enb30 - "" - - - iq_imbal_enb30 - "" - - - norm_gain30 - False - - - gain30 - 0 - - - lo_export30 - False - - - lo_source30 - internal - - - ant31 - - - - bw31 - 0 - - - center_freq31 - 0 - - - dc_offs_enb31 - "" - - - iq_imbal_enb31 - "" - - - norm_gain31 - False - - - gain31 - 0 - - - lo_export31 - False - - - lo_source31 - internal - - - ant3 - - - - bw3 - 0 - - - center_freq3 - 0 - - - dc_offs_enb3 - "" - - - iq_imbal_enb3 - "" - - - norm_gain3 - False - - - gain3 - 0 - - - lo_export3 - False - - - lo_source3 - internal - - - ant4 - - - - bw4 - 0 - - - center_freq4 - 0 - - - dc_offs_enb4 - "" - - - iq_imbal_enb4 - "" - - - norm_gain4 - False - - - gain4 - 0 - - - lo_export4 - False - - - lo_source4 - internal - - - ant5 - - - - bw5 - 0 - - - center_freq5 - 0 - - - dc_offs_enb5 - "" - - - iq_imbal_enb5 - "" - - - norm_gain5 - False - - - gain5 - 0 - - - lo_export5 - False - - - lo_source5 - internal - - - ant6 - - - - bw6 - 0 - - - center_freq6 - 0 - - - dc_offs_enb6 - "" - - - iq_imbal_enb6 - "" - - - norm_gain6 - False - - - gain6 - 0 - - - lo_export6 - False - - - lo_source6 - internal - - - ant7 - - - - bw7 - 0 - - - center_freq7 - 0 - - - dc_offs_enb7 - "" - - - iq_imbal_enb7 - "" - - - norm_gain7 - False - - - gain7 - 0 - - - lo_export7 - False - - - lo_source7 - internal - - - ant8 - - - - bw8 - 0 - - - center_freq8 - 0 - - - dc_offs_enb8 - "" - - - iq_imbal_enb8 - "" - - - norm_gain8 - False - - - gain8 - 0 - - - lo_export8 - False - - - lo_source8 - internal - - - ant9 - - - - bw9 - 0 - - - center_freq9 - 0 - - - dc_offs_enb9 - "" - - - iq_imbal_enb9 - "" - - - norm_gain9 - False - - - gain9 - 0 - - - lo_export9 - False - - - lo_source9 - internal - - - clock_rate - 0.0 - - - comment - - - - affinity - - - - dev_addr - "" - - - dev_args - "" - - - _enabled - 0 - - - _coordinate - (16, 388) - - - _rotation - 0 - - - id - uhd_usrp_source_0 - - - maxoutbuf - 0 - - - clock_source0 - - - - sd_spec0 - - - - time_source0 - - - - clock_source1 - - - - sd_spec1 - - - - time_source1 - - - - clock_source2 - - - - sd_spec2 - - - - time_source2 - - - - clock_source3 - - - - sd_spec3 - - - - time_source3 - - - - clock_source4 - - - - sd_spec4 - - - - time_source4 - - - - clock_source5 - - - - sd_spec5 - - - - time_source5 - - - - clock_source6 - - - - sd_spec6 - - - - time_source6 - - - - clock_source7 - - - - sd_spec7 - - - - time_source7 - - - - minoutbuf - 0 - - - nchan - 1 - - - num_mboards - 1 - - - type - fc32 - - - samp_rate - samp_rate - - - hide_cmd_port - False - - - hide_lo_controls - True - - - stream_args - - - - stream_chans - [] - - - sync - - - - otw - - - - - wxgui_fftsink2 - - avg_alpha - 0 - - - average - False - - - baseband_freq - capture_freq - - - alias - - - - comment - - - - affinity - - - - _enabled - 1 - - - fft_size - 1024 - - - freqvar - None - - - _coordinate - (392, 340) - - - _rotation - 0 - - - grid_pos - - - - id - wxgui_fftsink2_1 - - - notebook - - - - peak_hold - False - - - ref_level - 0 - - - ref_scale - 2.0 - - - fft_rate - 15 - - - samp_rate - samp_rate - - - title - FFT Plot - - - type - complex - - - win_size - - - - win - None - - - y_divs - 10 - - - y_per_div - 10 - - - - lora_lora_receiver_0 - lora_message_socket_sink_0 - frames - in - - - osmosdr_source_0 - lora_lora_receiver_0 - 0 - 0 - - - osmosdr_source_0 - wxgui_fftsink2_1 - 0 - 0 - - - uhd_usrp_source_0 - lora_lora_receiver_0 - 0 - 0 - - - uhd_usrp_source_0 - wxgui_fftsink2_1 - 0 - 0 - - +options: + parameters: + author: '' + category: Custom + cmake_opt: '' + comment: '' + copyright: '' + description: '' + gen_cmake: 'On' + gen_linking: dynamic + generate_options: qt_gui + hier_block_src_path: '.:' + id: lora_receive_realtime + max_nouts: '0' + output_language: python + placement: (0,0) + qt_qss_theme: '' + realtime_scheduling: '' + run: 'True' + run_command: '{python} -u {filename}' + run_options: prompt + sizing_mode: fixed + thread_safe_setters: '' + title: '' + window_size: '' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [8, 12] + rotation: 0 + state: enabled + +blocks: +- name: bitrate + id: variable + parameters: + comment: '' + value: sf * (1 / (2**sf / float(bw))) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [544, 12] + rotation: 0 + state: enabled +- name: bw + id: variable + parameters: + comment: '' + value: '125000' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [456, 12] + rotation: 0 + state: enabled +- name: capture_freq + id: variable + parameters: + comment: '' + value: 868e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [280, 13] + rotation: 0 + state: enabled +- name: decimation + id: variable + parameters: + comment: 'The decimation determines the oversampling rate. + + A sample rate of 1e6 and decimation of 1 equals + + 8 times oversampling, a decimation of 2 is 4 times + + oversampling, and so on. Set higher decimation + + for better performance, but worse accuracy.' + value: '1' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [640, 76] + rotation: 0 + state: enabled +- name: samp_rate + id: variable + parameters: + comment: '' + value: 1e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [184, 13] + rotation: 0 + state: enabled +- name: sf + id: variable + parameters: + comment: '' + value: '11' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [384, 12] + rotation: 0 + state: enabled +- name: symbols_per_sec + id: variable + parameters: + comment: '' + value: float(bw) / (2**sf) + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [640, 12] + rotation: 0 + state: enabled +- name: target_freq + id: variable + parameters: + comment: '' + value: 868.1e6 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [280, 76] + rotation: 0 + state: enabled +- name: lora_lora_receiver_0 + id: lora_lora_receiver + parameters: + affinity: '' + alias: '' + bandwidth: bw + center_freq: capture_freq + channel_list: '[target_freq]' + comment: '' + conj: 'False' + cr: '4' + crc: 'True' + decimation: decimation + disable_channelization: 'False' + disable_drift_correction: 'False' + implicit: 'False' + maxoutbuf: '0' + minoutbuf: '0' + reduced_rate: 'False' + samp_rate: 1e6 + sf: sf + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [392, 212] + rotation: 0 + state: enabled +- name: lora_message_socket_sink_0 + id: lora_message_socket_sink + parameters: + affinity: '' + alias: '' + comment: '' + ip: 127.0.0.1 + layer: '0' + port: '40868' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [656, 244.0] + rotation: 0 + state: enabled +- name: osmosdr_source_0 + id: osmosdr_source + parameters: + affinity: '' + alias: '' + ant0: '' + ant1: '' + ant10: '' + ant11: '' + ant12: '' + ant13: '' + ant14: '' + ant15: '' + ant16: '' + ant17: '' + ant18: '' + ant19: '' + ant2: '' + ant20: '' + ant21: '' + ant22: '' + ant23: '' + ant24: '' + ant25: '' + ant26: '' + ant27: '' + ant28: '' + ant29: '' + ant3: '' + ant30: '' + ant31: '' + ant4: '' + ant5: '' + ant6: '' + ant7: '' + ant8: '' + ant9: '' + args: '' + bb_gain0: '20' + bb_gain1: '20' + bb_gain10: '20' + bb_gain11: '20' + bb_gain12: '20' + bb_gain13: '20' + bb_gain14: '20' + bb_gain15: '20' + bb_gain16: '20' + bb_gain17: '20' + bb_gain18: '20' + bb_gain19: '20' + bb_gain2: '20' + bb_gain20: '20' + bb_gain21: '20' + bb_gain22: '20' + bb_gain23: '20' + bb_gain24: '20' + bb_gain25: '20' + bb_gain26: '20' + bb_gain27: '20' + bb_gain28: '20' + bb_gain29: '20' + bb_gain3: '20' + bb_gain30: '20' + bb_gain31: '20' + bb_gain4: '20' + bb_gain5: '20' + bb_gain6: '20' + bb_gain7: '20' + bb_gain8: '20' + bb_gain9: '20' + bw0: '0' + bw1: '0' + bw10: '0' + bw11: '0' + bw12: '0' + bw13: '0' + bw14: '0' + bw15: '0' + bw16: '0' + bw17: '0' + bw18: '0' + bw19: '0' + bw2: '0' + bw20: '0' + bw21: '0' + bw22: '0' + bw23: '0' + bw24: '0' + bw25: '0' + bw26: '0' + bw27: '0' + bw28: '0' + bw29: '0' + bw3: '0' + bw30: '0' + bw31: '0' + bw4: '0' + bw5: '0' + bw6: '0' + bw7: '0' + bw8: '0' + bw9: '0' + clock_source0: '' + clock_source1: '' + clock_source2: '' + clock_source3: '' + clock_source4: '' + clock_source5: '' + clock_source6: '' + clock_source7: '' + comment: '' + corr0: '0' + corr1: '0' + corr10: '0' + corr11: '0' + corr12: '0' + corr13: '0' + corr14: '0' + corr15: '0' + corr16: '0' + corr17: '0' + corr18: '0' + corr19: '0' + corr2: '0' + corr20: '0' + corr21: '0' + corr22: '0' + corr23: '0' + corr24: '0' + corr25: '0' + corr26: '0' + corr27: '0' + corr28: '0' + corr29: '0' + corr3: '0' + corr30: '0' + corr31: '0' + corr4: '0' + corr5: '0' + corr6: '0' + corr7: '0' + corr8: '0' + corr9: '0' + dc_offset_mode0: '0' + dc_offset_mode1: '0' + dc_offset_mode10: '0' + dc_offset_mode11: '0' + dc_offset_mode12: '0' + dc_offset_mode13: '0' + dc_offset_mode14: '0' + dc_offset_mode15: '0' + dc_offset_mode16: '0' + dc_offset_mode17: '0' + dc_offset_mode18: '0' + dc_offset_mode19: '0' + dc_offset_mode2: '0' + dc_offset_mode20: '0' + dc_offset_mode21: '0' + dc_offset_mode22: '0' + dc_offset_mode23: '0' + dc_offset_mode24: '0' + dc_offset_mode25: '0' + dc_offset_mode26: '0' + dc_offset_mode27: '0' + dc_offset_mode28: '0' + dc_offset_mode29: '0' + dc_offset_mode3: '0' + dc_offset_mode30: '0' + dc_offset_mode31: '0' + dc_offset_mode4: '0' + dc_offset_mode5: '0' + dc_offset_mode6: '0' + dc_offset_mode7: '0' + dc_offset_mode8: '0' + dc_offset_mode9: '0' + freq0: capture_freq + freq1: 100e6 + freq10: 100e6 + freq11: 100e6 + freq12: 100e6 + freq13: 100e6 + freq14: 100e6 + freq15: 100e6 + freq16: 100e6 + freq17: 100e6 + freq18: 100e6 + freq19: 100e6 + freq2: 100e6 + freq20: 100e6 + freq21: 100e6 + freq22: 100e6 + freq23: 100e6 + freq24: 100e6 + freq25: 100e6 + freq26: 100e6 + freq27: 100e6 + freq28: 100e6 + freq29: 100e6 + freq3: 100e6 + freq30: 100e6 + freq31: 100e6 + freq4: 100e6 + freq5: 100e6 + freq6: 100e6 + freq7: 100e6 + freq8: 100e6 + freq9: 100e6 + gain0: '10' + gain1: '10' + gain10: '10' + gain11: '10' + gain12: '10' + gain13: '10' + gain14: '10' + gain15: '10' + gain16: '10' + gain17: '10' + gain18: '10' + gain19: '10' + gain2: '10' + gain20: '10' + gain21: '10' + gain22: '10' + gain23: '10' + gain24: '10' + gain25: '10' + gain26: '10' + gain27: '10' + gain28: '10' + gain29: '10' + gain3: '10' + gain30: '10' + gain31: '10' + gain4: '10' + gain5: '10' + gain6: '10' + gain7: '10' + gain8: '10' + gain9: '10' + gain_mode0: 'False' + gain_mode1: 'False' + gain_mode10: 'False' + gain_mode11: 'False' + gain_mode12: 'False' + gain_mode13: 'False' + gain_mode14: 'False' + gain_mode15: 'False' + gain_mode16: 'False' + gain_mode17: 'False' + gain_mode18: 'False' + gain_mode19: 'False' + gain_mode2: 'False' + gain_mode20: 'False' + gain_mode21: 'False' + gain_mode22: 'False' + gain_mode23: 'False' + gain_mode24: 'False' + gain_mode25: 'False' + gain_mode26: 'False' + gain_mode27: 'False' + gain_mode28: 'False' + gain_mode29: 'False' + gain_mode3: 'False' + gain_mode30: 'False' + gain_mode31: 'False' + gain_mode4: 'False' + gain_mode5: 'False' + gain_mode6: 'False' + gain_mode7: 'False' + gain_mode8: 'False' + gain_mode9: 'False' + if_gain0: '20' + if_gain1: '20' + if_gain10: '20' + if_gain11: '20' + if_gain12: '20' + if_gain13: '20' + if_gain14: '20' + if_gain15: '20' + if_gain16: '20' + if_gain17: '20' + if_gain18: '20' + if_gain19: '20' + if_gain2: '20' + if_gain20: '20' + if_gain21: '20' + if_gain22: '20' + if_gain23: '20' + if_gain24: '20' + if_gain25: '20' + if_gain26: '20' + if_gain27: '20' + if_gain28: '20' + if_gain29: '20' + if_gain3: '20' + if_gain30: '20' + if_gain31: '20' + if_gain4: '20' + if_gain5: '20' + if_gain6: '20' + if_gain7: '20' + if_gain8: '20' + if_gain9: '20' + iq_balance_mode0: '0' + iq_balance_mode1: '0' + iq_balance_mode10: '0' + iq_balance_mode11: '0' + iq_balance_mode12: '0' + iq_balance_mode13: '0' + iq_balance_mode14: '0' + iq_balance_mode15: '0' + iq_balance_mode16: '0' + iq_balance_mode17: '0' + iq_balance_mode18: '0' + iq_balance_mode19: '0' + iq_balance_mode2: '0' + iq_balance_mode20: '0' + iq_balance_mode21: '0' + iq_balance_mode22: '0' + iq_balance_mode23: '0' + iq_balance_mode24: '0' + iq_balance_mode25: '0' + iq_balance_mode26: '0' + iq_balance_mode27: '0' + iq_balance_mode28: '0' + iq_balance_mode29: '0' + iq_balance_mode3: '0' + iq_balance_mode30: '0' + iq_balance_mode31: '0' + iq_balance_mode4: '0' + iq_balance_mode5: '0' + iq_balance_mode6: '0' + iq_balance_mode7: '0' + iq_balance_mode8: '0' + iq_balance_mode9: '0' + maxoutbuf: '0' + minoutbuf: '0' + nchan: '1' + num_mboards: '1' + sample_rate: samp_rate + sync: sync + time_source0: '' + time_source1: '' + time_source2: '' + time_source3: '' + time_source4: '' + time_source5: '' + time_source6: '' + time_source7: '' + type: fc32 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [64, 180.0] + rotation: 0 + state: enabled +- name: qtgui_freq_sink_x_0 + id: qtgui_freq_sink_x + parameters: + affinity: '' + alias: '' + alpha1: '1.0' + alpha10: '1.0' + alpha2: '1.0' + alpha3: '1.0' + alpha4: '1.0' + alpha5: '1.0' + alpha6: '1.0' + alpha7: '1.0' + alpha8: '1.0' + alpha9: '1.0' + autoscale: 'False' + average: '1.0' + axislabels: 'True' + bw: samp_rate + color1: '"blue"' + color10: '"dark blue"' + color2: '"red"' + color3: '"green"' + color4: '"black"' + color5: '"cyan"' + color6: '"magenta"' + color7: '"yellow"' + color8: '"dark red"' + color9: '"dark green"' + comment: '' + ctrlpanel: 'False' + fc: capture_freq + fftsize: '1024' + freqhalf: 'True' + grid: 'False' + gui_hint: '' + label: Relative Gain + label1: '' + label10: '''''' + label2: '''''' + label3: '''''' + label4: '''''' + label5: '''''' + label6: '''''' + label7: '''''' + label8: '''''' + label9: '''''' + legend: 'True' + maxoutbuf: '0' + minoutbuf: '0' + name: '""' + nconnections: '1' + showports: 'False' + tr_chan: '0' + tr_level: '0.0' + tr_mode: qtgui.TRIG_MODE_FREE + tr_tag: '""' + type: complex + units: dB + update_time: '0.10' + width1: '1' + width10: '1' + width2: '1' + width3: '1' + width4: '1' + width5: '1' + width6: '1' + width7: '1' + width8: '1' + width9: '1' + wintype: firdes.WIN_BLACKMAN_hARRIS + ymax: '10' + ymin: '-140' + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [392, 384.0] + rotation: 0 + state: true +- name: uhd_usrp_source_0 + id: uhd_usrp_source + parameters: + affinity: '' + alias: '' + ant0: RX2 + ant1: '' + ant10: '' + ant11: '' + ant12: '' + ant13: '' + ant14: '' + ant15: '' + ant16: '' + ant17: '' + ant18: '' + ant19: '' + ant2: '' + ant20: '' + ant21: '' + ant22: '' + ant23: '' + ant24: '' + ant25: '' + ant26: '' + ant27: '' + ant28: '' + ant29: '' + ant3: '' + ant30: '' + ant31: '' + ant4: '' + ant5: '' + ant6: '' + ant7: '' + ant8: '' + ant9: '' + bw0: '0' + bw1: '0' + bw10: '0' + bw11: '0' + bw12: '0' + bw13: '0' + bw14: '0' + bw15: '0' + bw16: '0' + bw17: '0' + bw18: '0' + bw19: '0' + bw2: '0' + bw20: '0' + bw21: '0' + bw22: '0' + bw23: '0' + bw24: '0' + bw25: '0' + bw26: '0' + bw27: '0' + bw28: '0' + bw29: '0' + bw3: '0' + bw30: '0' + bw31: '0' + bw4: '0' + bw5: '0' + bw6: '0' + bw7: '0' + bw8: '0' + bw9: '0' + center_freq0: capture_freq + center_freq1: '0' + center_freq10: '0' + center_freq11: '0' + center_freq12: '0' + center_freq13: '0' + center_freq14: '0' + center_freq15: '0' + center_freq16: '0' + center_freq17: '0' + center_freq18: '0' + center_freq19: '0' + center_freq2: '0' + center_freq20: '0' + center_freq21: '0' + center_freq22: '0' + center_freq23: '0' + center_freq24: '0' + center_freq25: '0' + center_freq26: '0' + center_freq27: '0' + center_freq28: '0' + center_freq29: '0' + center_freq3: '0' + center_freq30: '0' + center_freq31: '0' + center_freq4: '0' + center_freq5: '0' + center_freq6: '0' + center_freq7: '0' + center_freq8: '0' + center_freq9: '0' + clock_rate: '0.0' + clock_source0: '' + clock_source1: '' + clock_source2: '' + clock_source3: '' + clock_source4: '' + clock_source5: '' + clock_source6: '' + clock_source7: '' + comment: '' + dc_offs_enb0: '""' + dc_offs_enb1: '""' + dc_offs_enb10: '""' + dc_offs_enb11: '""' + dc_offs_enb12: '""' + dc_offs_enb13: '""' + dc_offs_enb14: '""' + dc_offs_enb15: '""' + dc_offs_enb16: '""' + dc_offs_enb17: '""' + dc_offs_enb18: '""' + dc_offs_enb19: '""' + dc_offs_enb2: '""' + dc_offs_enb20: '""' + dc_offs_enb21: '""' + dc_offs_enb22: '""' + dc_offs_enb23: '""' + dc_offs_enb24: '""' + dc_offs_enb25: '""' + dc_offs_enb26: '""' + dc_offs_enb27: '""' + dc_offs_enb28: '""' + dc_offs_enb29: '""' + dc_offs_enb3: '""' + dc_offs_enb30: '""' + dc_offs_enb31: '""' + dc_offs_enb4: '""' + dc_offs_enb5: '""' + dc_offs_enb6: '""' + dc_offs_enb7: '""' + dc_offs_enb8: '""' + dc_offs_enb9: '""' + dev_addr: '""' + dev_args: '""' + gain0: '15' + gain1: '0' + gain10: '0' + gain11: '0' + gain12: '0' + gain13: '0' + gain14: '0' + gain15: '0' + gain16: '0' + gain17: '0' + gain18: '0' + gain19: '0' + gain2: '0' + gain20: '0' + gain21: '0' + gain22: '0' + gain23: '0' + gain24: '0' + gain25: '0' + gain26: '0' + gain27: '0' + gain28: '0' + gain29: '0' + gain3: '0' + gain30: '0' + gain31: '0' + gain4: '0' + gain5: '0' + gain6: '0' + gain7: '0' + gain8: '0' + gain9: '0' + iq_imbal_enb0: '""' + iq_imbal_enb1: '""' + iq_imbal_enb10: '""' + iq_imbal_enb11: '""' + iq_imbal_enb12: '""' + iq_imbal_enb13: '""' + iq_imbal_enb14: '""' + iq_imbal_enb15: '""' + iq_imbal_enb16: '""' + iq_imbal_enb17: '""' + iq_imbal_enb18: '""' + iq_imbal_enb19: '""' + iq_imbal_enb2: '""' + iq_imbal_enb20: '""' + iq_imbal_enb21: '""' + iq_imbal_enb22: '""' + iq_imbal_enb23: '""' + iq_imbal_enb24: '""' + iq_imbal_enb25: '""' + iq_imbal_enb26: '""' + iq_imbal_enb27: '""' + iq_imbal_enb28: '""' + iq_imbal_enb29: '""' + iq_imbal_enb3: '""' + iq_imbal_enb30: '""' + iq_imbal_enb31: '""' + iq_imbal_enb4: '""' + iq_imbal_enb5: '""' + iq_imbal_enb6: '""' + iq_imbal_enb7: '""' + iq_imbal_enb8: '""' + iq_imbal_enb9: '""' + lo_export0: 'False' + lo_export1: 'False' + lo_export10: 'False' + lo_export11: 'False' + lo_export12: 'False' + lo_export13: 'False' + lo_export14: 'False' + lo_export15: 'False' + lo_export16: 'False' + lo_export17: 'False' + lo_export18: 'False' + lo_export19: 'False' + lo_export2: 'False' + lo_export20: 'False' + lo_export21: 'False' + lo_export22: 'False' + lo_export23: 'False' + lo_export24: 'False' + lo_export25: 'False' + lo_export26: 'False' + lo_export27: 'False' + lo_export28: 'False' + lo_export29: 'False' + lo_export3: 'False' + lo_export30: 'False' + lo_export31: 'False' + lo_export4: 'False' + lo_export5: 'False' + lo_export6: 'False' + lo_export7: 'False' + lo_export8: 'False' + lo_export9: 'False' + lo_source0: internal + lo_source1: internal + lo_source10: internal + lo_source11: internal + lo_source12: internal + lo_source13: internal + lo_source14: internal + lo_source15: internal + lo_source16: internal + lo_source17: internal + lo_source18: internal + lo_source19: internal + lo_source2: internal + lo_source20: internal + lo_source21: internal + lo_source22: internal + lo_source23: internal + lo_source24: internal + lo_source25: internal + lo_source26: internal + lo_source27: internal + lo_source28: internal + lo_source29: internal + lo_source3: internal + lo_source30: internal + lo_source31: internal + lo_source4: internal + lo_source5: internal + lo_source6: internal + lo_source7: internal + lo_source8: internal + lo_source9: internal + maxoutbuf: '0' + minoutbuf: '0' + nchan: '1' + norm_gain0: 'False' + norm_gain1: 'False' + norm_gain10: 'False' + norm_gain11: 'False' + norm_gain12: 'False' + norm_gain13: 'False' + norm_gain14: 'False' + norm_gain15: 'False' + norm_gain16: 'False' + norm_gain17: 'False' + norm_gain18: 'False' + norm_gain19: 'False' + norm_gain2: 'False' + norm_gain20: 'False' + norm_gain21: 'False' + norm_gain22: 'False' + norm_gain23: 'False' + norm_gain24: 'False' + norm_gain25: 'False' + norm_gain26: 'False' + norm_gain27: 'False' + norm_gain28: 'False' + norm_gain29: 'False' + norm_gain3: 'False' + norm_gain30: 'False' + norm_gain31: 'False' + norm_gain4: 'False' + norm_gain5: 'False' + norm_gain6: 'False' + norm_gain7: 'False' + norm_gain8: 'False' + norm_gain9: 'False' + num_mboards: '1' + otw: '' + rx_agc0: Default + rx_agc1: Default + rx_agc10: Default + rx_agc11: Default + rx_agc12: Default + rx_agc13: Default + rx_agc14: Default + rx_agc15: Default + rx_agc16: Default + rx_agc17: Default + rx_agc18: Default + rx_agc19: Default + rx_agc2: Default + rx_agc20: Default + rx_agc21: Default + rx_agc22: Default + rx_agc23: Default + rx_agc24: Default + rx_agc25: Default + rx_agc26: Default + rx_agc27: Default + rx_agc28: Default + rx_agc29: Default + rx_agc3: Default + rx_agc30: Default + rx_agc31: Default + rx_agc4: Default + rx_agc5: Default + rx_agc6: Default + rx_agc7: Default + rx_agc8: Default + rx_agc9: Default + samp_rate: samp_rate + sd_spec0: '' + sd_spec1: '' + sd_spec2: '' + sd_spec3: '' + sd_spec4: '' + sd_spec5: '' + sd_spec6: '' + sd_spec7: '' + show_lo_controls: 'False' + stream_args: '' + stream_chans: '[]' + sync: sync + time_source0: '' + time_source1: '' + time_source2: '' + time_source3: '' + time_source4: '' + time_source5: '' + time_source6: '' + time_source7: '' + type: fc32 + states: + bus_sink: false + bus_source: false + bus_structure: null + coordinate: [64, 412.0] + rotation: 0 + state: disabled + +connections: +- [lora_lora_receiver_0, frames, lora_message_socket_sink_0, in] +- [osmosdr_source_0, '0', lora_lora_receiver_0, '0'] +- [osmosdr_source_0, '0', qtgui_freq_sink_x_0, '0'] +- [uhd_usrp_source_0, '0', lora_lora_receiver_0, '0'] +- [uhd_usrp_source_0, '0', qtgui_freq_sink_x_0, '0'] + +metadata: + file_format: 1 diff --git a/apps/lora_receive_realtime.py b/apps/lora_receive_realtime.py index 14ebd96..9474bc5 100755 --- a/apps/lora_receive_realtime.py +++ b/apps/lora_receive_realtime.py @@ -1,10 +1,14 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python3 # -*- coding: utf-8 -*- -################################################## + +# +# SPDX-License-Identifier: GPL-3.0 +# # GNU Radio Python Flow Graph # Title: Lora Receive Realtime -# Generated: Mon Jan 8 15:32:44 2018 -################################################## +# GNU Radio version: 3.8.0.0 + +from distutils.version import StrictVersion if __name__ == '__main__': import ctypes @@ -14,37 +18,64 @@ if __name__ == '__main__': x11 = ctypes.cdll.LoadLibrary('libX11.so') x11.XInitThreads() except: - print "Warning: failed to XInitThreads()" + print("Warning: failed to XInitThreads()") -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 PyQt5 import Qt +from gnuradio import qtgui from gnuradio.filter import firdes -from gnuradio.wxgui import fftsink2 -from grc_gnuradio import wxgui as grc_wxgui -from optparse import OptionParser +import sip +from gnuradio import gr +import sys +import signal +from argparse import ArgumentParser +from gnuradio.eng_arg import eng_float, intx +from gnuradio import eng_notation import lora import osmosdr -import wx +import time +from gnuradio import qtgui - -class lora_receive_realtime(grc_wxgui.top_block_gui): +class lora_receive_realtime(gr.top_block, Qt.QWidget): def __init__(self): - grc_wxgui.top_block_gui.__init__(self, title="Lora Receive Realtime") + gr.top_block.__init__(self, "Lora Receive Realtime") + Qt.QWidget.__init__(self) + self.setWindowTitle("Lora Receive Realtime") + qtgui.util.check_set_qss() + try: + self.setWindowIcon(Qt.QIcon.fromTheme('gnuradio-grc')) + except: + pass + self.top_scroll_layout = Qt.QVBoxLayout() + self.setLayout(self.top_scroll_layout) + self.top_scroll = Qt.QScrollArea() + self.top_scroll.setFrameStyle(Qt.QFrame.NoFrame) + self.top_scroll_layout.addWidget(self.top_scroll) + self.top_scroll.setWidgetResizable(True) + self.top_widget = Qt.QWidget() + self.top_scroll.setWidget(self.top_widget) + self.top_layout = Qt.QVBoxLayout(self.top_widget) + self.top_grid_layout = Qt.QGridLayout() + self.top_layout.addLayout(self.top_grid_layout) + + self.settings = Qt.QSettings("GNU Radio", "lora_receive_realtime") + + try: + if StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + self.restoreGeometry(self.settings.value("geometry").toByteArray()) + else: + self.restoreGeometry(self.settings.value("geometry")) + except: + pass ################################################## # Variables ################################################## self.sf = sf = 11 - self.samp_rate = samp_rate = 1e6 self.bw = bw = 125000 self.target_freq = target_freq = 868.1e6 self.symbols_per_sec = symbols_per_sec = float(bw) / (2**sf) - self.firdes_tap = firdes_tap = firdes.low_pass(1, samp_rate, bw, 10000, firdes.WIN_HAMMING, 6.67) - self.downlink = downlink = False + self.samp_rate = samp_rate = 1e6 self.decimation = decimation = 1 self.capture_freq = capture_freq = 868e6 self.bitrate = bitrate = sf * (1 / (2**sf / float(bw))) @@ -52,71 +83,91 @@ class lora_receive_realtime(grc_wxgui.top_block_gui): ################################################## # Blocks ################################################## - self.wxgui_fftsink2_1 = fftsink2.fft_sink_c( - self.GetWin(), - baseband_freq=capture_freq, - 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.qtgui_freq_sink_x_0 = qtgui.freq_sink_c( + 1024, #size + firdes.WIN_BLACKMAN_hARRIS, #wintype + capture_freq, #fc + samp_rate, #bw + "", #name + 1 ) - self.Add(self.wxgui_fftsink2_1.win) - self.osmosdr_source_0 = osmosdr.source( args="numchan=" + str(1) + " " + '' ) + self.qtgui_freq_sink_x_0.set_update_time(0.10) + self.qtgui_freq_sink_x_0.set_y_axis(-140, 10) + self.qtgui_freq_sink_x_0.set_y_label('Relative Gain', 'dB') + self.qtgui_freq_sink_x_0.set_trigger_mode(qtgui.TRIG_MODE_FREE, 0.0, 0, "") + self.qtgui_freq_sink_x_0.enable_autoscale(False) + self.qtgui_freq_sink_x_0.enable_grid(False) + self.qtgui_freq_sink_x_0.set_fft_average(1.0) + self.qtgui_freq_sink_x_0.enable_axis_labels(True) + self.qtgui_freq_sink_x_0.enable_control_panel(False) + + + + labels = ['', '', '', '', '', + '', '', '', '', ''] + widths = [1, 1, 1, 1, 1, + 1, 1, 1, 1, 1] + colors = ["blue", "red", "green", "black", "cyan", + "magenta", "yellow", "dark red", "dark green", "dark blue"] + alphas = [1.0, 1.0, 1.0, 1.0, 1.0, + 1.0, 1.0, 1.0, 1.0, 1.0] + + for i in range(1): + if len(labels[i]) == 0: + self.qtgui_freq_sink_x_0.set_line_label(i, "Data {0}".format(i)) + else: + self.qtgui_freq_sink_x_0.set_line_label(i, labels[i]) + self.qtgui_freq_sink_x_0.set_line_width(i, widths[i]) + self.qtgui_freq_sink_x_0.set_line_color(i, colors[i]) + self.qtgui_freq_sink_x_0.set_line_alpha(i, alphas[i]) + + self._qtgui_freq_sink_x_0_win = sip.wrapinstance(self.qtgui_freq_sink_x_0.pyqwidget(), Qt.QWidget) + self.top_grid_layout.addWidget(self._qtgui_freq_sink_x_0_win) + self.osmosdr_source_0 = osmosdr.source( + args="numchan=" + str(1) + " " + '' + ) + self.osmosdr_source_0.set_time_unknown_pps(osmosdr.time_spec_t()) self.osmosdr_source_0.set_sample_rate(samp_rate) self.osmosdr_source_0.set_center_freq(capture_freq, 0) self.osmosdr_source_0.set_freq_corr(0, 0) - self.osmosdr_source_0.set_dc_offset_mode(0, 0) - self.osmosdr_source_0.set_iq_balance_mode(0, 0) - self.osmosdr_source_0.set_gain_mode(False, 0) self.osmosdr_source_0.set_gain(10, 0) self.osmosdr_source_0.set_if_gain(20, 0) self.osmosdr_source_0.set_bb_gain(20, 0) self.osmosdr_source_0.set_antenna('', 0) self.osmosdr_source_0.set_bandwidth(0, 0) - self.lora_message_socket_sink_0 = lora.message_socket_sink('127.0.0.1', 40868, 0) - self.lora_lora_receiver_0 = lora.lora_receiver(1e6, capture_freq, ([target_freq]), bw, sf, False, 4, True, False, downlink, decimation, False, False) + self.lora_lora_receiver_0 = lora.lora_receiver(1e6, capture_freq, [target_freq], bw, sf, False, 4, True, False, False, decimation, False, False) + + ################################################## # Connections ################################################## self.msg_connect((self.lora_lora_receiver_0, 'frames'), (self.lora_message_socket_sink_0, 'in')) self.connect((self.osmosdr_source_0, 0), (self.lora_lora_receiver_0, 0)) - self.connect((self.osmosdr_source_0, 0), (self.wxgui_fftsink2_1, 0)) + self.connect((self.osmosdr_source_0, 0), (self.qtgui_freq_sink_x_0, 0)) + + def closeEvent(self, event): + self.settings = Qt.QSettings("GNU Radio", "lora_receive_realtime") + self.settings.setValue("geometry", self.saveGeometry()) + event.accept() def get_sf(self): return self.sf def set_sf(self, sf): self.sf = sf + self.set_bitrate(self.sf * (1 / (2**self.sf / float(self.bw)))) self.set_symbols_per_sec(float(self.bw) / (2**self.sf)) self.lora_lora_receiver_0.set_sf(self.sf) - self.set_bitrate(self.sf * (1 / (2**self.sf / float(self.bw)))) - - def get_samp_rate(self): - return self.samp_rate - - def set_samp_rate(self, samp_rate): - self.samp_rate = samp_rate - self.wxgui_fftsink2_1.set_sample_rate(self.samp_rate) - self.osmosdr_source_0.set_sample_rate(self.samp_rate) - self.set_firdes_tap(firdes.low_pass(1, self.samp_rate, self.bw, 10000, firdes.WIN_HAMMING, 6.67)) def get_bw(self): return self.bw def set_bw(self, bw): self.bw = bw - self.set_symbols_per_sec(float(self.bw) / (2**self.sf)) - self.set_firdes_tap(firdes.low_pass(1, self.samp_rate, self.bw, 10000, firdes.WIN_HAMMING, 6.67)) self.set_bitrate(self.sf * (1 / (2**self.sf / float(self.bw)))) + self.set_symbols_per_sec(float(self.bw) / (2**self.sf)) def get_target_freq(self): return self.target_freq @@ -130,17 +181,13 @@ class lora_receive_realtime(grc_wxgui.top_block_gui): def set_symbols_per_sec(self, symbols_per_sec): self.symbols_per_sec = symbols_per_sec - def get_firdes_tap(self): - return self.firdes_tap + def get_samp_rate(self): + return self.samp_rate - def set_firdes_tap(self, firdes_tap): - self.firdes_tap = firdes_tap - - def get_downlink(self): - return self.downlink - - def set_downlink(self, downlink): - self.downlink = downlink + def set_samp_rate(self, samp_rate): + self.samp_rate = samp_rate + self.osmosdr_source_0.set_sample_rate(self.samp_rate) + self.qtgui_freq_sink_x_0.set_frequency_range(self.capture_freq, self.samp_rate) def get_decimation(self): return self.decimation @@ -153,8 +200,9 @@ class lora_receive_realtime(grc_wxgui.top_block_gui): def set_capture_freq(self, capture_freq): self.capture_freq = capture_freq - self.wxgui_fftsink2_1.set_baseband_freq(self.capture_freq) + self.lora_lora_receiver_0.set_center_freq(self.capture_freq) self.osmosdr_source_0.set_center_freq(self.capture_freq, 0) + self.qtgui_freq_sink_x_0.set_frequency_range(self.capture_freq, self.samp_rate) def get_bitrate(self): return self.bitrate @@ -163,11 +211,33 @@ class lora_receive_realtime(grc_wxgui.top_block_gui): self.bitrate = bitrate + def main(top_block_cls=lora_receive_realtime, options=None): + if StrictVersion("4.5.0") <= StrictVersion(Qt.qVersion()) < StrictVersion("5.0.0"): + style = gr.prefs().get_string('qtgui', 'style', 'raster') + Qt.QApplication.setGraphicsSystem(style) + qapp = Qt.QApplication(sys.argv) + tb = top_block_cls() - tb.Start(True) - tb.Wait() + tb.start() + tb.show() + + def sig_handler(sig=None, frame=None): + Qt.QApplication.quit() + + signal.signal(signal.SIGINT, sig_handler) + signal.signal(signal.SIGTERM, sig_handler) + + timer = Qt.QTimer() + timer.start(500) + timer.timeout.connect(lambda: None) + + def quitting(): + tb.stop() + tb.wait() + qapp.aboutToQuit.connect(quitting) + qapp.exec_() if __name__ == '__main__': diff --git a/cmake/Modules/targetConfig.cmake.in b/cmake/Modules/targetConfig.cmake.in new file mode 100644 index 0000000..79e4a28 --- /dev/null +++ b/cmake/Modules/targetConfig.cmake.in @@ -0,0 +1,26 @@ +# Copyright 2018 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. + +include(CMakeFindDependencyMacro) + +set(target_deps "@TARGET_DEPENDENCIES@") +foreach(dep IN LISTS target_deps) + find_dependency(${dep}) +endforeach() +include("${CMAKE_CURRENT_LIST_DIR}/@TARGET@Targets.cmake") diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt index ddaa840..9d3f5bf 100644 --- a/grc/CMakeLists.txt +++ b/grc/CMakeLists.txt @@ -18,14 +18,15 @@ # Boston, MA 02110-1301, USA. install(FILES - lora_receiver.xml - lora_message_file_sink.xml - lora_message_socket_sink.xml - lora_message_socket_source.xml DESTINATION share/gnuradio/grc/blocks + lora_controller.block.yml + lora_receiver.block.yml + lora_message_file_sink.block.yml + lora_message_socket_sink.block.yml + lora_message_socket_source.block.yml DESTINATION share/gnuradio/grc/blocks ) if(HAS_MONGODB) install(FILES - lora_message_mongodb_sink.xml DESTINATION share/gnuradio/grc/blocks + lora_message_mongodb_sink.block.yml DESTINATION share/gnuradio/grc/blocks ) endif(HAS_MONGODB) diff --git a/grc/lora_controller.block.yml b/grc/lora_controller.block.yml new file mode 100644 index 0000000..286ca20 --- /dev/null +++ b/grc/lora_controller.block.yml @@ -0,0 +1,11 @@ +# auto-generated by grc.converter + +id: lora_controller +label: Controller +category: '[LoRa]' + +templates: + imports: import lora + make: lora.controller(${parent}) + +file_format: 1 diff --git a/grc/lora_controller.xml b/grc/lora_controller.xml deleted file mode 100644 index a766097..0000000 --- a/grc/lora_controller.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - controller - lora_controller - - import lora - lora.controller($parent) - - diff --git a/grc/lora_message_file_sink.block.yml b/grc/lora_message_file_sink.block.yml new file mode 100644 index 0000000..94cd1b7 --- /dev/null +++ b/grc/lora_message_file_sink.block.yml @@ -0,0 +1,20 @@ +# auto-generated by grc.converter + +id: lora_message_file_sink +label: Message File Sink +category: '[LoRa]' + +parameters: +- id: path + label: Path + dtype: file_open + +inputs: +- domain: message + id: in + +templates: + imports: import lora + make: lora.message_file_sink(${path}) + +file_format: 1 diff --git a/grc/lora_message_file_sink.xml b/grc/lora_message_file_sink.xml deleted file mode 100644 index 88a03f9..0000000 --- a/grc/lora_message_file_sink.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - Message File Sink - lora_message_file_sink - [LoRa] - import lora - lora.message_file_sink($path) - - - Path - path - string - - - - in - message - - diff --git a/grc/lora_message_mongodb_sink.block.yml b/grc/lora_message_mongodb_sink.block.yml new file mode 100644 index 0000000..8064720 --- /dev/null +++ b/grc/lora_message_mongodb_sink.block.yml @@ -0,0 +1,36 @@ +# auto-generated by grc.converter + +id: lora_message_mongodb_sink +label: Message MongoDB Sink +category: '[LoRa]' + +parameters: +- id: ip + label: IP Address + dtype: string + default: 127.0.0.1 +- id: port + label: Port + dtype: int + default: 27017 +- id: db + label: Database + dtype: string + default: lora +- id: collection + label: Collection + dtype: string + default: chirps +- id: tag + label: Tag + dtype: string + +inputs: +- domain: message + id: in + +templates: + imports: import lora + make: lora.message_mongodb_sink(${ip}, ${port}, ${db}, ${collection}, ${tag}) + +file_format: 1 diff --git a/grc/lora_message_mongodb_sink.xml b/grc/lora_message_mongodb_sink.xml deleted file mode 100644 index e3b4d3c..0000000 --- a/grc/lora_message_mongodb_sink.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - Message MongoDB Sink - lora_message_mongodb_sink - [LoRa] - import lora - lora.message_mongodb_sink($ip, $port, $db, $collection, $tag) - - - IP Address - ip - 127.0.0.1 - string - - - - Port - port - 27017 - int - - - - Database - db - lora - string - - - - Collection - collection - chirps - string - - - - Tag - tag - string - - - - in - message - - diff --git a/grc/lora_message_socket_sink.block.yml b/grc/lora_message_socket_sink.block.yml new file mode 100644 index 0000000..c2f1db2 --- /dev/null +++ b/grc/lora_message_socket_sink.block.yml @@ -0,0 +1,30 @@ +# auto-generated by grc.converter + +id: lora_message_socket_sink +label: Message Socket Sink +category: '[LoRa]' + +parameters: +- id: ip + label: IP + dtype: string + default: 127.0.0.1 +- id: port + label: Port + dtype: int + default: 40868 +- id: layer + label: Layer + dtype: enum + options: ['0', '1', '2'] + option_labels: [LoRa TAP, LoRa PHY, LoRa MAC] + +inputs: +- domain: message + id: in + +templates: + imports: import lora + make: lora.message_socket_sink(${ip}, ${port}, ${layer}) + +file_format: 1 diff --git a/grc/lora_message_socket_sink.xml b/grc/lora_message_socket_sink.xml deleted file mode 100644 index aac63fb..0000000 --- a/grc/lora_message_socket_sink.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - Message Socket Sink - lora_message_socket_sink - [LoRa] - import lora - lora.message_socket_sink($ip, $port, $layer) - - - IP - ip - 127.0.0.1 - string - - - - Port - port - 40868 - int - - - - Layer - layer - enum - - - - - - - in - message - - diff --git a/grc/lora_message_socket_source.block.yml b/grc/lora_message_socket_source.block.yml new file mode 100644 index 0000000..60cec75 --- /dev/null +++ b/grc/lora_message_socket_source.block.yml @@ -0,0 +1,25 @@ +# auto-generated by grc.converter + +id: lora_message_socket_source +label: Message Socket Source +category: '[LoRa]' + +parameters: +- id: addr + label: UDP IP Address + dtype: string + default: 127.0.0.1 +- id: port + label: UDP Port + dtype: int + default: 40868 + +outputs: +- domain: message + id: out + +templates: + imports: import lora + make: lora.message_socket_source(${addr}, ${port}) + +file_format: 1 diff --git a/grc/lora_message_socket_source.xml b/grc/lora_message_socket_source.xml deleted file mode 100644 index c35732f..0000000 --- a/grc/lora_message_socket_source.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - Message Socket Source - lora_message_socket_source - [LoRa] - import lora - lora.message_socket_source($addr, $port) - - - UDP IP Address - addr - "127.0.0.1" - string - - - - UDP Port - port - 40868 - int - - - - out - message - - - diff --git a/grc/lora_receiver.block.yml b/grc/lora_receiver.block.yml new file mode 100644 index 0000000..d73e034 --- /dev/null +++ b/grc/lora_receiver.block.yml @@ -0,0 +1,87 @@ +# auto-generated by grc.converter + +id: lora_lora_receiver +label: LoRa Receiver +category: '[LoRa]' + +parameters: +- id: samp_rate + label: Sample rate + dtype: float + default: 1e6 +- id: center_freq + label: Center frequency + dtype: float + default: 868e6 +- id: channel_list + label: Channel list + dtype: float_vector + default: [868.1e6] + hide: ${ 'all' if disable_channelization else 'none' } +- id: bandwidth + label: Bandwidth + dtype: int + default: 125000 +- id: sf + label: Spreading factor + dtype: int + default: 7 +- id: implicit + label: Implicit header + dtype: bool + default: False +- id: cr + label: Coding rate + dtype: enum + options: [4, 3, 2, 1] + option_labels: [4/8, 4/7, 4/6, 4/5] + hide: ${ 'none' if implicit else 'all' } +- id: crc + label: CRC + dtype: bool + default: True + hide: ${ 'none' if implicit else 'all' } +- id: reduced_rate + label: Reduced rate + dtype: bool + default: False +- id: conj + label: Conjugate downlink signal + dtype: bool + default: False + hide: part +- id: decimation + label: Decimation + dtype: int + default: 1 + hide: part +- id: disable_channelization + label: Disable channelization + dtype: bool + default: False + hide: part +- id: disable_drift_correction + label: Disable drift correction + dtype: bool + default: False + hide: part + +inputs: +- domain: stream + dtype: complex + +outputs: +- domain: message + id: frames + optional: true + +templates: + imports: import lora + make: lora.lora_receiver(${samp_rate}, ${center_freq}, ${channel_list}, ${bandwidth}, + ${sf}, ${implicit}, ${cr}, ${crc}, ${reduced_rate}, ${conj}, ${decimation}, + ${disable_channelization}, ${disable_drift_correction}) + callbacks: + - set_center_freq(${center_freq}) + - set_sf(${sf}) + +file_format: 1 diff --git a/grc/lora_receiver.xml b/grc/lora_receiver.xml deleted file mode 100644 index 6402fbf..0000000 --- a/grc/lora_receiver.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - LoRa Receiver - lora_lora_receiver - [LoRa] - import lora - lora.lora_receiver($samp_rate, $center_freq, $channel_list, $bandwidth, $sf, $implicit, $cr, $crc, $reduced_rate, $conj, $decimation, $disable_channelization, $disable_drift_correction) - - set_center_freq($freq) - set_sf($sf) - - - Sample rate - samp_rate - 1e6 - float - - - - Center frequency - center_freq - 868e6 - float - - - - Channel list - channel_list - [868.1e6] - float_vector - $disable_channelization.hide_channels - - - - Bandwidth - bandwidth - 125000 - int - - - - Spreading factor - sf - int - - - - Implicit header - implicit - enum - - - - - - Coding rate - cr - enum - $implicit.hide_imp - - - - - - - - CRC - crc - enum - $implicit.hide_imp - - - - - - Reduced rate - reduced_rate - enum - - - - - - Conjugate downlink signal - conj - False - bool - part - - - - Decimation - decimation - 1 - int - part - - - - Disable channelization - disable_channelization - enum - part - - - - - - Disable drift correction - disable_drift_correction - False - bool - part - - - - in - complex - - - - frames - message - 1 - -