Documentation ¶
Overview ¶
Package ardop provides means of establishing a connection to a remote node using ARDOP TNC
Index ¶
- Constants
- Variables
- type Addr
- type Bandwidth
- type State
- type StateReceiver
- type TNC
- func (tnc *TNC) ARQBandwidth() (Bandwidth, error)
- func (tnc *TNC) ARQTimeout() (time.Duration, error)
- func (tnc *TNC) Abort() error
- func (tnc *TNC) AutoBreak() (bool, error)
- func (tnc *TNC) BeaconEvery(d time.Duration) error
- func (tnc *TNC) Busy() bool
- func (tnc *TNC) CWID() (bool, error)
- func (tnc *TNC) Close() error
- func (tnc *TNC) Dial(targetcall string) (net.Conn, error)
- func (tnc *TNC) DialBandwidth(targetcall string, bw Bandwidth) (net.Conn, error)
- func (tnc *TNC) DialURL(url *transport.URL) (net.Conn, error)
- func (tnc *TNC) DialURLContext(ctx context.Context, url *transport.URL) (net.Conn, error)
- func (tnc *TNC) Disconnect() error
- func (tnc *TNC) GridSquare() (string, error)
- func (tnc *TNC) Heard() map[string]time.Time
- func (tnc *TNC) Idle() bool
- func (tnc *TNC) Listen() (ln net.Listener, err error)
- func (tnc *TNC) ListenEnabled() StateReceiver
- func (tnc *TNC) MyCall() (string, error)
- func (tnc *TNC) Ping() error
- func (tnc *TNC) SendID() error
- func (tnc *TNC) SetARQBandwidth(bw Bandwidth) error
- func (tnc *TNC) SetARQTimeout(d time.Duration) error
- func (tnc *TNC) SetAutoBreak(on bool) error
- func (tnc *TNC) SetAuxiliaryCalls(calls []string) (err error)
- func (tnc *TNC) SetCWID(enabled bool) error
- func (tnc *TNC) SetCodec(state bool) error
- func (tnc *TNC) SetGridSquare(gs string) error
- func (tnc *TNC) SetListenEnabled(listen bool) error
- func (tnc *TNC) SetMycall(mycall string) error
- func (tnc *TNC) SetPTT(ptt transport.PTTController)
- func (tnc *TNC) State() State
- func (tnc *TNC) Version() (string, error)
Constants ¶
const ( DefaultAddr = "localhost:8515" // The default address Ardop TNC listens on DefaultARQTimeout = 90 * time.Second // The default ARQ session idle timout )
const ( ModeARQ = "ARQ" // ARQ mode ModeFEC = "FEC" // FEC mode )
Variables ¶
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") )
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 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
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.
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
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 (*TNC) ARQBandwidth ¶ added in v0.9.2
func (*TNC) BeaconEvery ¶
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) DialBandwidth ¶ added in v0.9.2
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
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
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 ¶
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 ¶
Returns the grid square as reported by the TNC
func (*TNC) Heard ¶
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) ListenEnabled ¶
func (tnc *TNC) ListenEnabled() StateReceiver
ListenState() returns a StateReceiver which can be used to get notification when the TNC state changes.
func (*TNC) SendID ¶
SendID will send an ID frame
If CWID is enabled the ID frame will be followed by a FSK CW ID.
func (*TNC) SetARQBandwidth ¶
Sets the ARQ bandwidth
func (*TNC) SetARQTimeout ¶
Sets the ARQ timeout
func (*TNC) SetAutoBreak ¶
SetAutoBreak Disables/enables automatic link turnover.
func (*TNC) SetAuxiliaryCalls ¶
Sets the auxiliary call signs that the TNC should answer to on incoming connections.
func (*TNC) SetCodec ¶
Enable/disable sound card and other resources
This is done automatically on Open(), users should normally don't do this.
func (*TNC) SetListenEnabled ¶
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) 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.