ardop

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: 17 Imported by: 8

Documentation

Overview

Package ardop provides means of establishing a connection to a remote node using ARDOP TNC

Index

Constants

View Source
const (
	DefaultAddr       = "localhost:8515" // The default address Ardop TNC listens on
	DefaultARQTimeout = 90 * time.Second // The default ARQ session idle timout
)
View Source
const (
	ModeARQ = "ARQ" // ARQ mode
	ModeFEC = "FEC" // FEC mode
)

Variables

View Source
var (
	ErrBusy                 = errors.New("TNC control port is busy.")
	ErrConnectInProgress    = errors.New("A connect is in progress.")
	ErrFlushTimeout         = errors.New("Flush timeout.")
	ErrActiveListenerExists = errors.New("An active listener is already registered with this TNC.")
	ErrDisconnectTimeout    = errors.New("Disconnect timeout: aborted connection.")
	ErrConnectTimeout       = errors.New("Connect timeout")
	ErrChecksumMismatch     = errors.New("Control protocol checksum mismatch")
	ErrTNCClosed            = errors.New("TNC closed")
	ErrUnsupportedBandwidth = errors.New("Unsupported ARQ bandwidth")
)
View Source
var (
	Bandwidth200Max     = Bandwidth{false, 200}
	Bandwidth500Max     = Bandwidth{false, 500}
	Bandwidth1000Max    = Bandwidth{false, 1000}
	Bandwidth2000Max    = Bandwidth{false, 2000}
	Bandwidth200Forced  = Bandwidth{true, 200}
	Bandwidth500Forced  = Bandwidth{true, 500}
	Bandwidth1000Forced = Bandwidth{true, 1000}
	Bandwidth2000Forced = Bandwidth{true, 2000}
)

Bandwidth definitions of all supported ARQ bandwidths.

Functions

This section is empty.

Types

type Addr

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

func (Addr) Network

func (a Addr) Network() string

func (Addr) String

func (a Addr) String() string

type Bandwidth

type Bandwidth struct {
	Forced bool // Force use of max bandwidth.
	Max    uint // Max bandwidh to use.
}

Bandwidth represents the ARQ bandwidth.

func BandwidthFromString added in v0.9.2

func BandwidthFromString(str string) (Bandwidth, error)

BandwidthFromString returns a Bandwidth representation of the given string.

The string must be a valid ARDOP ARQ bandwidth string (e.g. "2000MAX", "2000FORCED"). The MAX/FORCED suffix may be omitted. Defaults to MAX.

func Bandwidths added in v0.9.2

func Bandwidths() []Bandwidth

Bandwidths returns a list of all ARDOP ARQ bandwidths.

func (Bandwidth) IsZero

func (bw Bandwidth) IsZero() bool

IsZero returns true if bw is it's zero value.

func (Bandwidth) String

func (bw Bandwidth) String() string

Stringer for Bandwidth returns a valid bandwidth parameter that can be sent to the TNC.

type State

type State uint8
const (
	//go:generate stringer -type=State .
	Unknown      State = iota
	Offline            // Sound card disabled and all sound card resources are released
	Disconnected       // The session is disconnected, the sound card remains active
	ISS                // Information Sending Station (Sending Data)
	IRS                // Information Receiving Station (Receiving data)
	Idle               // ??
	FECSend            // ??
	FECReceive         // Receiving FEC (unproto) data
)

TNC states

func (State) String

func (i State) String() string

type StateReceiver

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

func (StateReceiver) Close

func (r StateReceiver) Close()

func (StateReceiver) States

func (r StateReceiver) States() <-chan State

type TNC

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

func Open

func Open(ctrl io.ReadWriteCloser, mycall, gridSquare string) (*TNC, error)

Open opens and initializes an ardop TNC.

func OpenTCP

func OpenTCP(addr string, mycall, gridSquare string) (*TNC, error)

OpenTCP opens and initializes an ardop TNC over TCP.

func (*TNC) ARQBandwidth added in v0.9.2

func (tnc *TNC) ARQBandwidth() (Bandwidth, error)

func (*TNC) ARQTimeout

func (tnc *TNC) ARQTimeout() (time.Duration, error)

Gets the ARQ timeout

func (*TNC) Abort

func (tnc *TNC) Abort() error

Abort immediately aborts an ARQ Connection or a FEC Send session.

func (*TNC) AutoBreak

func (tnc *TNC) AutoBreak() (bool, error)

Autobreak returns wether or not automatic link turnover is enabled.

func (*TNC) BeaconEvery

func (tnc *TNC) BeaconEvery(d time.Duration) error

BeaconEvery starts a goroutine that sends an ID frame (SendID) at the regular interval d

The gorutine will be closed on Close() or if d equals 0.

func (*TNC) Busy

func (tnc *TNC) Busy() bool

Returns true if channel is not clear

func (*TNC) CWID

func (tnc *TNC) CWID() (bool, error)

CWID reports wether or not the TNC will send FSK CW ID after an ID frame.

func (*TNC) Close

func (tnc *TNC) Close() error

Closes the connection to the TNC (and any on-going connections).

func (*TNC) Dial

func (tnc *TNC) Dial(targetcall string) (net.Conn, error)

Dial dials a ARQ connection.

func (*TNC) DialBandwidth added in v0.9.2

func (tnc *TNC) DialBandwidth(targetcall string, bw Bandwidth) (net.Conn, error)

DialBandwidth dials a ARQ connection after setting the given ARQ bandwidth temporarily.

The ARQ bandwidth setting is reverted on any Dial error and when calling conn.Close().

func (*TNC) DialURL added in v0.7.0

func (tnc *TNC) DialURL(url *transport.URL) (net.Conn, error)

DialURL dials ardop:// URLs.

Parameter bw can be used to set the ARQ bandwidth for this connection. See DialBandwidth for details.

func (*TNC) DialURLContext added in v0.10.0

func (tnc *TNC) DialURLContext(ctx context.Context, url *transport.URL) (net.Conn, error)

DialURLContext dials ardop:// URLs with cancellation support. See DialURL.

If the context is cancelled while dialing, the connection may be closed gracefully before returning an error. Use Abort() for immediate cancellation of a dial operation.

func (*TNC) Disconnect

func (tnc *TNC) Disconnect() error

Disconnect gracefully disconnects the active connection or cancels an ongoing connect.

The method will block until the TNC is disconnected.

If the TNC is not connecting/connected, Disconnect is a noop.

func (*TNC) GridSquare

func (tnc *TNC) GridSquare() (string, error)

Returns the grid square as reported by the TNC

func (*TNC) Heard

func (tnc *TNC) Heard() map[string]time.Time

Heard returns all stations heard by the TNC since it was opened.

The returned map is a map from callsign to last time the station was heard.

func (*TNC) Idle

func (tnc *TNC) Idle() bool

Idle returns true if the TNC is not in a connecting or connected state.

func (*TNC) Listen

func (tnc *TNC) Listen() (ln net.Listener, err error)

func (*TNC) ListenEnabled

func (tnc *TNC) ListenEnabled() StateReceiver

ListenState() returns a StateReceiver which can be used to get notification when the TNC state changes.

func (*TNC) MyCall

func (tnc *TNC) MyCall() (string, error)

Returns mycall as reported by the TNC

func (*TNC) Ping added in v0.7.0

func (tnc *TNC) Ping() error

Ping checks the TNC connection for errors

func (*TNC) SendID

func (tnc *TNC) SendID() error

SendID will send an ID frame

If CWID is enabled the ID frame will be followed by a FSK CW ID.

func (*TNC) SetARQBandwidth

func (tnc *TNC) SetARQBandwidth(bw Bandwidth) error

Sets the ARQ bandwidth

func (*TNC) SetARQTimeout

func (tnc *TNC) SetARQTimeout(d time.Duration) error

Sets the ARQ timeout

func (*TNC) SetAutoBreak

func (tnc *TNC) SetAutoBreak(on bool) error

SetAutoBreak Disables/enables automatic link turnover.

func (*TNC) SetAuxiliaryCalls

func (tnc *TNC) SetAuxiliaryCalls(calls []string) (err error)

Sets the auxiliary call signs that the TNC should answer to on incoming connections.

func (*TNC) SetCWID

func (tnc *TNC) SetCWID(enabled bool) error

SetCWID sets wether or not to send FSK CW ID after an ID frame.

func (*TNC) SetCodec

func (tnc *TNC) SetCodec(state bool) error

Enable/disable sound card and other resources

This is done automatically on Open(), users should normally don't do this.

func (*TNC) SetGridSquare

func (tnc *TNC) SetGridSquare(gs string) error

Sets the grid square

func (*TNC) SetListenEnabled

func (tnc *TNC) SetListenEnabled(listen bool) error

Enable/disable TNC response to an ARQ connect request.

This is disabled automatically on Open(), and enabled when needed. Users should normally don't do this.

func (*TNC) SetMycall

func (tnc *TNC) SetMycall(mycall string) error

SetMycall sets the provided callsign as the main callsign for the TNC

func (*TNC) SetPTT

func (tnc *TNC) SetPTT(ptt transport.PTTController)

Set the PTT that should be controlled by the TNC.

If nil, the PTT request from the TNC is ignored.

func (*TNC) State

func (tnc *TNC) State() State

Returns the current state of the TNC

func (*TNC) Version

func (tnc *TNC) Version() (string, error)

Version returns the software version of the TNC

Jump to

Keyboard shortcuts

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