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.

What's the Easiest Way to Send TCP/IP Messages to the radio?

K1ESE
K1ESE Member ✭✭✭
edited June 2019 in SmartSDR for Windows
Trying to write a standalone program in Basic to send TCP/IP messages to my 6500.  What's the easiest way?

Thanks,
K1ESE

Answers

  • John G3WGV
    John G3WGV Member ✭✭
    edited June 2019
    I'm not sure what you are asking for here. If you want to understand the protocol and the steps needed to connect to and exchange data with the 6500 then I modestly suggest that a good starting point would be my API primer, which is here. The FlexRadio Wiki also provides useful information. If you're after information on how to program TCP/IP ports via Basic then I can't help but I am sure someone who can will be along soon.

    73, John, G3WGV
  • Mark_WS7M
    Mark_WS7M Member ✭✭✭
    edited June 2019
    The absolute easiest way to send TCP/IP messages to the radio is to download Putty (https://www.chiark.greenend.org.uk/~sgtatham/putty/) if on Windows or if on Mac, open a terminal window and telnet to the radio IP on port 4992.

    Once connected you can type TCP commands to the radio and see the responses.

    For this no programming is required but you need to know what to send, IE the protocol.

    If you are willing to use Visual Studio Community edition (free https://visualstudio.microsoft.com/downloads/) then you can use the API code provided by Flex Radio and completely control your radio in a few minutes once you learn the API object and how to use it.   The Flex API can be downloaded from Flex Radio website.

    John has a great primer.  Take a look.

    Others here have used Python, some have used Java and others to successfully make connects to the radio.  Others have used C programs on Raspberry Pi to talk with their radios.

    I wrote and offer FRLogger a logging and control program for Flex 6000 radios.  It is written in C# and uses the Flex API to talk to the radio.   (http://ws7m.net/index.php/logger)
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin
    edited June 2019
    Once you understand the API and the communications that goes on, you can also use NodeRed.
  • ND8L
    ND8L Member ✭✭
    edited June 2019
    Do you want to write that in GW-BASIC or BASIC A? :) Sounds like I’m not the only guy living in the 80’s. John and Mark...thanks for the tips! 73 de ND8L
  • K1ESE
    K1ESE Member ✭✭✭
    edited June 2019
    I use Liberty Basic, more 90's than '80's, but far from Visual Basic.

    Thanks to Mark!  Putty works so I know it can be done, but I want to automate the commands.  I have two buttons in the GUI - Tune Start and Tune Stop.

    When Tune Start is clicked I want to send three messages to the radio -
    interlock tx1_enabled=f
    transmit set tunepower=25
    transmit tune on

    When Tune Stop is clicked I want to send three more commands to the radio -
    transmit tune off
    transmit set tunepower=0
    interlock tx1_enabled=t

    I am not a real programmer and opening, initializing a socket is daunting.  I could use Basic to make the GUI, buttons, and shell out to Putty or something similar to send the commands.  I'll bet there is a better way. 

    Thanks,
    John K1ESE
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin
    edited June 2019
    Hi John

    Good for you for jumping in.  Necessity is the mother of invention.  :)

    Like you, I grew up 'coding' in line numbers.  I know I can do it, but I don't do it enough to remember how to do it.  I got really good at 'hello world' in about 9 languages.

    Andreas, N6NU got me to look into something IBM did called NodeRed which is a perfect fit for this sort of automation.  You actually wire software blocks together.

    So, after you get your Tune app working, have a look at it.  

    I have a work in progress version of it (NodeRed server can run on a PC or a RPI) and it scales very well to be able to control the devices we want to use.  Not someone else's work.

    With slightly above zero programming skill, I have a new remote station control panel configured the way I want it.  

    When I get it done (give me a few more weeks), I'll share it in the remote operating section.  

    I think that if a bunch of us treat this like a 'virtual club project' we can do amazing things for remote control of our HF stations even if you have limited skills.

    This is what the user screen looks like:

    image

    This is what the programming screen looks like.

    image

    mike va3mw

  • Joe N3HEE
    Joe N3HEE Member ✭✭
    edited June 2019
    How about a live workshop or video series on creating a simple app for Flex radio ?  
  • KC2QMA_John
    KC2QMA_John Member ✭✭
    edited June 2019

     I agree a sort of video series on the basics for coding for the Flex API would be awesome and might set in motion some to start building apps for the FlexRadio!


    Anyway would be a lot of fun a great help to see some videos.
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin
    edited June 2019
    Hi Joe, 

    First have a look the NodeRed tutorials.  They are really well done.  They will help you with the circuit flow.  For me, the first thing I wrote was turning a GPIO port on and off.  It didn't take long.  

    If you can do that, then there are many GPIO driven relay boards available for very affordable prices.

    Mike
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin
    edited June 2019
    Hi Steve

    I think you will find this will work for you.  Like most things getting started seems painful, but then the pieces stand to land in place.

    I found it hugely gratifying.

    My hope is that we have a bunch of people playing with it and writing their own little pieces 

    To show you how easy it is to share, if you paste this mess :) into a 'Flow' you will get a Flex radio connection to a radio at 192.168.110.76.  Of course, you will have to change the IP address to that of your radio.    This is my playing around with some of the data that is available on the radio.

    You will also have to use the 'Pallete Manager' to install the Dashboard, but I think it warns you after you when you go to 'Deploy' it.

    Andreas, N6NU shared this with me and I used it as a learning tool.  Nice thing is that it hard to break it and easy to start over.

    For everyone else, don't let it scare you.  

    [{"id":"8a6e4210.d127c","type":"tab","label":"FlexRadio","disabled":false,"info":""},{"id":"3c7f8e54.684d62","type":"tcp in","z":"8a6e4210.d127c","name":"","server":"client","host":"192.168.110.76","port":"4992","datamode":"stream","datatype":"utf8","newline":"\n","topic":"","base64":false,"x":170,"y":260,"wires":[["d3fca6b8.3346a8","d1cf01cd.f4c41"]]},{"id":"b380ce92.e6b45","type":"tcp out","z":"8a6e4210.d127c","host":"","port":"","beserver":"reply","base64":false,"end":false,"name":"","x":820.0001029968262,"y":261.42866488865457,"wires":[]},{"id":"d3fca6b8.3346a8","type":"split","z":"8a6e4210.d127c","name":"","splt":" ","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":171.42857360839844,"y":402.85711261204324,"wires":[["8c99ffda.3eb5f","fccabb94.3f8688","1c4a2087.ccbe4f","8ccc0b16.f039c8"]]},{"id":"8c99ffda.3eb5f","type":"switch","z":"8a6e4210.d127c","name":"Freq","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^freq=","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":302.8571090698242,"y":402.85714694431863,"wires":[["f91fb34c.fc6bc"]]},{"id":"f91fb34c.fc6bc","type":"function","z":"8a6e4210.d127c","name":"ParseFreq","func":"
    msg.payload= msg.payload.split('=')[1]*100000;

    flow.set(""FlexTXFreq"",msg.payload);



    return msg;","outputs":1,"noerr":0,"x":454.28564453125,"y":403.8573303222656,"wires":[["68972b9c.fed054"]]},{"id":"5fbb7855.1a60f8","type":"mqtt out","z":"8a6e4210.d127c","name":"","topic":"FlexStatus","qos":"","retain":"","broker":"c6b2273f.c06678","x":804.7142944335938,"y":483.1429138183594,"wires":[]},{"id":"68972b9c.fed054","type":"function","z":"8a6e4210.d127c","name":"Divide Frequency by 100","func":"var Frequency=msg.payload/100;



    msg.payload= parseFloat(Frequency).toFixed(2);
    return msg;","outputs":1,"noerr":0,"x":669,"y":404,"wires":[["5fbb7855.1a60f8","d8129ec2.bdbd7"]]},{"id":"d1cf01cd.f4c41","type":"trigger","z":"8a6e4210.d127c","op1":"C173|sub tx all","op2":"C173|sub tx all","op1type":"str","op2type":"str","duration":"5","extend":true,"units":"s","reset":"","bytopic":"all","name":"","x":475.14288330078125,"y":261.57147216796875,"wires":[["b380ce92.e6b45"]]},{"id":"d8129ec2.bdbd7","type":"trigger","z":"8a6e4210.d127c","op1":"","op2":"","op1type":"nul","op2type":"payl","duration":"5","extend":false,"units":"s","reset":"","bytopic":"all","name":"","x":537.5,"y":480,"wires":[["5fbb7855.1a60f8","be2e5e22.97e37"]]},{"id":"be2e5e22.97e37","type":"ui_text","z":"8a6e4210.d127c","group":"4cf8bc64.a81eb4","order":4,"width":0,"height":0,"name":"","label":"Freq:","format":"{{msg.payload}}","layout":"row-center","x":805,"y":549,"wires":[]},{"id":"fccabb94.3f8688","type":"switch","z":"8a6e4210.d127c","name":"RF Power","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^rfpower=","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":311,"y":455,"wires":[["a33670c9.a9cbe"]]},{"id":"a33670c9.a9cbe","type":"function","z":"8a6e4210.d127c","name":"ParsePWR","func":"
    msg.payload= msg.payload.split('=')[1];

    flow.set(""rfpower"",msg.payload);



    return msg;","outputs":1,"noerr":0,"x":356,"y":524,"wires":[["435b13e4.16923c"]]},{"id":"1c4a2087.ccbe4f","type":"switch","z":"8a6e4210.d127c","name":"Slices","property":"payload","propertyType":"msg","rules":[{"t":"regex","v":"^slices=","vt":"str","case":false}],"checkall":"true","repair":false,"outputs":1,"x":311,"y":601,"wires":[["f7c56c57.943ed"]]},{"id":"8ccc0b16.f039c8","type":"debug","z":"8a6e4210.d127c","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":658.5,"y":766,"wires":[]},{"id":"f7c56c57.943ed","type":"function","z":"8a6e4210.d127c","name":"ParseSlices","func":"
    msg.payload= msg.payload.split('=')[1];

    flow.set(""slices"",msg.payload);



    return msg;","outputs":1,"noerr":0,"x":508,"y":605,"wires":[[]]},{"id":"435b13e4.16923c","type":"ui_level","z":"8a6e4210.d127c","group":"4cf8bc64.a81eb4","order":9,"width":0,"height":0,"name":"","label":"","colorHi":"#e60000","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":0,"max":100,"segWarn":"","segHigh":"","unit":"Watts","layout":"sh","channelA":"","channelB":"","decimals":0,"animations":"soft","shape":2,"colorschema":"fixed","x":652.5,"y":682,"wires":[]},{"id":"c6b2273f.c06678","type":"mqtt-broker","z":"","name":"","broker":"192.168.113.12","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthRetain":"false","birthPayload":"","closeTopic":"","closePayload":"","willTopic":"","willQos":"0","willRetain":"false","willPayload":""},{"id":"4cf8bc64.a81eb4","type":"ui_group","z":"","name":"6600 Status","tab":"aa678782.0347a8","disp":true,"width":"6","collapse":false},{"id":"aa678782.0347a8","type":"ui_tab","z":"","name":"VA3MW Shack Control","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

    Mike va3mw

    "Never stop learning" . :)

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.