diff options
Diffstat (limited to '')
-rw-r--r-- | src/gr-fadingui/grc/fadingui_dearpygui_sink.block.yml | 2 | ||||
-rw-r--r-- | src/gr-fadingui/python/dearpygui_sink.py | 15 | ||||
-rw-r--r-- | tests/fadingui/QAM/qam_nogui.grc | 2 | ||||
-rwxr-xr-x | tests/fadingui/QAM/qam_nogui.py | 6 |
4 files changed, 20 insertions, 5 deletions
diff --git a/src/gr-fadingui/grc/fadingui_dearpygui_sink.block.yml b/src/gr-fadingui/grc/fadingui_dearpygui_sink.block.yml index 3712be4..dbe6198 100644 --- a/src/gr-fadingui/grc/fadingui_dearpygui_sink.block.yml +++ b/src/gr-fadingui/grc/fadingui_dearpygui_sink.block.yml @@ -4,7 +4,7 @@ category: '[fadingui]' templates: imports: import fadingui - make: fadingui.dearpygui_sink() + make: fadingui.dearpygui_sink(sock_addr=${sock_addr}, ui_element_id=${ui_element_id}) # Make one 'parameters' list entry for every parameter you want settable from the GUI. # Keys include: diff --git a/src/gr-fadingui/python/dearpygui_sink.py b/src/gr-fadingui/python/dearpygui_sink.py index 2b8e9fb..353f2d9 100644 --- a/src/gr-fadingui/python/dearpygui_sink.py +++ b/src/gr-fadingui/python/dearpygui_sink.py @@ -19,6 +19,8 @@ # Boston, MA 02110-1301, USA. # +import socket +from urllib.parse import urlparse import numpy as np from gnuradio import gr @@ -27,15 +29,24 @@ class dearpygui_sink(gr.sync_block): """ docstring for block dearpygui_sink """ - def __init__(self): + def __init__(self, sock_addr, ui_element_id): gr.sync_block.__init__(self, name="dearpygui_sink", in_sig=[np.complex64], out_sig=None) + # sockets + self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) + self.srv = urlparse(sock_addr) + + def send(self, value): + data = bytes(repr(value), "ascii") + sent = self.socket.sendto(data, (self.srv.hostname, self.srv.port)) + + return len(data) == sent def work(self, input_items, output_items): in0 = input_items[0] - # <+signal processing here+> + self.send(in0) return len(input_items[0]) diff --git a/tests/fadingui/QAM/qam_nogui.grc b/tests/fadingui/QAM/qam_nogui.grc index be2f20a..bb7bf08 100644 --- a/tests/fadingui/QAM/qam_nogui.grc +++ b/tests/fadingui/QAM/qam_nogui.grc @@ -480,6 +480,8 @@ blocks: affinity: '' alias: '' comment: '' + sock_addr: udp://localhost:31415 + ui_element_id: '0' states: bus_sink: false bus_source: false diff --git a/tests/fadingui/QAM/qam_nogui.py b/tests/fadingui/QAM/qam_nogui.py index 0a3fe02..e9aa15b 100755 --- a/tests/fadingui/QAM/qam_nogui.py +++ b/tests/fadingui/QAM/qam_nogui.py @@ -52,8 +52,9 @@ class qam_nogui(gr.top_block): ################################################## # Blocks ################################################## + self.fadingui_dearpygui_sink_0 = fadingui.dearpygui_sink(sock_addr='udp://localhost:31415', ui_element_id=0) self.fadingui_datasource_0 = fadingui.datasource(vec_len=2037, header_len=11, sock_addr='udp://', file_list=["./lena512color.tiff"]) - self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps * 1.001, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, sps) + self.digital_pfb_clock_sync_xxx_0 = digital.pfb_clock_sync_ccf(sps, timing_loop_bw, rrc_taps, nfilts, nfilts/2, 1.5, 1) self.digital_map_bb_0 = digital.map_bb([0, 1, 3, 2]) self.digital_diff_decoder_bb_0 = digital.diff_decoder_bb(4) self.digital_costas_loop_cc_0 = digital.costas_loop_cc(phase_bw, 4, False) @@ -66,7 +67,7 @@ class qam_nogui(gr.top_block): verbose=False, log=False) self.digital_constellation_decoder_cb_0 = digital.constellation_decoder_cb(const) - self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, sps) + self.digital_cma_equalizer_cc_0 = digital.cma_equalizer_cc(eq_ntaps, eq_mod, eq_gain, 1) self.channels_channel_model_0 = channels.channel_model( noise_voltage=noise_volt, frequency_offset=freq_offset, @@ -90,6 +91,7 @@ class qam_nogui(gr.top_block): self.connect((self.digital_constellation_decoder_cb_0, 0), (self.digital_diff_decoder_bb_0, 0)) self.connect((self.digital_constellation_modulator_0, 0), (self.blocks_throttle_0, 0)) self.connect((self.digital_costas_loop_cc_0, 0), (self.digital_constellation_decoder_cb_0, 0)) + self.connect((self.digital_costas_loop_cc_0, 0), (self.fadingui_dearpygui_sink_0, 0)) self.connect((self.digital_diff_decoder_bb_0, 0), (self.digital_map_bb_0, 0)) self.connect((self.digital_map_bb_0, 0), (self.blocks_null_sink_0, 0)) self.connect((self.digital_pfb_clock_sync_xxx_0, 0), (self.digital_cma_equalizer_cc_0, 0)) |