projecthorus / horus-gui

Project Horus Telemetry Decoder
GNU General Public License v3.0
33 stars 8 forks source link

Telemetry forwarding #25

Closed fred-corp closed 1 year ago

fred-corp commented 1 year ago

I the the "Telemetry Forwarding" option in the "Other" tab of Horus-gui, but I can't find a way to retrieve the data (I've made a UDP listener in python that listens to 127.0.0.1:55672, put I'm not receiving anything...).

Is there a way to locally retrieve the live data in order to use it in another script for example ?

darksidelemm commented 1 year ago

That should be it!

It's possible horus-gui has decided to send to IPv6 localhost instead of IPv4 localhost?

fred-corp commented 1 year ago

I don't think so.. I've tried again with IPv6 and it doesn't seem to work.
As a sanity check I've listened to port 7355 (where the audio data is streamed) and share enough I'm getting the data with my code.

These are the codes I've tried (which both show the audio data stream on port 7355 as a test) :

import socket, select
s1 = socket.socket(socket.AF_INET6, socket.SOCK_DGRAM)
s1.bind(('0.0.0.0', 55672)) # ('0.0.0.0', 55672) for IPv4, ('::1', 55672) for IPv6
s2 = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_UDP)
s2.bind(('0.0.0.0', 55672)) # ('0.0.0.0', 55672) for IPv4, ('::1', 55672) for IPv6
while True:
  r, w, x = select.select([s1, s2], [], [])
  for i in r:
    print(i, i.recvfrom(131072))
IP = ""            # Blank for IPv4, "::1" for IPv6
Port = 55672

ServerSock = socket(AF_INET, SOCK_DGRAM) # UDP, use AF_INET6 for IPv6
ServerSock.bind((IP, Port))
print("Socket is ready to receive data..")

while True:
  data, addr = ServerSock.recvfrom(1024) # buffer size is 1024 bytes
  print(data)

Do you perhaps have a working test code for this ?

darksidelemm commented 1 year ago

Yep, this class: https://github.com/projecthorus/chasemapper/blob/master/chasemapper/listeners.py#L62

darksidelemm commented 1 year ago

... which looks pretty similar to what you're doing anyway.

You could also check with netcat - e.g. something like: nc -lu 55672

Also, the code doing the sending is here: https://github.com/projecthorus/horusdemodlib/blob/master/horusdemodlib/horusudp.py#L70

fred-corp commented 1 year ago

Oops found the issue; it was in front of my eyes the whole time, d'oh !

Because of my indoor testing, my RS41 doesn't have a GPS fix, so Lat/Lon values are 0, and Horus-gui gives me the reason it's not sending :

[ERROR]  Horus UDP - Zero Latitude/Longitude, not sending.

I've now put my RS41 outside, and would't you know it, data is being sent !
This is the output of my code (the 2nd) :

b'{"type": "PAYLOAD_SUMMARY", "callsign": "ON3PFD", "latitude": 50.84xxxxxxxxxxxxx, "longitude": 4. 35xxxxxxxxxxxxx, "altitude": 87, "speed": 1, "heading": -1, "time": "22:18:25", "comment": "HorusDemodLib", "temp": -1, "sats": 6, "batt_voltage": 2.8627450980392157, "snr": 3.2}'

Sorry for wasting your time !

Possible feature : maybe adding a debug checkbox to the Horus-gui which enables sending the data to a local UDP connection for development ?

fred-corp commented 1 year ago

Oh also, the telemetry forwarding doesn't seem to forward the custom payload data, is that a normal behaviour ?

darksidelemm commented 1 year ago

That is definitely a bug. Looking at the sender code, it's only copying in a few fields: https://github.com/projecthorus/horusdemodlib/blob/master/horusdemodlib/horusudp.py#L23

Shouldn't be hard to fix, It would be re-using the block of code from here: https://github.com/projecthorus/horusdemodlib/blob/master/horusdemodlib/sondehubamateur.py#L217

darksidelemm commented 1 year ago

I've opened an issue here: https://github.com/projecthorus/horusdemodlib/issues/95

fred-corp commented 1 year ago

Amazing, thanks for the great work !

darksidelemm commented 1 year ago

I haven't fixed it yet ;-) Probably won't get to it until the weekend.

darksidelemm commented 1 year ago

This is fixed in v0.3.9 :-)