Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remote configurable output port #202

Closed
wants to merge 1 commit into from

Conversation

nunojpg
Copy link

@nunojpg nunojpg commented Sep 30, 2022

Hey! Not so small pull request here.

The idea is to add one more output mode but in a way that does no increase complexity.

So I added this dynamic port (default 30006), that when you connect gives you a hello JSON with the variant and version of dump1090, and then you send a string to select the stream you want, for example "s\n" for SBS.

The previous switchable mechanism of COOKED vs VERBATIM didn't allow to know safely which stream we were actually getting because there was no ACK and the default depended on dump1090 general config, which we might not control.

And this is to get a reliable way to obtain a verbatim stream, but also without any eventual remote results. We called it BEAST_ANTENNA.

I'm sure this can be improved and I wait for your comments.

@mutability
Copy link

mutability commented Oct 1, 2022 via email

@nunojpg
Copy link
Author

nunojpg commented Oct 1, 2022

Hi Oliver, I am only interested in Beast verbatim without remote data, ideally with a hello string to give you the version of the decoder.

AVR and SBS are there just to make it seem complete, but I have no use case for it.

This remote configuration logic is only to try to fit this in a scalable way. We can from this point add more data formats ("profiles") without depending on command line options.

A obvious future addition is IQ samples output, so that you can chain several demodulators on a single SDR. I would also be open to dump1090 just publishing the samples into a shm or fifo, while we have to see it that does not bring problems with custom kernels.

Let me know what requirements you have in mind and we can find a common solution.

@mutability
Copy link

For IQ we're probably better off implementing rtl_tcp (or SoapySDRRemote et al) support, since dump1090 is more naturally a consumer of that data, not a producer.

@mutability
Copy link

A possible counter-proposal (in the absence of a whole new protocol, which is too much to bite off right now)

  • Add a new beast-protocol option l/L:
    <1A> 1 l - disable local-only option; forward remote messages normally (the default setting)
    <1A> 1 L - enable local-only option: only send messages that originated locally

  • Add a new beast-protocol command, S:
    <1A> 2 S - request current connection status/metadata

Currently all beast-protocol commands are option-related and start with <1A> 1; the status request is a little different so maybe putting it in a different namespace like this helps? I'll need to check that existing beast-splitter and dump1090 don't choke on such a command, but from a quick look I think it's OK.

When (new) dump1090 hears a 'S' command it emits a status message, something like this perhaps:

<1A> S [NUL-terminated structured string that we can argue about the contents of]

where the string would contain something like: receiver name, receiver version, list of current option states:

<1A> S dump1090-fa;8.0~dev;CdfgijkVL <NUL>

(it could be json if you really wanted, but it's maybe too big an ask to expect clients to include a json parser)

Then you can do your thing by sending:

<1A> 1 V
<1A> 1 L
<1A> 2 S

and if/when you hear a <1A> S response you can verify what settings actually got set.

I think I can make this work with beast-splitter too without a ton of effort (here "local" means "came from a local serial device"). It already knows about verbatim mode.

Initially it might be simpler to have dump1090 implicitly turn on V if L is requested (much like your current implementation, where you can't request local-only corrected messages) but I'd request both because of beast-splitter and maybe future versions that don't combine the two.

(paging @wiedehopf for a readsb opinion)

@nunojpg
Copy link
Author

nunojpg commented Oct 4, 2022

Thanks. Not sure if you remember that you keep individual net_writer for the several times types of messages, for blocking of messages (by size and time). So my decoupling of net_service and net_writer was trying to achieve the option to dynamically instantiate a net_writer for a specific config.

For example, currently you have beast verbatim and cooked. If you can configure for remote on/off then now we have 4 net_writers for the 4 combinations.

So I think it's reasonable to either only add any configuration that we think is reasonable (like no remote), or to try to evolve this for a generic implementation that allows for arbitrary streams.

Also, I mentioned IQ samples directly out of dump1090 because I don't want to increase the complexity of the hosts. A microservice architecture (by adding rtl_tcp on top of everything else) handled by hosts is unfortunately very fragile, unlike for our automatically configured systems. So if dump1090 is there, and we can easily piggyback on it, it seems more robust.

@mutability
Copy link

Yeah, the network layer is pretty horrible and has needed a rewrite for years now -- switching to something more conventional where each connection has independent state is the way to go I think -- eventually.

How about we split this up into a few things:

  1. adding the l/L option (if you're OK with that approach), implicitly also turning on verbatim, using the existing net_writer approach. We're mid-release-prep right now but this is straightforward enough that I can try to get it into this release.

  2. adding the metadata-reporting thing. This is larger and will probably need to wait. I think we can probably squeeze it into the existing infrastructure with a little work though (directly write the response when the request comes in, rather than passing it through the net_writer buffer)

  3. reworking all the network code to handle connections with independent state

@nunojpg
Copy link
Author

nunojpg commented Oct 5, 2022

  1. adding the l/L option (if you're OK with that approach), implicitly also turning on verbatim, using the existing net_writer approach. We're mid-release-prep right now but this is straightforward enough that I can try to get it into this release.

So we continue with 2 streams only for Beast: cooked and verbatim.
On receiving a Local command we switch that connection to verbatim and;
Stop sending remote data to all clients on verbatim stream.

This?

@mutability
Copy link

No, I mean adding a 3rd stream type that is local+verbatim

mutability added a commit that referenced this pull request Oct 6, 2022
…enerated messages.

As an implementation detail, whenever 'L' is enabled, 'V' (verbatim) is also implicitly enabled.
(Clients should not rely on this as it will probably change in the future -- they should
request both local and verbatim mode if they do want both)

See #202 for background.
@nunojpg nunojpg closed this Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants