Re: [Hamlib-developer] Python API
Library to control radio transceivers and receivers
Brought to you by:
n0nb
From: Erik I. <run...@gm...> - 2025-03-30 20:21:37
|
Hi Steve, I am picking up your message in an attempt to guide you with ideas that others have also suggested. 1. You may start the rigctld in the background using subprocessPopen() , but you may also start it up from a command prompt as in : C:\>\WSJT\wsjtx\bin\rigctld-wsjtx.exe -m 3070 -s 19200 -r com10 -c 136 -vvv The rigctld daemon runs on the host where your rig is physically connected. 2. Now from Python you open a socket to the remote (or local if everything runs local) host and port 4532 (the default port for the rigtld wsjtx daemon). 3. Write "f\n" to the socket and you should receive a string with the frequency. So no need to launch rigctl for every command you use. If you want to find out which rig commands are implemented and what the command options are, use : rigctld-wsjtx.exe -? or rigctl-wsjtx.exe -? Hope this sets you on a good course, and remember that WSJTX contains the lastest Hamlib distribution. 73's and our thoughts to Mike, W9MDB -- who made most of this magic happen. Erik ON4PB. -----Original Message----- From: Stephen Pattinson <st...@bi...> Sent: Sunday, 30 March 2025 09:54 To: Erik Icket <run...@gm...>; ham...@li... Subject: Re: [Hamlib-developer] Python API Hi Erik, Thanks for responding. My Python 3 app is starting rigctld effectively in the background using the subprocessPopen() mechanism. Then to retrieve parameters from the radio, it is running subprocess.Run() which effectively executes "rigctl -m 2 f" for example to get the VFO frequency by capturing the response, but firing off a windows EXE program every second is pretty awful. I assumed I could via the API I assumed was available, open a channel/pipe/whatever and effectively do what ever rigctl is doing internally. I've looked at the API references and web pages, but they seem convulsively C. I see tantalizing references to python bindings (I'm not sure what that means) and in the Debian world I see a python3-hamlib library, but of course I'm looking for a Windows solution. Am I looking for something that doesn't exist Erik? 73 Steve VK3SPX On 30/03/2025 18:32, Erik Icket wrote: > Hi Steve, > > One way to obtain a better segregation between your Python app and the > rig, is to go via the rigctld daemon. > Once the daemon runs (local or remote), you may open a socket to it > and issue your commands. > For example, to know the frequency, just issue a write to socket with "f\n" > contents. > > It is not a straight program to rig interface, as you are looking for. > However, it does not require to launch the rigctl app each time you > issue a command. > > g'day ! > Erik > ON4PB > > -----Original Message----- > From: Stephen Pattinson via Hamlib-developer > <ham...@li...> > Sent: Saturday, 29 March 2025 09:06 > To: ham...@li... > Subject: [Hamlib-developer] Python API > > Hi, > I have written a Python (3.12.3) to talk to my IC7300 via Hamlib > (V4.6.2) in a Windows 10 environment, but I'm just issuing "rigctl" > commands and capturing the response. This works fine, but it's rather crude. > Of course I would like to use the API which I believe is available, > but I cannot find how to download the necessary additional software or > library, or find the documentation for the Python API. > I have looked at > "https://hamlib.sourceforge.net/manuals/4.3/index.html", but this > seems exclusively C Ironically, the most pertinent info I retrieved > from a search is from the Google AI (Sigh!) which suggests I need > "hamlib-python", but I can't find where the AI has scooped up this information. > If anybody can point me at installation instructions and documentation > for the API, I would be grateful. > Thanks/73 > Steve VK3SPX > > > _______________________________________________ > Hamlib-developer mailing list > Ham...@li... > https://lists.sourceforge.net/lists/listinfo/hamlib-developer > |