Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

DougCollinge
Copy link

@DougCollinge DougCollinge commented Nov 22, 2020

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.

'rigListCb' was not defined before use, which produces an annoyingly verbose warning message twice in every build. Since the fix was so easy and should have no side-effects I put it in here.
The interface to rigctld before this commit could only handle commands that return either one or no results. The problem is that commands like "\get_mode" return two lines of output but don't indicate when they are finished. So we have to tell it how many lines to read; e.g., send get_mode and expect two lines of output. The outputs are packed into a string array, so for commands returning single outputs (like get_freq) the output is the result[0].

The exported functions are compatible with the libhamlib interface, even if the unexported internals are slightly different.
Remove all debug tracing

Hopefully, I'll be able to merge this back in later if necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant