Using HamLib with TR4W - n4af/TR4W GitHub Wiki

TR4W now supports HamLib as a radio choice. HamLib is a radio control library that supports over 130 different radio types. TR4W uses a single API to talk to the different radios. This allows automatic support of many older radios TR4W may not support directly as well as newer SDR radios.

To start using HamLib, there are several HamLib configuration (CTRL-J) options. But the easiest (and most frequently used option) is just to select Use HAMLIB on the radio setup dialog.

  • HAMLIB PATH - This is the location of the HamLib rigctld executable and its associated DLL (libhamlib-4.dll)
  • HAMLIB PORT - TR4W connects to rigctld via a TCP/IP socket. This is the socket that rigctld where listens for connections. The default in rigctld is 4532.
  • HAMLIB RIGCTLD IP ADDRESS - TR4W connects to rigctld via a TCP/IP socket. This is the IP address of the computer where rigctld is running. This will normally always be 127.0.0.1 but the option is here for special cases where the hamlib is running on a different computer.
  • HAMLIB RIGCTLD RUN AT STARTUP - This tells TR4W to launch the rigctld process when TR4W starts up and to shut it down when TR4W closes. In some case, one may want to use rigctld that was started previously. This should always be TRUE unless you have a very specific case and are well aware of what you are doing.
  • RADIO ONE USE HAMLIB - This tells TR4W to use the Hamlib library for rig control. Even if the radio is normally used directly by TR4W, this exclusively uses HamLib for all radio control.
  • RADIO ONE HAMLIB ID - Each different radio that HamLib controls has a unique ID. In the case where HamLib has added a new radio before TR4W has added it to the radio drop-down, this allows (using the tr4w.ini file) to set the radio ID for HamLib. Just select HamLib-Any in the radio drop-down, check the box for HamLib control and set the HAMLIB ID to the HamLib ID (obtained by entering rigctld -i) and you can talk to that radio type.

This is a significant upgrade to TR4W to add hamlib support. Hamlib is the ham radio control library that WSJT-X and several other programs use. This allows us to automatically support radios that hamlib already supports such as the Expert Interface TCI requested in issue https://github.com/n4af/TR4W/issues/446 . This also adds support for the Yaesu 757GXII and the Ten Tec Omni. The Flex should also work over the network.

Note this only works at the time for a single radio. I have yet to add the code to run two instances of rigctld but that will be easy once I get some feedback.

Let's use an example...say you have a K4 connected via a serial port at 38400 BAUD. If you want to switch to use HamLib, the only thing you should do is check the RADIO ONE USE HAMLIB checkbox on the radio One dialog. That will tell HamLib to connect to the radio with the same COM port settings specified in the dialog.

My main concern is to make sure I have not broken anything. In all the LogRadio RadioObject functions, I just added code at the top to call HamLib if set. If not hamlib, then the regular rig control is set to run. This is similar to how I did the K4 network code.

CW by CAT should work for any radios that support it as does PlayMessage. Split should work as well. I tested tuning from the bandmap among other things so this should be ready to go but I do expect bug reports as people test it. Mainly the issue may be if a feature is used that the radio does not support through HamLib (direct VFOB control is one example that some rigs do not support--looking at you Yaesu).