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.

How do I specify to connect to a particular radio on my Network?

Options
yeldarbn5lzy
yeldarbn5lzy Member, Unconfirmed
Hello,

I have two Flex 6400s on my LAN. SmartSDR works well with both of these radios.
I'm developing a unique program using C# to assist me in POTA contacts.
The two radios are as follows: #1 6400 for HF only. #2 6400 for VHF via a Transverter.
These are dedicated to these two specific uses.

I want the custom software to Always connect to the HF 6400. The radios are both on and both registered on the LAN within the SmartSDR connection interface so I can select either or Both
to operate.

Issue:

When both radios are on the Custom C# program I'm creating can not determine which radio is the HF 6400. So it crashes.

What I desire is a Radio selector method so I can choose the desired radio. So far the Flex API it seems to query and locates both radios and thus it confuses the Software.

How can I correct this? I'm kinda stuck with this.


Note: If I shut down the VHF Flex 6400 the Software works as I designed it to using the HF flex 6400. So I just need a method to select a single radio.


Many thanks.

Regards,

Brad - N5LZY

Answers

  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Hi Brad, I am away skiing tomorrow, but when I get home I will give you some ideas for connecting by serial number instead of first found rig.

  • David Decoons, wo2x
    David Decoons, wo2x Member, Super Elmer Moderator
    Options

    The discover broadcast packets sent out from the radios contain s/n and IP. Use that to listen for the radio you want (s/n) then connect to that IP.

    Dave wo2x

  • yeldarbn5lzy
    yeldarbn5lzy Member, Unconfirmed
    Options
    KD0RC,

    Examples would be great. The APIs are difficult to navigate as there is not really a clear users manual
    of the functions and there usage. I have been digging thru them but again, with out examples it's hard to
    figure out clear usages.
    I'd appreciate your help. As I'm very close to having the program working as I desire. But since I have multiple Flex radios it does get confused and fails if both radios are powered on.

    Thank you.

    Regards,
    Brad - N5LZY
    Cell phone: 6822566969
  • Alan
    Alan Member ✭✭✭✭
    Options

    Brad

    Flex is looking for the Non-GUI Client (your application) to send it a bind command. The bind command uses the radio ID. This will be unique for each of your two Flex Radios.

    As Dave, WO2X, said, use the discovery packet, plain text UDP on port 4992 to get the radio's connection information, including its Nick Name and IP Address.

    When a ratio starts up, it sends out a status message. Point your app to the Flex IP (from the discovery packet) to get this message. Included in the status message is the radio's nickname and ID. Use the nickname to correlate to the discovery packet. You now have all the variables necessary to build a "bind" command.

    Alan. WA9WUD

  • Trucker
    Trucker Member ✭✭✭
    Options

    How are you connecting to just a single radio? You can look at the Flexlib wiki for documentation.

    If you are automatically connecting ( to a single radio) you will need to change your code to watch for all broadcasts from more than one radio on your network. You should be able to call up a list of radios on your network. Then, select from the list the radio, including ID and IP address that you want to connect to. Look up the author of FRStack on Github. He has some code listed there for using SmartLink. It has a section for enumerating local network radios as well as others over the internet. You may be able to find what you need in his code. You will have to modify it to work with your setup.

    I have not ever tried to create a radio chooser as I have only had one 6000 Series radio in the shack at any given time.

    James

    WD5GWY

  • Alan
    Alan Member ✭✭✭✭
    Options

    Brad

    From the Flex WiKi, https://github.com/flexradio/smartsdr-api-docs/wiki,

    The "Primer from G3WGV is a little dated, but it will explain everything you need to know.

    Alan. WA9WUD


  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Hi Brad, you mention C# in your original post. Are you using FlexLib (.net) or just straight C# without the Flex .net library?

    I am (once again...) locked out of my own Visual Studio on my own computer due to the MIcrosoft login garbage. I will try to sort that out so that I can share what I have done with C# and FlexLib.

  • Trucker
    Trucker Member ✭✭✭
    Options

    Hi Len, I would be interested in seeing how you are enumerating radios on the Network. I have a general idea how to go about it. But, no way to test since I only have the 6600M. I can easily find it on my network and retrieve the Serial number, model, IP address, user name etc. But,I have not tried to create a radio chooser like SmartSDR uses.

    Seeing an example of this would be great.

    James

    WD5GWY

  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Hi James, I also have never built a chooser. Rather than enumerate, what I have done in another project is provide a serial number on an SD card. This makes it easy to dedicate a piece of gear to a specific radio, Like Brad is doing.

    In the other project, I use one Teensy board per radio to run antenna disconnectors and band pass filters for a club station. Here is a link to the Github for that.


    I have thought about this a lot as well, but until someone donates a Flex 6000 series to me, I won't have two radios to experiment and develop with...

  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Hi Brad,

    Here is a link to a C# ,net demo program that uses FlexLib. I did this as an exercise to learn C# and to understand FlexLib. I don't pretend that this is great code, but it does work.

    I use the Visual Studio 2019 IDE.

    The comments with the "**" in them are my comments about grabbing multiple radios.

    private void API_RadioAdded(Radio radio)
        {
          _thisRadio = radio;  // ** This could be an array, grabbing each radio that it finds.
                               //    You would need a radio counter to set the index of the array.
    
          SerNum = radio.Serial;  // ** Also could be an array.  
                                  //    It would use the same radio counter (above) as the index.
    
          // The properties, such as Nickname and Callsign, can't be read
          // successfully until you've received a PropertyChanged event
          // for that property... this is done after connect.
          //
          //radio.PropertyChanged += radio_PropertyChanged;
          radio.PropertyChanged += new PropertyChangedEventHandler(radio_PropertyChanged);
          radio.SliceAdded += new Radio.SliceAddedEventHandler(radio_SliceAdded);
          radio.SliceRemoved += new Radio.SliceRemovedEventHandler(radio_SliceRemoved);
          radio.PanadapterAdded += new Radio.PanadapterAddedEventHandler(radio_PanAdded);
          radio.SlicePanReferenceChange += new Radio.SlicePanReferenceChangeEventHandler(radio_PanRefChg);
          radio.VoltsDataReady += new Radio.MeterDataReadyEventHandler(_thisRadio_VoltsDataReady);
          radio.PATempDataReady += new Radio.MeterDataReadyEventHandler(_thisRadio_PATempDataReady);
          radio.GUIClientAdded += new Radio.GUIClientAddedEventHandler(_thisRadio_GUIClientAdded);
          radio.GUIClientUpdated += new Radio.GUIClientUpdatedEventHandler(_thisRadio_GUIClientUpdated);
          radio.GUIClientRemoved += new Radio.GUIClientRemovedEventHandler(_thisRadio_GUIClientRemoved);
          radio.MessageReceived += new Radio.MessageReceivedEventHandler(_thisRadio_MessageReceived);
    
          radio.Connect();  // ** Add conditional logic here to only connect to the desired radio 
                            //    based on radio.Serial or radio.IP.  Could also have a chooser screen here.
    
          form1.txtDebug.Text += "Status: " + radio.Status + NL;
          form1.txtDebug.Text += _thisRadio.GuiClientHosts + NL;
    
          ParseConfig();
        }
    

    I hope that this helps. As I have never actually had two Flex 6000 series radios in the same place at the same time, I have never actually enumerated multiple rigs, but I think this is a step in the right direction.

    If you are not using FlexLib, I have some C++ examples that I think would translate to C# pretty easily.

    Be sure to post back with any progress you make and/or help that you need.

  • yeldarbn5lzy
    yeldarbn5lzy Member, Unconfirmed
    Options
    Hello Len,

    Please explain how to connect to a single radio if the are multiple Flex Radios on the LAN.

    Your Code:
    radio.Connect(); // ** Add conditional logic here to only connect to the desired radio
    // based on radio.Serial or radio.IP. Could also have a chooser screen here.

    How would I specify an individual radio?

    Regards,

    Brad - N5LZY
  • KD0RC
    KD0RC Member, Super Elmer Moderator
    Options

    Hi Brad, if there are multiple radios on the LAN, I think each one will cause an API_RadioAdded event. If you don't check for the desired serial number or IP address before doing the radio.Connect(), it will connect to the first radio it finds, then will attempt to connect to the next one it finds. I don't know what happens, but I doubt that it would be the desired result.

    So what you could do is something like this. Put the radio.Connect(); statement in the following if statement. You would obviously use the proper serial number.

    if(radio.Serial == "720-1014-6400-1234")
    {
      radio.Connect();
    }
    

    I can't test this, but give it a try and let us know if it works. Can you confirm that you are using C# with FlexLib?

  • Trucker
    Trucker Member ✭✭✭
    Options

    Brad, have you figured out a workable solution for a radio chooser?

    James

    WD5GWY

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.