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.

Anyone know how to use SmartLink with the API?

KD0RC
KD0RC Broomfield, COMember, Super Elmer Moderator
edited January 17 in SmartSDR API

I have my Teensy-based (Arduino work alike) box full of buttons and knobs working reasonably well when connected to my DHCP served LAN using the API. Now I want to expand its capabilities to include SmartLink so that I can operate it remotely. I assume that there is a website or ip address that I would connect to, and then provide my credentials. I assume further that the data would not flow via the SmartLink server, but that the server would then give me the proper ip address (or something) to hit to connect to the radio. Am I in the ballpark on how this works? Any insight on how to get connected to the radio remotely would be much appreciated.

Thanks & 73,

Len, KD0RC

Tagged:

Answers

  • K2KXK
    K2KXK Ken Member ✭✭

    Hey Len. Did you ever get this working? I have the same requirement to use a home grown program remotely. Thanks

  • KD0RC
    KD0RC Broomfield, COMember, Super Elmer Moderator

    Hi Ken, no I never did get any answers, so I use SoftEther VPN instead. Since my application (TeensyMaestro) doesn't pass much data, this works great.

    If you are bringing audio and waterfall data back using UDP, then you probably want to persue SmartLink. If it is API and/or CAT commands over TCP, then the VPN works very well.

  • K2KXK
    K2KXK Ken Member ✭✭

    Thanks for the quick response Len. My app exchanges tcp messages with the radio using the API. A VPN would certainly work but I’m thinking of another solution. I can forward port 4992 to the radio from my external dns name or ip. I just have to work out a security scheme since the radio would be exposed to the Internet. Your vpn solution solves that. Best regards and 73

  • K2KXK
    K2KXK Ken Member ✭✭

    Hey Len. I implemented the solution I was thinking about. I capture the external IP (actually dns name) and External port in my config.ini file. Then, If discovery does find a radio, I give the user the option of connecting remotely. Works great.

  • KD0RC
    KD0RC Broomfield, COMember, Super Elmer Moderator

    Excellent, glad to hear it! I used a similar technique in the old days to connect my Kenwood TS-2000 when I was travelling for my job. It was not really a very safe connection, but then again, it would take someone with my program or the Kenwood program to actually do anything with it. From a practical perspective, it is reasonably safe to say that no one is going to hack in and operate your radio.

  • K2KXK
    K2KXK Ken Member ✭✭

    I agree. If the really want to control my radio, I guess it's OK. I don't know if you could **** up the 6500 through the API. Guess that's what insurance is for. lol. Nice chatting with you. BTW, do you use Node-Red for any of your Flex interfacing? I discovered it a few years ago and did some control programming for my station. But some of the guys are really taking it to the next level these days.

  • KD0RC
    KD0RC Broomfield, COMember, Super Elmer Moderator

    I have played with Node Red a bit, and can see its potential, but most of what I have done is with an Arduino and Teensy (Arduino work-alike). My big retirement project was the TeensyMaestro that started as an Arduino and then moved over to Teensy (PJRC.com). There is a bit about it on my QRZ.COM page.

    Node Red has the advantage of drag-and-drop programming for non-programmers. C++ or C# has the advantage of more granular control and flexibility at the expense of needing programming knowledge. So in my case of the TeensyMaestro, I used the Flex library of Enzo, IW7DMH to do the heavy lifting of communicating with the Flex over TCP/IP. I then just use his routines in the custom code that I wrote to operate the controls and run the display. It is all available on GitHub - just search for TeensyMaestro.

    My programming background is pretty ancient - Fortran, PL/I and COBOL... I broke down and learned enough C++ to code up my project, but I am no expert in this area. I am sure that any self-respecting C programmer would find my coding methods hilarious. But as said by every junior programmer ever - "Yeah, but it works..."

  • K2KXK
    K2KXK Ken Member ✭✭

    I have the same background. FORTRAN and COBOL. With RPG II thrown in. I have avoided C and it's derivatives opting to learn things like Python and php. I use the TCP API to talk to the Flex. The C++ lib seems a little more flexible but now that node-red has the Flex nodes, that's my go-to platform. However, I have recently been playing with Arduino or some projects for my other hobby, RC Flying. I've been using pro-minis as imbedded devices attached to sensors like GPS and Current to send telemetry back to me controller. Mostly copying code that has been written by others but getting into it a little on my own. One thing I've noticed is the speed of a dedicated Arduino compared to Raspberry pi based Linux system. The Arduino buries the pi for a similar application. Also been playing with the ESP32 for wireless apps. Good thing I'm retired. Hi hi.

  • KD0RC
    KD0RC Broomfield, COMember, Super Elmer Moderator

    Very cool Ken! Well take a look at the Teensy boards. They are significantly faster and cheaper than the Arduino boards. An Arduino DUE is an 84 MHz ARM Cortex M3, the cheaper and smaller Teensy 4.1 is a 600 MHz ARM Cortex M7 and has built in ethernet. Using the Teensyduino add-in, you code it up just like an Arduino.

    Looking at your QRZ page, that Raspberry Pi rig control setup sounds really great!

  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin

    If you are still stuck, send me an email [email protected] and I will forward it to engineering.

  • K2KXK
    K2KXK Ken Member ✭✭

    OK, I will. It would be good to know if it's possible. Most of the node-red flows I see, including mine, essentially require the server to be on the same network as the Flex. While this is not usually a problem, it would be nice to be able to have a remote API. Thanks

  • KD0RC
    KD0RC Broomfield, COMember, Super Elmer Moderator

    Thanks Mike, I appreciate it. For now, I have everything working really well, so I am happy with my current solution. If I ever decide to pursue SmartLink again, I will certainly take you up on your offer!

  • Hi Len and Ken.

    Jonny, a student at Cardiff University wrote a Python library that is a client to the Flex 6k series and supports SmartLink. I'm continuing to do some work on it to make it a bit more robust and easier to use, but it can be a reference to authenticating with SmartLink and starting a session with a remote radio, then the commands are basically the same as being local.

    https://github.com/phase4ground/flexclient

    I'm specifically working on improving the SmartLink support right now, here's the latest login code.
    https://github.com/dkozel/flexclient/blob/smartlink_update/utils/SmartLinkAuthClient.py

    I came to the forum looking for Python programmers to help test and improve the library.
  • Mike-VA3MW
    Mike-VA3MW Administrator, FlexRadio Employee, Community Manager, Super Elmer, Moderator admin

    Thanks for Sharing Derek

  • KD0RC
    KD0RC Broomfield, COMember, Super Elmer Moderator

    Wow, thanks for that Derek. I am not a Python programmer, but I will take a look at this to see if I can understand it. I have a Raspberry Pi that I can use for experimentation.

  • K2KXK
    K2KXK Ken Member ✭✭

    Hey Derek. Thanks for your post. I'll check out Jonny's work today. I'd also be interested in the work you're doing and would love to help you test. Let me know what I can do.

  • Ken, sent you an email, thanks!

    If you have some Python experience the library and client can move pretty quickly, Jonny figured out and test the really core set of features and what's needed most now is a few people to review the code, improve some of the areas that come from figuring things out as you're working, and adding one or two tools to make it easy to explore the radio manually.
  • K2KXK
    K2KXK Ken Member ✭✭

    Hi Dereck. I didn't get your email. I assume you sent it to my address in QRZ which is the correct address. I have done quite a bit of Python, using the TCP API to the Flex but I like the idea of being able to use the c++ API from Python. I took a quick look at Jonny's files but couldn't get them to run. Got a lot of "missing modules", etc. I have to take a closer look at where all the modules need to be stored relative to each other. Please try an email again. 73, K2KXK

  • For folks coming along later, Ken's got my email now. Anyone else interested in testing or contributing ideas or code let me know here or pop a comment on the GitHub repo!

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.