hamlib

package
v0.11.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 11 Imported by: 4

Documentation

Overview

Package hamlib provides bindings for a _subset_ of hamlib. It provides both native cgo bindings and a rigctld client.

Use build tag "libhamlib" to build with native C library support.

Index

Constants

View Source
const DefaultTCPAddr = "localhost:4532"

Variables

View Source
var ErrNotVFOMode = errors.New("rigctl is not running in VFO mode")
View Source
var ErrUnexpectedValue = fmt.Errorf("Unexpected value in response")
View Source
var TCPTimeout = time.Second

TCPTimeout defines the timeout duration of dial, read and write operations.

Functions

func Rigs

func Rigs() map[RigModel]string

Rigs is here for compatibility (use build tag 'libhamlib').

Types

type Rig

type Rig interface {
	// Closes the connection to the Rig.
	Close() error

	// Returns the Rig's active VFO (for control).
	CurrentVFO() VFO

	// Returns the Rig's A-VFO (for control).
	VFOA() (VFO, error)

	// Returns the Rig's B-VFO (for control).
	VFOB() (VFO, error)
}

Rig represents a receiver or tranceiver.

It holds the data connection to the device.

func Open

func Open(network, address string) (Rig, error)

func OpenSerialURI

func OpenSerialURI(uri string) (Rig, error)

OpenSerialURI is here for compatibility (use build tag 'libhamlib').

type RigModel

type RigModel int

RigModel is the hamlib ID identifying a spesific tranceiver model.

type TCPRig

type TCPRig struct {
	// contains filtered or unexported fields
}

Rig represents a receiver or tranceiver.

It holds the tcp connection to the service (rigctld).

func OpenTCP

func OpenTCP(addr string) (*TCPRig, error)

OpenTCP opens a new TCPRig and returns a ready to use Rig.

The connection to rigctld is not initiated until the connection is requred. To check for a valid connection, call Ping.

Caller must remember to Close the Rig after use.

func (*TCPRig) Close

func (r *TCPRig) Close() error

Closes the connection to the Rig.

func (*TCPRig) CurrentVFO

func (r *TCPRig) CurrentVFO() VFO

Returns the Rig's active VFO (for control).

func (*TCPRig) Ping added in v0.7.0

func (r *TCPRig) Ping() error

Ping checks that a connection to rigctld is open and valid.

If no connection is active, it will try to establish one.

func (*TCPRig) VFOA

func (r *TCPRig) VFOA() (VFO, error)

Returns the Rig's VFO A (for control).

ErrNotVFOMode is returned if rigctld is not in VFO mode.

func (*TCPRig) VFOB

func (r *TCPRig) VFOB() (VFO, error)

Returns the Rig's VFO B (for control).

ErrNotVFOMode is returned if rigctld is not in VFO mode.

func (*TCPRig) VFOMode

func (r *TCPRig) VFOMode() (bool, error)

type VFO

type VFO interface {
	// Gets the dial frequency for this VFO.
	GetFreq() (int, error)

	// Sets the dial frequency for this VFO.
	SetFreq(f int) error

	// GetPTT returns the PTT state for this VFO.
	GetPTT() (bool, error)

	// Enable (or disable) PTT on this VFO.
	SetPTT(on bool) error
}

VFO (Variable Frequency Oscillator) represents a tunable channel, from the radio operator's view.

Also referred to as "BAND" (A-band/B-band) by some radio manufacturers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL