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.

If You Haven't Tried the API Yet...

24

Comments

  • Peter K1PGV
    Peter K1PGV Member ✭✭✭
    edited December 2016
    My interest in this learning project will be to see if I can program an interface/translator for my Hercules DJ Console to control the 6500.  It will require reading the MIDI signals generated by the DJ Console, translating them into API commands and sending them to the 6500.  
    That's a fairly ambitious project, especially if you don't already understand how MIDI works.  Good luck in your quest!

    C# .Net doesn't have a native MIDI class available, but there are a few available -- there's even one on CodeProject (ugh...) that's been regularly revised and gets good reviews.
    
    You'll certainly learn a lot getting this to work, AND you'll get an awesome sense of accomplishment.

    de Peter K1PGV
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited August 2016
    Ken,

    If you don't mind C#, then FlexLib is the way to go with this and is pretty straight forward.  FlexLib and the underlying Ethernet API let you fully control the radio.

    If you aren't into C#, then you have more work to do as you will have to provide an equivalent for FlexLib in whatever language/platform you want.

    Although some of the bozos on this community (no present addressee included in this comment BTW) think that just because a pC and a Mac both use the Intel processor that software can be trivially ported over... we know the issues.

    Writing a FlexLib alternative isn't hard - its a lot of code which basically maps to message handling to the radio - but it isn't hard.  It's just work!

    If you want to write the Hercules control software in something other than C#, let me know and I will be very happy to talk you through what you need to do - and how much of it you need to deal with the Hercules.

    Stu K6TU
  • Vern
    Vern Member
    edited November 2014
    Stu:  Is it possible to acquire the ip address of my FLEX-6500 radio BEFORE connecting to the network. Network might not be the word. I find each day or so the FLEX-6500 is assigned a different ip number.

    Vern
  • KY6LA_Howard
    KY6LA_Howard Member ✭✭✭
    edited May 2020
    Vern

    You can have your router issue a fixed IP to the 6500

    All you need is the MAC Address - which is usually discoverable in the Device List inside your router
  • Vern
    Vern Member
    edited November 2014
    Stu: I should have said "to do it programmatically"! 
    Vern
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited August 2016
    Few off the shelf consumer routers/APs allow assignment of a static IP address.  For those that do, this is a great solution.

    Stu K6TU
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited August 2016
    Short answer unless you have a piece of gear that allows static IP address assignment to  MAC address is no.

    Hoeever, the radio broadcasts its existence in two different frame formats on UDP port 4991 on the IP broadcast address.

    This is the way to discover radios on your local LAN segment.  Email me if you want more information on this.

    Stu K6TU
  • Tim - W4TME
    Tim - W4TME Administrator, FlexRadio Employee admin
    edited December 2016
    Or increase your DHCP lease times on the DHCP server (router).  It sounds like they are really low if you are getting different IPs.  There is nothing wrong with setting it to 14 days or more.
  • Vern
    Vern Member
    edited November 2014
    Will act on that later, TU.

    Have noted some of the command instructions, shown in the following list http: // wiki.flexradio.com / index.php? Title=SmartSDR_TCP / IP_API, are incomplete or just to difficult for me to understand. I hope it is the later.

    Vern
  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited August 2016
    The wiki is incomplete.  The real way to understand the API at present is to read the FlexLib code or use Wireshark and watch the interactions between the radio and SmartSDR.

    I'm slowly documenting pieces as I go along but it was an after thought on my part to start this...

    Stu K6TU
  • Ken - NM9P
    Ken - NM9P Member ✭✭✭
    edited June 2020
    BTW... Another post announced that MS has released VIrtual Studio Community 2013 for FREE for hobbyist, education and non-enterprise users.  It was a 11 GB download, but now I am beginning to work my way through the recommended book "Beginning Visual C# 2010."  

    So far, after the first two exercises, I am convinced that this is not going to be too much over my head... just enough to challenge and stretch me!

    It is going to be fun.  I haven't learned a new programming language since the 90's!  (If you don't count trying to learn various Distros of Linux.)

    Thanks, guys, for the encouragement.

    Ken - NM9P
  • Paul Burton
    Paul Burton Member ✭✭
    edited May 2015
    If anyone is interested, I have written a small Windows Forms application in Microsoft Visual Studio Express called "Flexit", which uses flexlib.  It connects to the radio and displays the radio information plus the current frequency and mode for the active slice.  It was written as an exercise to get familiar with C#, the development environment, and Flexlib, and I can offer the source and executable as an aid for anyone who is trying to come onboard with this stuff.  It works, but it's just a start.

    I don't know how to post the files somewhere which is accesable, so I'll just offer to mail it to anyone who is interested.  You can shoot me an email at paul@aa6z.com.
  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited July 2015
    Hi   got a dumb question ....     For Slice it have option for "Create" ,"Remove" ,"Tune" ,"List" ,"Set"
    but how i actually Read a Slice info for read VFO frequency ???     and opn all above exemple it seem to remove slice then add new one on a knot frequency , but on my side i need to poll radio VFO and read it ..

    also a exemple of how discover radio IP may usefull ...

    i try to use the Telnet commnad in a Raspberry-Pi for read VFO and Then switch external RF relay trough it GPIO  for route signal the right Transverter 

  • Stu Phillips - K6TU
    Stu Phillips - K6TU Member ✭✭
    edited May 2020
    Marc,

    You need to use "sub slice all" in order to get status updates about all slices.  Here's an example:
    c1|sub slice all  R1|0|    M10000001|Client connected from IP 10.1.1.40    S88FB390B|radio slices=7 panadapters=7 lineout_gain=60 lineout_mute=1 headphone_gain=50 headphone_mute=0 remote_on_enabled=1 pll_done=0 freq_error_ppb=0 cal_freq=15.000 tnf_enabled=1 snap_tune_enabled=1 nickname=K6TU-007 callsign=K6TU    S88FB390B|interlock timeout=0 acc_txreq_enable=0 rca_txreq_enable=1 acc_txreq_polarity=0 rca_txreq_polarity=0 tx1_enabled=1 tx1_delay=0 tx2_enabled=1 tx2_delay=0 tx3_enabled=1 tx3_delay=0 acc_tx_enabled=1 acc_tx_delay=0 tx_delay=0    S88FB390B|slice 0 in_use=1 RF_frequency=14.130000 rit_on=0 rit_freq=0 xit_on=0 xit_freq=0 rxant=ANT1 mode=FM wide=0 filter_lo=-8000 filter_hi=8000 step=100 step_list=50,250,500,2500,3000,5000,10000 agc_mode=off agc_threshold=60 agc_off_level=10 pan=0x40000000 txant=ANT1 loopa=0 loopb=0 qsk=0 dax=0 dax_clients=0 lock=0 tx=1 dax_tx=0 active=1 audio_gain=37 audio_pan=50 audio_mute=0 record=0 play=disabled record_time=0.0 anf=0 anf_level=0 nr=0 nr_level=0 nb=0 nb_level=50 apf=0 apf_level=0 squelch=1 squelch_level=20 diversity=0 diversity_parent=0 diversity_child=0 diversity_index=1342177293 ant_list=ANT1,ANT2,RX_A,RX_B,XVTR mode_list=USB,LSB,AM,CW,DIGU,DIGL,SAM,FM,NFM,DFM fm_tone_mode=OFF fm_tone_value=250.3 fm_repeater_offset_freq=0.020000 tx_offset_freq=0.000000 repeater_offset_dir=SIMPLEX
    I have inserted line breaks to make it (a little!) easier to read.

    The S88FB390B token at the beginning of the line is S for Status and then the ID handle for this client.  You will need to parse these messages to extract  the information you need.

    Radio discovery is done via a UDP Broadcast on port 4992.  There are two formats of discovery packets supported in release 1.3 - the original format and a new VITA-49 encoded packet.  Only the VITA-49 format is supported from release 1.4 forwards.

    If you search here on the community, you will find a message from Steve Hicks that includes the format of the VITA-49 discovery packet.  The payload of that packet is in ASCII format and easily extracted without knowledge of the VITA-49 header if you don't need to support that for other reasons.

    You should be easily able to do what you describe using PHP, Ruby, Python etc to open two sockets - one for the UDP broadcasts to discover the radio and then the second to create a TCP socket to the radio API command stream.

    Hope this helps!
    Stu K6TU


  • Marc Lalonde
    Marc Lalonde Member ✭✭
    edited July 2015
    Hi   ho that really great no need to pool and it use Xverter frequency   RF_frequency=1296.098400

    that telnet feature was  really amazing ;-)  ,so tat turn my raspberry-pi into band decoder  
      
    73! all and have great new year
  • Vern
    Vern Member
    edited January 2015
    Is Microsoft FREE C# Visual Studio Express 2013 capable of generating code to view VITA-49 packets & use FlexLib?

    Vern
  • James Whiteway
    edited January 2015
    Visual Studio 2013 Community Edition (free download.......but large at 11Gb) is the PRO version of Visual Studio and it will work just fine. If you can code in C# then you can use it to write code referencing Flexlib. There are no limits that I know of that would keep you from using it to write code in C# that can view and work with VITA-49 packets. Flexlib is written in C# and as far as I know, developers at Flex are using Visual Studio for development of SmartSDR.
    james
    WD5GWY

  • Vern
    Vern Member
    edited January 2015
    James, I am cheap!  I have downloaded  the 'FREE' version of C# Visual Studio Express 2013. Are there limitations using the version I have, in your opinion? From my reading there ARE limitations.

    Vern


  • James Whiteway
    edited January 2015
    No, no limitations that I'm aware of, other than some test tools missing and limited use for large companies and commercial development. Visual Studio 2013 Community Edition is free too. And it has all development languages in it. And there are add on's (free) for developing app's for Apple and Android devices. The next version will be even better (2015) and should have the add on's included. All free , just a large download. James WD5GWY
  • Vern
    Vern Member
    edited January 2015
    James,

    Would you communicate with me off the NET here ?

    Vern
  • James Whiteway
    edited January 2015
    I would be happy to Vern. Currently, I am out on the road (I drive a truck) in Arkansas. I will be heading to Arizona tomorrow. I will be home this weekend. My email address on qrz.com is correct. james WD5GWY
  • Vern
    Vern Member
    edited January 2015
    OK, I give up - kinda.

    I  am  trying my hand at C#. I have some source code that compiles just fine. When I RUN it it has an issue with binding. Does anyone have a snippet/tip of code that will allow me to monitor the UDP VITA-49 packets on port 4992? Been to a lot of forums without success. TCP info is OK.
  • Mark Erbaugh
    Mark Erbaugh Member ✭✭
    edited June 2020
    I was able to send commands and receive data from my FlexRadio 6300 using Python and the telnet lib module which is part of the standard install.  This was with both Python version 2.7.9 and 3.4.2, though most of my work will be with Python 2.7.9 as I am more familiar with that version.

    The reason I mention Python is that it has a very good interactive component. You can type a command and see the results.  While, you can do the same thing with a simple TELNET terminal program, such as PuTTY, but Python also allows you to create functions to automate things, and you can call these functions directly from the command line. For example, you could write (and I will be writing) a function to encode the various radio commands so that I can just call a function like freq(14200000) to set the frequency to 14.200 MHz.  You can also write functions to decode the response so you don't have to parse it manually. All in all, this makes it easy to experiment with API features. Once you develop a library of functions, you can build those functions into a working program. Or you can use Python as a super scripting language.

    Python is free to download and install. Check out www.python.org.
  • James Whiteway
    edited January 2015
    If you are a C# programmer you won't need to build a library. It's already done for you in Flexlib. while the comments in the source code are still a bit unclear to me, it appears you can do almost anything using Flexlib.(controlling the radio etc.) For other languages like Python, then you are right. I wonder how hard it would be to develop for the Flex in Mono Develop for Linux? James
  • Vern
    Vern Member
    edited January 2015
    At  the risk of being a bigger nuisance ------ talking C#, how do I reference a method in the Flex.Smoothlake.Vita  VitaSocket.cs file? Or any other .cs file?
  • Peter K1PGV
    Peter K1PGV Member ✭✭✭
    edited December 2016

    >I wonder how hard it would be to develop for the Flex in Mono Develop for Linux?

    Well, Mono supports C#... so it *should* support Flexlib without any changes (or, at least, without MANY changes).

    > how do I reference a method in the Flex.Smoothlake.Vita

    You can add a reference to either the whole FlexLib project (so you can trace through the source code from your own application), or to the library that FlexLib produces.

    See http://msdn.microsoft.com/en-us/library/wkze6zky.aspx 

    Don't forget to add the appropriate "using" statement in your code module.

    Peter K1PGV

  • Vern
    Vern Member
    edited January 2015
    Are you saying the 'VITA' folder can be added in one full swoop or is it each .cs file, one at a time? I tried to add the folder VITA but it failed,

    I don't know which .cs file in the first in line to use to set up for 'receive data' packet(s). I suspect that is why FLEX wants the developers to find out for them selves. Don 't know for sure?  I still need to find the proper way to call a method in a .cs file

    Vern 
  • N7BCP
    N7BCP Member ✭✭
    edited November 2016
    I created an empty solution in visual studio 2013. Added each of the flexlib source projects to it. Built it. Created a new Project (pick your project type, mine was a WPF project). Added project references to flexlib projects. Add using statements to your cs file, and start calling the flexlib methods. Once you've discovered the radio in code you can create a slice, add a DAX channel, create an an audio stream, subscribe to the data ready events, and get the audio data. I'll post my code this evening.
  • Vern
    Vern Member
    edited January 2015
    Peter, my pride may be getting in the way! 

    Using Solution Explorer, I 'right' click on Solution VITA-a (1 project), my project title. Window pops up and I choose 'Add'. Window pops up and I choose 'Existing Items...'. I work my way to the FLEXLib & choose the 'VITA' folder, open same and select 'VitaSocket.cs'. Highlight it and click 'Add' & it appears in the Solutions Explorer under the Solutions Items grout(?). Is it now ready for action?.

    I have had all the .cs VITA files in the Solutions Items group(?) before but I could not see that I was doing anything positive with them. i.e, I could not call a PUBLIC method from anyone of the .cs files. So again, how do I call a 'method' from a  .cs file?

    Cut me off when you feel i am being ridiculous....

    Vern
  • Peter K1PGV
    Peter K1PGV Member ✭✭✭
    edited December 2016

    Vern: The easiest way is to add the PROJECT not the FILES to your existing SOLUTION.

    The put a USING statement for the namespace in your own CS file.

    I'm not home, so I don't have FlexLib in front of me to be able to give you the precise steps.

    Or, include reference to the FlexLib DLL... and (again) put the appropriate USING statement in your CS file.

    Then just call the function.

    Mr. de Ponte has generous offered to provide his existing project, so you can see how things hang together. You probably won't want to use his specific project directly, though... given he's using WPF.  Or, I don't know... maybe you do.

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.