Welcome to the new FlexRadio Community! Please review the new Community Rules and other important new Community information on the Message Board.
If you are having a problem, please refer to the product documentation or check the Help Center for known solutions.
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.

Flex data via API (or not!)

Mark_WS7M
Mark_WS7M Member ✭✭✭
edited May 2020 in SmartSDR API
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

Answers

  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited May 2020
    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
  • Mark_WS7M
    Mark_WS7M Member ✭✭✭
    edited December 2015
    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
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited May 2020
    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
  • Mark_WS7M
    Mark_WS7M Member ✭✭✭
    edited May 2020
    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
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited August 2016
    Thank you!  Don and I appreciate the support from you and everyone!
    Stu K6TU

  • rfoust
    rfoust Member ✭✭
    edited December 2016
    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


Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.