SmartSDR v3.8.20 and the SmartSDR v3.8.20 Release Notes
SmartSDR v2.12.1 and the SmartSDR v2.12.1 Release Notes
Power Genius XL Utility v3.8.9 and the Power Genius XL Release Notes v3.8.9
Tuner Genius XL Utility v1.2.11 and the Tuner Genius XL Release Notes v1.2.11
Antenna Genius Utility v4.1.8
Need technical support from FlexRadio? It's as simple as Creating a HelpDesk ticket.
If You Haven't Tried the API Yet...
...well, that's where I was until this morning.
After spending less than an hour playing, I advise anyone who might be hesitating to just jump right in! Connecting to the radio and doing "stuff" using FlexLib is really pretty easy.
I want to thank Enzo, whose posting of that little snippet of C# WinForms code made me see how I should get started. [ETA]AND for the advice about dealing with Windows Firewall.
And I want to thank Eric, whose posting of the getting started steps (from 7 months ago) helped me move just a little further forward.
I'm not saying I've accomplished anything really meaningful yet... but I can connect to the radio, and read properties back (like Callsign and Nickname). Simple, yes, but these are precisely the kind of activities that you need to grok to be sure you understand the way the library works.
So... if you're on the fence, and scratching your head or feeling like you don't know where to start... I advise you to just dive in and start to play. There's really nothing to it.
de Peter
Comments
-
OK, I have been doing that for over a week. Making no progress - I think. Using DELPHI 6 I am able to to get a balloon - it looks familiar- to show up in the lower right corner of the screen. It may pop up almost immediately or after a few shot seconds. Have no way of knowing if that means anything. I attempt to send a message to the radio /computer but no results. Using a TCP/IP scheme. Have no idea what the format would be for the command message. Been swiping pieces of code off the internet. Image is what I see at start up. Port is 4992. Comment? TU Vern
0 -
Vern, if you will post what you are sending, what you are trying to do and what you are getting back, we'll help you figure out what's wrong.0
-
Vern,
Looks like you successfully opened a socket to the radio - this is what you will see if SmartSDR is running and then a client connects.
All the commands to the radio are in plain text - if you use WireShark or similar you can see the commands that are sent to the radio and the associated responses. Its (time consuming but) easy to see what commands are necessary to do what.
Another approach, although still not in Delphi that may help you is to visit the Objective-C interface library I've written and is available from a link on github:
https://github.com/n5ac/smartsdr-objective-c
The two files that will help you most are Radio.m and Slice.m - there are methods in both of these files that who you the syntax of the API commands. Look for routines that begin with cmd in Radio.m and Slice.m.
From this you will see the commands you need to send.
You will also have to build a response/subscription parser to deal with getting status, command responses etc from the radio.
If you have telnet on your computer, you can telnet to port 4992 on the radio and type in commands interactively.
Each command needs to be look like:
C1|sub slice all
Where the C says its a command, 1 is a sequence number and "sub slice all" is a request to subscribe to status messages for all slices.
The FlexRadio wiki covers how to make commands and what to expect back from the radio as responses. However, it doesn't cover all of the current commands sets.
As Steve says below, let us know what you are trying to go and we can get you up to speed.
BTW, the parser for the radio is embedded also in the Radio.m file - look for routines that begin with 'parse'.
Stu K6TU
1 -
Needless to say, thank you to all !
I am getting nothing back, after the display of the balloon, that is visibly displayed. I set a stop point (my words - not Borlands) in my IDE for that procedure that should receive and display data but it is never activated.
Here is a list that I copied from an article, I believe, on this site. All Commands ( that may be stretching it) have a semicolon at the end which I have tried with and without. Not sure these will allow me to do what I want. One thing I would like to do is read the current displayed frequency from the FLEX-6500. I see nothing in the list here that gives me a hint that I can.
API.RadioAdded += new API.RadioAddedEventHandler(API_RadioAdded); API.RadioRemoved +=new
API.RadioRemovedEventHandler(API_RadioRemoved);
API.RadioAdded += new API.RadioAddedEventHandler(API_RadioAdded);
API.RadioRemoved += new API.RadioRemovedEventHandler(API_RadioRemoved);
API.RadioAdded += new
API.RadioAddedEventHandler(API_RadioAdded);
API.RadioList(0);
API.Init();Using 'ClientSocket' as my TCP/IP client- right or wrong. Noting current, as is obvious.
Enough said! An apology: I have not had formal training in my Programming language (DELPHI) and I am 85 yeas of age. Does that explain anything?
Vern
0 -
Don't feel bad Vern, I'm banging my head against the wall with this one as well ! I am attempting to do the same as you in Visual Basic.NET ( VS 2010) and every time I run my program that tries to
find the radio, it hits a break in the FlexLib api saying I am making a Null Reference to an object that doesn't exist! It doesn't help that I've not written hardly any code in 5 years! :-)
Good luck!
james
WD5GWY
0 -
Guys,
I don't speak Delphi, and VB.Net is just another flavor of C# ... there are even translators online that will convert from one to the other.
Here's what I've written so far -- it's pure hackery, but it DOES work. It finds the radio, connects, and displays properties.
Hopefully this will get you started, at least a bit.
de Peter K1PGV
using System;
using System.ComponentModel;
using System.Windows.Forms;
using Flex.Smoothlake.FlexLib;
private Radio _thisRadio; public Form1() { InitializeComponent(); API.RadioAdded += API_RadioAdded; API.RadioRemoved += API_RadioRemoved; API.ProgramName = "PGVTest"; API.Init(); } private void Form1_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; } private void API_RadioAdded(Radio radio) { Console.WriteLine("API_RadioAdded Fired: " + radio); _thisRadio = radio; modelTextBox.Text = radio.Model; serialTextBox.Text += radio.Serial; radio.SliceAdded += radio_SliceAdded; radio.SliceRemoved += radio_SliceRemoved; radio.PanadapterAdded += radio_PanadapterAdded; radio.PanadapterRemoved += radio_PanadapterRemoved; // // 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.Connect(); } private void radio_PropertyChanged(object sender, PropertyChangedEventArgs e) { Console.WriteLine(sender + " sends >>> " + e.PropertyName); if (e.PropertyName.Equals("Nickname")) { nickameTextBox.Text = _thisRadio.Nickname; } if (e.PropertyName.Equals("Callsign")) { callsignTextBox.Text = _thisRadio.Callsign; } } private void radio_PanadapterRemoved(Panadapter pan) { Console.WriteLine("radio_PanadapterRemoved fired
"); } private void radio_PanadapterAdded(Panadapter pan, Waterfall fall) { Console.WriteLine("radio_PanadapterAdded fired
"); pan.PropertyChanged += panadapter_PropertyChanged; } private void panadapter_PropertyChanged(object sender, PropertyChangedEventArgs e) { Console.WriteLine("panadapter_PropertyChanged fired
"); } private void radio_SliceRemoved(Slice slice) { Console.WriteLine("radio_SliceRemoved fired
"); } private void slice_PropertyChanged(object sender, PropertyChangedEventArgs e) { Console.WriteLine("slice_PropertyChanged fired
"); } private void radio_SliceAdded(Slice slice) { Console.WriteLine("radio_SliceAdded fired
"); slice.PropertyChanged += slice_PropertyChanged; } private void API_RadioRemoved(Radio radio) { Console.WriteLine("API_RadioRemovfed Fired: " + radio); _thisRadio = null; } private void button1_Click(object sender, EventArgs e) { Application.Exit(); } }4 -
Thanks Peter! That really does help. As I said earlier, it's been a while since I have written any code. And I have written a couple of small applications in the past in C#. But, having been several years ago, it seems as though I keep having a "Senior Moment" ( I'm 64) when trying to get things to work in C# or VB.NET. I have found a couple of C# to VB.NET converters and the code generated looks promising. I'm sure it's just something simple I'm overlooking!
Thanks,
james
WD5GWY
0 -
Peter, you are my coding hero!!! I got the C# example you posted working!!! Just had to clean up a couple of things that I copied that did not need to be there! I really do appreciate your help.
Now to getting my VB.NET code working correctly.
Thanks again!
james
WD5GWY
0 -
A first chance exception of type 'System.Net.Sockets.SocketException' occurred in System.dllGet an odd error that does not prevent the code from running, (this shows in the Immediate Window)
But, when I close the application it goes away! Maybe it has something to do with the Windows Firewall that I popped up the first time.
james
0 -
In the Debugging Options in Visual Studio 2010, I set it up to Debug Exceptions and to throw and exception when it encountered a problem. So, in : Flex.SmoothLake.Vita.VitaSocket it threw this
exception:
System.Net.Sockets.SocketException occurred
HResult=-2147467259
Message=Only one usage of each socket address (protocol/network address/port) is normally permitted
Source=System
ErrorCode=10048
NativeErrorCode=10048
StackTrace:
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
InnerException:
Here is where it occurred:
socket.Bind(new IPEndPoint(IPAddress.Any, port));
Not sure why the exception is thrown, but, if I turn off Debug Exceptions in Visual Studio, the app works, but, in the Immediate Window the original exception info is posted. Once I click the button to close the app, the Immediate Window closes.I don't know if this is an issue on my LAN or what.
Hope Steve or someone at Flex reads this.
james
WD5GWY
0 -
I'm glad that mess of a code snippet was helpful to you. Yay!
In terms of the exception, if you take a look at the comments in the source, you'll see that this exception is anticipated.
The code is trying to find a socket number that's not in use... in the exception handler (the "catch" clause) they increment the port number and then loop (using the "while") to retry the bind operation.
So... things are working as they should.
Moral of the story: Don't enable "Debug Exceptions" in Visual Studio unless you really want to walk through every exception, even ones that are handled. Even with this off, if an exception is raised that's not handled, the debugger will stop and let you know.
0 -
I appreciate the explanation and the code snippet. It does help a lot.
(and I turned off "Debug Exceptions".)
james
WD5GWY
0 -
You guys are starting to inspire me to try my hand at this. I have NO experience in any of the modern programming languages. The last serious programming I did was FORTRAN and Basic in college (1977-81) and GW-Basic about 20-25 years ago.
I wrote a CW training program on a Tandy TRS-80 Model 1000 (IBM PC Clone) for my wife to help her get her Novice language and help boost my speed up to pass the 20 wpm for extra. It was pretty slick, if I do say so myself.
Then in the 90's I wrote a macro translator to program a S-COM 7K repeater controller via the telephone/autopatch modem back end. I had to translate text commands into DTMF sequences and send them through my 56K modem (remember those) But The modem truncated the strings after about 30 characters, so I had to trap the strings, and divide them into two separate "send" commands. it was fun!
Now I need to find a way to learn C, C++, Delphi, VB or whatever the current craze is.
Steve, et. al. What would you recommend for an old guy (55) who only has about one more programming language left in him? oh... and it can't be expensive! I spent all my money on a 6500 and a tower & T11!
Thanks,
Ken - NM9P0 -
Ken,
For playing with this radio, for either graphic or command-line programs, I'd recommend you learn C# .Net -- You can download Visual Studio C# Express FREE from Microsoft. While the most recent version is Visual Studio 2013, I believe the source code they're distributing is written using VS 2010 (Flex person, please correct me if I'm wrong).
The nice thing about C# is it's easy, but also very rich. You'll even find some of it reminiscent of BASIC (for example, the string handling is superb... unlike in C/C++). The nice thing about Visual Studio is that it's a very powerful integrated development environment (IDE)... it'll even create a ready-to-run starter program of whatever type you choose for you.
There are zillions of "Getting Started" books and tutorials available on both C# and VS. One that I find particularly good, and very step-by-step, is Beginning Visual C# 2010 (the first few chapters are on the MSFT web site). This is particularly good because it'll walk you through not only the language, but also the Visual Studio programming environment... and it speaks directly to VS 2010 Express Edition as well.
The only thing that'll bend your brain some, if you've only programmed in languages such as Fortran and BASIC (what are called "procedural" languages) is that C# is an Object Oriented language. It's a slightly different way of thinking about programming than functional languages... but you'll get used to it soon enough.
I say go for it...
de Peter K1PGV
0 -
I second Peter's comments. The free version of Visual Studio is very good and contains all of the languages that Microsoft supports. The main differences between the free and paid versions are
advanced team collaboration tools. And there is even (in VS 2013) a Team version that is free.
(still lacks several features of the paid version, but, allows a small group of developers to work together)
Learning C# isn't really that hard, I just like VB better. And wrapping your head around an Object Oriented language such as C# or VB.NET, isn't really that hard. A good book like Peter suggested will help. Good luck and join in the fun!
james
WD5GWY
0 -
Ken
Don't feel so bad about being dated
I started programming with wired patch panels, then we built a computer that would read machine language on Paper Tape, then a New High Level Language - Assembler...
Finally since i could actually program in Assembler, the faculty council deemed that I must be qualified to teach undergrad engineering students that new language - Fortran 1.
Almost all the real time control systems (Traffic Light Control, Airports, Subways, Transit etc) we designed were developed in the 60's in Assembler or for efficiency in pure Machine Language... Frankly that was tough work....
BASIC came along about a decade later and the so called Object Oriented Languages a couple of decades after that....
By contrast C# and all these ease of use tools such a Visual C# make programming so EASY that even a totally dated Engineer like me can almost do it....
Good luck... it's fun to try to keep up with the kids....
0 -
I started my freshman year in college on an HP-9820 overgrown table-top calculator with pen plotter. The next class was "Concepts in Programming Systems" where we learned just enough assembly language to understand the roots of other compiled languages. Then we moved on to Fortran using punch cards on a Honeywell system. My Senior year they ditched the whole room of the Honeywell for a much smaller and more powerful HP3000 Series III time-shared system with terminals all over campus in several computer rooms and all faculty and administrative offices. Students could program in Basic, Fortran, ALGOL, COBOL and others. I stayed with FORTRAN and BASIC.
Sometime in there my younger brother got a TRS-80 Model 1 (Original Radio Shack computer) and we both learned that version of Basic, using a tape recorder for storage. It only had 4K of RAM and was a lot of work to get anything working.
In 1982 i purchased a VIC-20 and learned yet another version of basic. This time I played with ASSY subroutines the hard way and made a semi-dumb terminal program to run RTTY with an MFJ interface. It worked ok for basic stuff.
Then I finally moved up to the Tandy 1000 original in 1984 and got familiar with GW-Basic.
But I have never messed with Visual Basic and many of the other more structured, or object oriented languages.
I have also played with several different distributions of Linyx - Mepis, Depian, Ubuntu, Puppy, DSL, and finally Mint. I also played a bit with FREENAS. But I haven't messed with their programming languages like Perl, et al.
Perhaps there are a few tricks left in this old dog... I will look into C# and download a book. If noone else will program an interface for my Hercules DJ Controller, perhaps I will be able to some day. With the API, perhaps I will be able to experiment more with this 6500 than I though. I love to tinker, perhaps software tinkering is the new wave!
73 DE Ken - NM9P0 -
Minimal progress! I get this from 6500 or SmartSDR: 'V1.1.0.0H7E38FC7C' on each try to connect. The HEX value changes each time. A hint as to what it is?
First try this morning I received a large quantity of data. Never again, just the item noted above. I hope this doesn't mean I have to re cycle the 'computer' each try? {LOL}
Vern0 -
So... let me be sure I understand: When you call radio.connect() from your RadioAdded event handler, you get this string?
Who's printing it out and where does it appear?
Assuming you have a PropertyChanged event handler for the Radio class, you should start getting calls at that.
0 -
The V1.1.1.0 is the version of the API supported by the radio software. It is separated from the next information by a newline character "
".
the HXXXXXXXX is the API handle assigned by the radio to you, the client. Its primary purpose is to show the API handle of the client causing a particular radio status change in Status message. Status messages begin with S and are followed by a handle - a handle of zero (as in S0) shows a status event emitted from the radio itself.
Stu K6TU0 -
Thank you for your kind words Peter.
I'm glad to know that it was helpful for you other friends.
I think that with the Flex rigs experimenting will be exiciting.
After the SmartSDR API take a look at Ethernet (command) API http://wiki.flexradio.com/index.php?title=SmartSDR_TCP/IP_API. You can send commands to your Flex with a simple telnet console with no need for any HOST application that runs in windows ...
Really powerful and amazing
73' Enzo
iw7dmh
1 -
TU Gents!
To K1PGV: I can't answer your question smartly because the way you ask it the jargon is not understandable on this end. In my language : the data that I receive from the radio is displayed on a TMemo (Borland talk). That is a window in my program that is blank initially and when the data flows it is displayed on that window. I get the largest volume of data under these conditions: Start my TCP/IP pgm, start SmartSDR. It almost appears like it 'broadcasts' a batch when the SmartSDR starts i .e.I don't have to do anything for that first batch. Dumb query? Does the SmartSDR and/or the radio have a 'HOST' scheme built in? I have ClientSocket, ClientType set to "Blocking".
One other point to bore you with, When I send API.RadioAdded += new &
API.RadioConnect()API - in one sentence. I have the socket set with . it actually opens another slice, but not consistently - 75% of the time. However to see the effect I have shut down SmartSDR and bring it up again. Confused? I am. Sorry for confusion,
Vern0 -
OK, you guys talked me into it. I ordered the book and will start playing ASAP. I.e. When I get some free time!0
-
Hello everyone, sorry for my English.
Vern, I coded in delphi xe2 based on a piece of "objective C library" TCPIP program and it works
All the commands in the wiki says (c1 | command)
Just reading the "meter" that I have not managed to do so, they are not in "objective C" and I realized that it must pass through UDP.
If my program bou vou interested, no problem, but the comments are in French.
73 Jean-Louis / F4CLB
0 -
GM Jean-Louis: I believe there may be enough similarity between 'xe2 and ';DELPHI 6 that I could get a hint or two. I never upgraded as you can see from my comments. If you want to share I will gladly accept.
Thank you,
Vern W9HLY0 -
To K6TU, F4CLB, K1PGV and all: After Jean-Louis jarred my min and re-reading Stu's info I think I am beginning to get the hang of it. I sent 'C1|sub slice all' and it took. The changed data was the very data I am initially looking for - the frequency the radio is tune too. Using the Flexcontrol and any movement of the knob will force a dump of the freq changes onto my screen. So it is on-wards and up-wards...
Many thanks friends!
Vern W9HLY0 -
Vern,
Glad that got you going! Holler if you have any questions!
Stu K6TU
0 -
Hello,
Vern , if I understood well you succeeded has Read data from the Flex, if it is the case you are in the same point as me.
I think that the code delphi XE is has useless present?
( For information Delphi XE code is not readable to delphi 6 : unicode ? )
On the other hand, if somebody has the information of the column(section) METER because there is nothing here: http: // wiki.flexradio.com / index.php? Title=SmartSDR_TCP / IP_API
It is to finish my program of CAT more complete than that supplied at present.
Thank you in advance (and thanks to the internet translator HI!)
73 Jean Louis / F4CLB
0 -
Meters are a whole different issue as they (like pan adaptors, DAX etc) are streamed to you in VITA-49 UDP frames. They are well supported by the C# FlexLib interface but if you need a different language support, well... you are on your own - almost.
I have a partially complete document that describes the VITA-49 frames and the relevant stream.... this is intended for folks who ned to write their own interface library either because of a different platform or a different language set.
To use a meter, panafall or DAX like stream from the radio you need to be able to handle commands/status messages on the regular TCP connection to the radio and also process streams of UDP packets.
I'm in the process of adding these data types to the Objective C interface library I use.
Stu K6TU0 -
Hi Stu,
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.
If I can master that, I will be a happy camper. It will be especially useful if I can capture all of the control knobs, buttons, sliders, etc and give them all different functions on the rig, similar to what the UI-variant of PowerSDR is doing.
I love your FlexControl Knob, and I have your iPad controller, but this could be so much more helpful for me with two large tuning knobs, and all those buttons that I could use for CW/Voice keying, AGC control, Volume control, A/B switching, etc.
And it would be fun to say " I did it myself!"
Ken - NM9P
0
Leave a Comment
Categories
- All Categories
- 260 Community Topics
- 2.1K New Ideas
- 538 The Flea Market
- 7.6K Software
- 5.9K SmartSDR for Windows
- 139 SmartSDR for Maestro and M models
- 368 SmartSDR for Mac
- 251 SmartSDR for iOS
- 226 SmartSDR CAT
- 175 DAX
- 345 SmartSDR API
- 8.6K Radios and Accessories
- 6.9K FLEX-6000 Signature Series
- 45 FLEX-8000 Signature Series
- 803 Maestro
- 43 FlexControl
- 838 FLEX Series (Legacy) Radios
- 753 Genius Products
- 424 Power Genius XL Amplifier
- 280 Tuner Genius XL
- 89 Antenna Genius
- 227 Shack Infrastructure
- 168 Networking
- 410 Remote Operation (SmartLink)
- 119 Contesting
- 642 Peripherals & Station Integration
- 116 Amateur Radio Interests
- 879 Third-Party Software