feat: complementer scripts for tx and rx

This commit is contained in:
2025-12-03 22:45:08 +01:00
parent 3144612d0e
commit 74be0095a3
2 changed files with 86 additions and 0 deletions

41
onbeat_rx_wrapper.py Normal file
View File

@@ -0,0 +1,41 @@
#!/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]]] = []
packet_loss = 0
while message := await reader.read(PACKET_LEN):
try:
received = framing.decode_packet([i for i in message])
output.append(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") as packetfile:
json.dump(received, packetfile)