ardop2

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 16 Imported by: 0

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")
	ErrRejectedBandwidth    = errors.New("Connection rejected by peer: incompatible bandwidth")
	ErrRejectedBusy         = errors.New("Connection rejected: channel busy")
	ErrChecksumMismatch     = errors.New("Control protocol checksum mismatch")
	ErrTNCClosed            = errors.New("TNC closed")
)

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 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)
	Quiet              // ??
	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

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

Gets the ARQ bandwidth

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 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)

func (*TNC) DialURL

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

DialURL dials ardop2:// URLs

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) NegotiateBandwidth

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

If negotiate bandwidth flag is set, peer bandwidths other than the ARQBandwidth() are acceptable

func (*TNC) Ping

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 int) 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) SetNegotiateBandwidth

func (tnc *TNC) SetNegotiateBandwidth(negotiate bool) error

Enable or disable bandwidth negotiation

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