Flex data via API (or not!)

  • 1
  • Question
  • Updated 3 years ago
Hello Flex Programmers,

Finally I've found some time to start to play with the ethernet API.  For many reasons I'm not directly using the FlexLib.  I can and may to learn some of this stuff but right now I'm poking around using C++.

So far I can discover and connect to the radio no problem.  Once connected similar to the FlexLib API I can subscribe to slices etc.  All going reasonably well.

My question is simple.  The Wiki states:

  1. The SmartSDR Command API which is used to command the radio and receive streaming status information from the radio. The command API uses TCP/IP port 4992.
  2. Streaming data is sent from the radio in the VITA-49 format from UDP/IP port 4991 to targeted clients. This data carries:
    1. FFT data used in panadapters and waterfall displays
    2. Metering protocol which provides meter data on the radio itself as well as receivers and such
    3. Oscilloscope data used to draw audio vs. time data
    4. Streaming I/Q data for demodulation by other computer software
  3. Discovery protocol which announces the radio's presence on the local network for facilitating client connections sent to UDP port 4992

So as I test I connect to the radio using TCP port 4992.  I also at the same time during that connection setup a handler for UDP port 4991 as specified above to receive streaming data.

My problem is nothing ever shows up over that UDP port.  IE if I do "sub meters all" I get the command response with a bunch of data on each meter but I get no output from the meters over the UDP port.

Clearly I'm missing something simple so I'm hoping I'm just not following some required step.

If no one has a suggestion then I will try to do the same thing using the FlexLib API and see if I can discover where I went wrong.

Thanks in advance - Mark
Photo of Mark - WS7M

Mark - WS7M

  • 1026 Posts
  • 364 Reply Likes

Posted 3 years ago

  • 1
Photo of Stu Phillips - K6TU

Stu Phillips - K6TU, Elmer

  • 642 Posts
  • 256 Reply Likes
Close inspection of FlexLib or using WireShark to observe the setup process between SmartSDR and the client will help you answer these questions as you go forward.

You have to tell the radio on which UDP port your client wants to receive the information.  This is done with the command:
client udpport X
Where X is the number of the port on which you want to receive.

This is necessary because a single client computer may be running multiple effective clients - for example, SmartSDR, CAT and DAX - all have to receive VITA-49 encoded data which includes the meters etc.

Note that if you are not using FlexLib, you will need to provide you own encode/decode support for the VITA-49 headers and payloads including byte-swapping of data where appropriate.

Stu K6TU
Photo of Mark - WS7M

Mark - WS7M

  • 1026 Posts
  • 364 Reply Likes
Hi Stu,

Thanks for that info.  I will get Wireshark fired up. 

So it appears the Wiki documentation is not totally correct.  It clearly seems to say monitor UDP port 4991. 

I do see your point about multiple clients and wondered if the UDP data was somehow stamped.

I do understand about the Vita headers.  I am prepared to do so.

Thanks again!

Mark
Photo of Stu Phillips - K6TU

Stu Phillips - K6TU, Elmer

  • 642 Posts
  • 256 Reply Likes
Mark,

You still have to tell the radio which port to initiate streaming VITA-49 encoded data to your client. That port can be 4991 but I believe you still have to use the client udpport command.

Inbound VITA-49 encoded data TO the radio is sent on UDP port 4991 - the stream id in the VITA-49 header allows the radio to determine where to direct the payload.

On receive, you use the packet Class Code to determine the type of the payload and then for types that contain streaming data (like the FFT, DAX or Opus payloads), you extract the stream id to determine the destination of the packet.

Although its in Objective C rather than C++, you can find the interface library that I use for the iOS clients I have written (and is also used by a couple of OS X apps as well) on github at:

https://github.com/K6TU/smartsdr-objective-c

This together with the FlexLib source code (which you probably already have and is available from the FlexRadio web site under Downloads) should help answer most questions to get you going.

Elsewhere on the Community you can find a detailed post I made explaining how the pan adaptor and waterfall streams are intended to be processed.

Let me know if you have any questions - happy to help as I can.  You can find my direct email in the usual places.

73
Stu K6TU
Photo of Robbie - KI4TTZ

Robbie - KI4TTZ

  • 480 Posts
  • 77 Reply Likes
Also, feel free to play around with the Powershell implementation, although it is built on FlexLib only, and not the ethernet api.  Right now it doesn't do anything with the streaming data.  It's mostly a way to tweak the radio settings via command line while SmartSDR is running.

https://github.com/rfoust/FlexModule

-Robbie
Photo of Mark - WS7M

Mark - WS7M

  • 1026 Posts
  • 364 Reply Likes
Hi Stu,

Thank you.  All great advice for someone just starting out with this API.  

I do want you to know that I have supported both your fine iPad product as well as dog park SDR because I believe in doing so even if I intend to play with some things of my own.

Mark
Photo of Stu Phillips - K6TU

Stu Phillips - K6TU, Elmer

  • 642 Posts
  • 256 Reply Likes
Thank you!  Don and I appreciate the support from you and everyone!
Stu K6TU