Mike Black
The reason rigctld emulation is a bad idea is that it changes over time.? And the client may want vfo mode or not so most every command has to be checked for VFO.
toggle quoted message
Show quoted text
A rig definition never changes -- but it can be extended. Historically rigctld emulation was only necessary if you wanted a socket connection but that's not true anymore. You can connect to any rig via a TCP socket and in 4.7 you'll be able to have a UDP/Multicast connection to control the rig. So here's a rigctld emulation in code. fgets(buf,sizeof(buf),fp); char vfo[16]; long freqA,freqB; int n = sscanf(buf,"f %s %ld", vfo, &freq); if (n == 2) { // then there's no VFO ????int n = sscanf(buf,"f? %ld", &freq); ? ? vfo = current_vfo;? // you have to track which vfo is active -- PITA } if (vfo == 'VFOA') freqA = freq; else if (vfo == 'VFOB') freqB = freq; else printf("unknown vfo") printf ("read freq %ld from vfo %s\n", freq, vfo); And here's a TS-2000 emulator which is very straightforward and easy to understand. fgets(buf,sizeof(buf),fp); char vfo[16]; long freq; int n = sscanf(buf,"FA%d",&freq); printf ("read freq %ld from vfo %s\n", freq, vfo); if (n == 1) { ?freqA = freq; } n = sscanf(buf,"FB%d",&freq); if (n == 1) ?freqB = freq; } Mike W9MDB On Tuesday, February 27, 2024 at 06:31:31 AM CST, Roger David Powers via groups.io <progpwr@...> wrote:
On Fri, Aug 18, 2023 at 01:50 PM, jimahlstrom wrote: I can alter Quisk's Hamlib code if it makes it more convenient for the Hamlib community, but I need a description of what to change.In?/g/n2adr-sdr/message/3043?we get a hint. You probably should read the whole thread when you get a chance. Personally I think emulating rigctld was a good idea, and I don't know why some think it was a bad idea. I've read the code of an emulated TS-2000 and it reads like a hex dump. Yet it seems the current "best practice" is to emulate a real radio closest to the SDR's capabilities, and use a radio-specific back end to tweak any back-end differences. It seems to me this would lead to lots of copy/paste code since hamlib isn't object-oriented so their is no core object you can extend as far as I can tell. It seems there are function pointers to call into other radio objects, but still it seems to take a few thousand lines of code to do a back end regardless. As usual, these are just my opinions, and I'm willing to be corrected. Regards, RDP |