la5nta / wl2k-go

A Winlink framework for Go.
https://getpat.io
MIT License
50 stars 20 forks source link

Add capability to send rigctld commands that return more than one result #63

Open DougCollinge opened 3 years ago

DougCollinge commented 3 years ago

The existing code assumes that all rigctld commands return a single result, like get_freq but get_mode and others return two or more. rigctld has an awkward API that does not tell you when it has sent the last result so you just have to know how many results you are expecting and read that many lines. The results are packed into an array of string so the internal unexported functions needed to be altered slightly but the exported functions are backward compatible and also compatible with the libhamlib wrapper.

I needed the enum for the rig modulation modes so I had to make the rigctld depend on the C .h file. That could be fixed if that dependency is unwanted.

There is a "new" protocol for rigctld that seemed to solved the problem above and I coded for that until I found out that not all the rigctld commands actually implement the new protocol! When that happens the code could be made more compact and less messy.

The purpose of this change is to enable a patch that allows the setting of the rig's modulation mode, which is not possible without it.