winmor

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package winmor provides means of establishing a connection to a remote node using WINMOR TNC

Index

Constants

View Source
const (
	BufferInQueued = iota
	BufferInSequenced
	BufferOutQueued
	BufferOutConfirmed
	BufferAvgThroughput
)

Buffer slice index

"BUFFERS <in queued> <in sequenced> <out queued> <out confirmed> <1m avg throughput in bytes/minute>"

View Source
const DefaultAddr = "localhost:8500"

The default address Winmor TNC listens on

Variables

View Source
var (
	ErrInvalidBandwidth     error = errors.New("Invalid bandwidth. Supported values are 500 or 1600.")
	ErrActiveListenerExists error = errors.New("An active listener is already registered with this TNC.")
)
View Source
var (
	ErrBusy              = errors.New("TNC control port is busy.")
	ErrConnectInProgress = errors.New("A connect is in progress.")
)
View Source
var (
	ErrConnectTimeout = errors.New("Connect timeout")
	ErrInvalidAddr    = errors.New("Invalid address format")
)

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 Command

type Command string

type State

type State uint8
const (
	Unknown        State = iota
	Offline              // Sound card disabled and all sound card resources are released
	Disconnected         // The session is disconnected, the sound card remains active
	Connecting           // The station is sending Connect Requests to a target station
	ConnectPending       // A connect request frame was sensed and a connection is pending and capture/decoding is in process
	SendID               // Sending ID
	ISS                  // Information Sending Station (Sending Data)
	IRS                  // Information Receiving Station (Receiving data)
	IRSToISS             // Transition state from IRS to ISS to insure proper link turnover
	IRSModeShift         // Supplying Packets Sequenced information to the ISS for a requested mode shift
	ISSModeShift         // Requesting Packets Sequenced information from the IRS in preparation for a mode shift
	FECReceive           // Receiving FEC (unproto) data
	FEC500               // Sending FEC data 500Hz bandwidth
	FEC1600              // Sending FEC data 1600Hz bandwidth
)

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(addr string, mycall, gridSquare string) (*TNC, error)

func (*TNC) Busy

func (tnc *TNC) Busy() bool

Returns true if channel is clear

func (*TNC) Close

func (tnc *TNC) Close() error

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

This will not actually close the TNC software.

func (*TNC) Dial

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

func (*TNC) DialURL added in v0.7.0

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

DialURL dials winmor:// URLs

Syntax: winmor://mycall@/targetcall (mycall part is optional)

func (*TNC) DirtyDisconnect

func (tnc *TNC) DirtyDisconnect() error

DirtyDisconnect will send a dirty disconnect command to the TNC.

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.

It returns a map from callsign to last time it was heard. Each call returns a new copy of the latest map.

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(bandwidth int) (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) 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) 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) SetDriveLevel added in v0.7.0

func (tnc *TNC) SetDriveLevel(l int) error

Set the TX audio drive level

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

func (tnc *TNC) SetMaxConnReq(n int) error

Set the number of connect requests before giving up.

Allowed values are 3-15

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

func (tnc *TNC) SetResponseDelay(ms int) error

func (*TNC) SetRobust

func (tnc *TNC) SetRobust(robust bool) error

SetRobust sets the TNC in robust mode.

In robust mode the TNC will only use modes FSK4_2CarShort, FSK4_2Car or PSK4_2Car regardless of current data mode bandwidth setting. If in the ISS or ISSModeShift states changes will be delayed until the outbound queue is empty.

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