Kozai::Hamlib
The line-oriented TCP protocol shared by hamlib's rotctld and rigctld.
Both daemons speak the same shape of conversation: send one line, read one
or more lines back, where a command that returns no data answers RPRT 0
and a failure answers RPRT with a negative error number.
NOTE: this talks to hamlib over a socket rather than linking libhamlib.
That is a deliberate constraint of this project — no C libraries, no FFI, no
lib blocks anywhere in src/ — and it turns out to be the better design
regardless. rotctld already exists on every station that has hamlib, it
already handles the serial port and the dozens of rotator models, and a
crash in a rotator driver takes down a separate process instead of the
prediction daemon. The cost is a socket; the gain is that this program has
no build-time dependency on anyone's C library version.
:nodoc:
Constants
How long to wait for a daemon to answer before giving up.
Constructors
Instance methods
Raises unless reply is hamlib's success status.
NOTE: RPRT 0 means success; anything else is a negative hamlib error
code. Some builds answer a successful set command with an empty line
instead, which is accepted rather than treated as a fault.
Sends a command that returns only a status line.
Raises IO::Error if the daemon reports a failure.
Opens the connection if it is not already open.
Raises IO::Error or Socket::Error if the daemon cannot be reached; the
callers in Rotator and Radio translate those into their own
ConnectionError.
Sends command and reads lines lines of response.
On any socket error the connection is dropped so that the next call reconnects rather than reusing a half-dead socket.