sam210723 / goesrecv-monitor

Status monitor for goesrecv demodulator and decoder.
https://vksdr.com/goesrecv-monitor
MIT License
31 stars 8 forks source link

Parse goesrecv symbols to remove stray nanomsg headers #9

Open JVital2013 opened 2 years ago

JVital2013 commented 2 years ago

First off, I want to say a big THANK YOU for writing this program! Its code helped me understand how nanomsg works "on the wire", and I've written a number of goesrecv-related programs thanks to it. So, I wanted to give back.

In goesrecv-monitor v1.3, Symbols.cs is treating the nanomsg TCP stream as a stream of raw symbols. Unfortunately, nanomsg isn't quite that simple. It has 64-bit unsigned integer "headers" throughout the data stream that announce how many bytes are coming next. See section 3 at https://github.com/nanomsg/nanomsg/blob/master/rfc/sp-tcp-mapping-01.txt for more info.

To fix the problem, this PR reads the 64-bit integer (8 bytes), then only draws as many bytes as nanomsg announced is coming. Afterwards, it reads the next 8 bytes as another header (since it must be), and repeats the process.

Admittedly, the constellation diagram does not look that much different on my system, but if others reference your project like I did, this code is a more accurate starting point.

The code for this is essentially copied and pasted from my own goesbetween project - it's much more necessary to strip out the nanomsg headers when you're pulling the baseband iq samples!

sam210723 commented 2 years ago

Hi Jamie, good find! I probably should have read the nanomsg spec more carefully when implementing this. I am quite busy at the moment but I will come back to this PR soon and test it out.

Thanks, Sam.