Compare commits

...

6 Commits

5 changed files with 326 additions and 56 deletions

View File

@@ -37,7 +37,7 @@ blocks:
id: variable
parameters:
comment: ''
value: '10'
value: '100'
states:
bus_sink: false
bus_source: false
@@ -75,7 +75,28 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [192, 92.0]
coordinate: [192, 96.0]
rotation: 0
state: true
- name: rx_gain
id: variable_qtgui_range
parameters:
comment: ''
gui_hint: ''
label: RX gain
min_len: '200'
orient: QtCore.Qt.Horizontal
rangeType: float
start: '0'
step: '0.1'
stop: '49.6'
value: '20'
widget: counter_slider
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [160, 256.0]
rotation: 0
state: true
- name: samp_rate
@@ -102,59 +123,28 @@ blocks:
coordinate: [712, 12.0]
rotation: 0
state: enabled
- name: ONBEAT_Demod_0
- name: ONBEAT_Demod_1
id: ONBEAT_Demod
parameters:
FULL_PACKET_LEN: '4096'
OVERSAMPLING: '10'
RRC_ALPHA: '0.35'
FULL_PACKET_LEN: 8*(4*255+2*16)
OVERSAMPLING: OVERSAMPLING
RRC_ALPHA: RRC_ALPHA
affinity: ''
alias: ''
comment: ''
maxoutbuf: '0'
minoutbuf: '0'
roc_tolerance: '1'
samp_rate: 1e6
symbol_map: '[0, 1, 3, 2]'
syncword: '"0000011100001001000110110010110101110111100110001010100111111010"'
roc_tolerance: '0.8'
samp_rate: samp_rate
symbol_map: symbol_map
syncword: syncword
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [720, 404.0]
coordinate: [728, 412.0]
rotation: 0
state: true
- name: iio_pluto_source_0
id: iio_pluto_source
parameters:
affinity: ''
alias: ''
bandwidth: '20000000'
bbdc: 'True'
buffer_size: '32768'
comment: ''
filter: ''
filter_source: '''Auto'''
fpass: '0'
frequency: lo_freq * 1000000
fstop: '0'
gain1: '''slow_attack'''
len_tag_key: packet_len
manual_gain1: '64'
maxoutbuf: '0'
minoutbuf: '0'
quadrature: 'True'
rfdc: 'True'
samplerate: int(samp_rate)
type: fc32
uri: ''
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [344, 380.0]
rotation: 0
state: true
state: enabled
- name: network_socket_pdu_1
id: network_socket_pdu
parameters:
@@ -363,6 +353,87 @@ blocks:
coordinate: [1104, 380.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: lo_freq*10e6
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'
norm_window: 'False'
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: window.WIN_BLACKMAN_hARRIS
ymax: '10'
ymin: '-140'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [776, 224.0]
rotation: 0
state: enabled
- name: qtgui_time_sink_x_0
id: qtgui_time_sink_x
parameters:
@@ -635,7 +706,7 @@ blocks:
dc_offset_mode7: '0'
dc_offset_mode8: '0'
dc_offset_mode9: '0'
freq0: lo_freq*1000000
freq0: lo_freq * 1e6
freq1: 100e6
freq10: 100e6
freq11: 100e6
@@ -667,7 +738,7 @@ blocks:
freq7: 100e6
freq8: 100e6
freq9: 100e6
gain0: '10'
gain0: rx_gain
gain1: '10'
gain10: '10'
gain11: '10'
@@ -799,7 +870,7 @@ blocks:
minoutbuf: '0'
nchan: '1'
num_mboards: '1'
sample_rate: samp_rate
sample_rate: samp_rate * OVERSAMPLING
sync: sync
time_source0: ''
time_source1: ''
@@ -814,7 +885,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [344, 172.0]
coordinate: [256, 332.0]
rotation: 0
state: disabled
- name: rx_port
@@ -834,6 +905,30 @@ blocks:
coordinate: [408, 92.0]
rotation: 0
state: enabled
- name: soapy_rtlsdr_source_0
id: soapy_rtlsdr_source
parameters:
affinity: ''
agc: 'False'
alias: ''
bias: 'False'
bufflen: '16384'
center_freq: lo_freq*1e6
comment: ''
dev_args: ''
freq_correction: '0'
gain: rx_gain
maxoutbuf: '0'
minoutbuf: '0'
samp_rate: samp_rate
type: fc32
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [320, 232.0]
rotation: 0
state: enabled
- name: syncword
id: parameter
parameters:
@@ -853,11 +948,15 @@ blocks:
state: enabled
connections:
- [ONBEAT_Demod_0, '0', qtgui_const_sink_x_0, '0']
- [ONBEAT_Demod_0, '1', qtgui_eye_sink_x_0, '0']
- [ONBEAT_Demod_0, '2', qtgui_time_sink_x_0, '0']
- [ONBEAT_Demod_0, out, network_socket_pdu_1, pdus]
- [iio_pluto_source_0, '0', ONBEAT_Demod_0, '0']
- [ONBEAT_Demod_1, '0', qtgui_const_sink_x_0, '0']
- [ONBEAT_Demod_1, '1', qtgui_eye_sink_x_0, '0']
- [ONBEAT_Demod_1, '2', qtgui_time_sink_x_0, '0']
- [ONBEAT_Demod_1, out, network_socket_pdu_1, pdus]
- [rtlsdr_source_0, '0', ONBEAT_Demod_1, '0']
- [rtlsdr_source_0, '0', qtgui_freq_sink_x_0, '0']
- [soapy_rtlsdr_source_0, '0', ONBEAT_Demod_1, '0']
- [soapy_rtlsdr_source_0, '0', qtgui_freq_sink_x_0, '0']
metadata:
file_format: 1
grc_version: 3.10.11.0

43
onbeat_rx_wrapper.py Normal file
View File

@@ -0,0 +1,43 @@
#!/usr/bin/env python
import asyncio
import framing
from header import Onbeat_Header
import json
PACKET_LEN=255*4 + 32
DATA_LEN=223*4
HEADER_LEN=32
async def tcp_client():
port = 50002
reader, _ = await asyncio.open_connection(
'127.0.0.1', port)
# output: list[tuple[Onbeat_Header, list[int]]] = []
output: list[list[int]] = []
packet_loss = 0
while message := await reader.read(PACKET_LEN):
try:
received = framing.decode_packet([i for i in message])
output.append([i for i in message])
print("pkt received")
if received[0].pkt_len == 0:
break
except KeyboardInterrupt:
break
except Exception as e:
packet_loss += 1
print(e)
return output
rs_coding = False
filename = "loremipsum"
received = asyncio.run(tcp_client())
with open("rx_packets.json", mode="w") as packetfile:
json.dump(received, packetfile)

View File

@@ -37,7 +37,7 @@ blocks:
id: variable
parameters:
comment: ''
value: '10'
value: '100'
states:
bus_sink: false
bus_source: false
@@ -110,7 +110,7 @@ blocks:
affinity: ''
alias: ''
comment: ''
data_len: ''
data_len: '1'
maxoutbuf: '0'
minoutbuf: '0'
preamble: '[0x33 for i in range(0, 128*2, 8)]'
@@ -127,7 +127,7 @@ blocks:
parameters:
affinity: ''
alias: ''
attenuation1: '10.0'
attenuation1: '5.0'
bandwidth: '20000000'
buffer_size: '32768'
comment: ''
@@ -145,7 +145,7 @@ blocks:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1176, 156.0]
coordinate: [1168, 148.0]
rotation: 0
state: true
- name: network_socket_pdu_1
@@ -185,6 +185,87 @@ blocks:
coordinate: [608, 208.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: lo_freq * 1e6
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'
norm_window: 'False'
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: window.WIN_BLACKMAN_hARRIS
ymax: '10'
ymin: '-140'
states:
bus_sink: false
bus_source: false
bus_structure: null
coordinate: [1176, 340.0]
rotation: 0
state: true
- name: syncword
id: parameter
parameters:
@@ -222,6 +303,7 @@ blocks:
connections:
- [ONBEAT_Mod_0, '0', iio_pluto_sink_0, '0']
- [ONBEAT_Mod_0, '0', qtgui_freq_sink_x_0, '0']
- [network_socket_pdu_1, pdus, pdu_pdu_to_tagged_stream_0, pdus]
- [pdu_pdu_to_tagged_stream_0, '0', ONBEAT_Mod_0, '0']

46
onbeat_tx_wrapper.py Normal file
View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python
import asyncio
from time import sleep
import framing
# from header import Onbeat_Header
import json
PACKET_LEN=255*4 + 32
DATA_LEN=223*4
HEADER_LEN=32
async def tcp_client(file_2_send: str, callsign: str, rs_coding: bool = True):
port = 50001
_, writer = await asyncio.open_connection(
'127.0.0.1', port)
with open(file_2_send, "rb") as file_to_send:
seq = 0
sent: list[list[int]] = []
try:
while message := file_to_send.read(DATA_LEN if rs_coding == True else (PACKET_LEN - HEADER_LEN)):
sent.append([i for i in message])
frame = bytes(framing.encode_packet([i for i in message], callsign, seq%256, rs_coding))
writer.write(frame)
seq += 1
print(seq)
sleep(0.01)
else:
frame = bytes(framing.encode_packet([], callsign, seq%256, rs_coding))
for _ in range(0,4):
writer.write(frame)
sleep(0.01)
sent.append([])
except KeyboardInterrupt:
return sent
rs_coding = True
filename = "/home/lacko/live_output/2025-11-01_12-39_elektro_lrit_1.691 GHz/IMAGES/ELEKTRO-L3/2025-11-01_12-30-00/msu_gs_Color IR Merge.png"
sent = asyncio.run(tcp_client(filename, "HA5PLS", rs_coding))
with open("packets.json", mode="w") as packetfile:
json.dump(sent, packetfile)