client

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2023 License: MIT Imports: 12 Imported by: 9

Documentation

Overview

The package client provides a client implementation for the TCI protocol.

Index

Constants

View Source
const (
	VFOA = VFO(0)
	VFOB = VFO(1)
)

All available VFOs in TCI.

View Source
const (
	ModeAM   = Mode("am")
	ModeSAM  = Mode("sam")
	ModeDSB  = Mode("dsb")
	ModeLSB  = Mode("lsb")
	ModeUSB  = Mode("usb")
	ModeCW   = Mode("cw")
	ModeNFM  = Mode("nfm")
	ModeWFM  = Mode("wfm")
	ModeSPEC = Mode("spec")
	ModeDIGL = Mode("digl")
	ModeDIGU = Mode("digu")
	ModeDRM  = Mode("drm")
)

All modes acvailable in TCI.

View Source
const (
	SignalSourceDefault = SignalSource("")
	SignalSourceMIC     = SignalSource("mic")
	SignalSourceVAC     = SignalSource("vac")
)

All available sources for the TX audio signal.

View Source
const (
	IQSampleRate48k  = IQSampleRate(48000)
	IQSampleRate96k  = IQSampleRate(96000)
	IQSampleRate192k = IQSampleRate(192000)
)

All available sample rates for IQ data.

View Source
const (
	AudioSampleRate8k  = AudioSampleRate(8000)
	AudioSampleRate12k = AudioSampleRate(12000)
	AudioSampleRate24k = AudioSampleRate(24000)
	AudioSampleRate48k = AudioSampleRate(48000)
)

All available sample rates for audio data.

View Source
const DefaultPort = 40001

DefaultPort of TCI

Variables

View Source
var DefaultTimeout = time.Duration(50 * time.Millisecond)

DefaultTimeout is the default duration to wait for the reply of a command.

View Source
var ErrNotConnected = errors.New("not connected")

ErrNotConnected indicates that there is currently no TCI connection available.

View Source
var ErrTimeout = errors.New("timeout")

ErrTimeout indicates a timeout while waiting for the reply of a command.

Functions

func NewTXAudioMessage

func NewTXAudioMessage(trx int, sampleRate AudioSampleRate, samples []float32) ([]byte, error)

NewTXAudioMessage returns a binary message of type TXAudioStream that contains the given samples. The binary message can directly be send through a websocket connection to the TCI server.

Types

type ARGB

type ARGB uint32

ARGB represents a color with four (alpha, red, green, blue) 8-bit channels.

func NewARGB

func NewARGB(a, r, g, b byte) ARGB

NewARGB returns a ARGB with the given alpha, red, green, and blue values.

func (ARGB) A

func (c ARGB) A() byte

A is the alpha channel of this color.

func (ARGB) B

func (c ARGB) B() byte

B is the blue channel of this color.

func (ARGB) G

func (c ARGB) G() byte

G is the green channel of this color.

func (ARGB) R

func (c ARGB) R() byte

R is the red channel of this color.

func (ARGB) String

func (c ARGB) String() string

type AppFocusListener

type AppFocusListener interface {
	SetAppFocus(focussed bool)
}

A AppFocusListener is notified when a APP_FOCUS message is received from the TCI server.

type AudioSampleRate

type AudioSampleRate int

AudioSampleRate represents the sample rate for audio data in samples per second.

type AudioSampleRateListener

type AudioSampleRateListener interface {
	SetAudioSampleRate(sampleRate AudioSampleRate)
}

A AudioSampleRateListener is notified when a AUDIO_SAMPLERATE message is received from the TCI server.

type BinaryMessage

type BinaryMessage struct {
	TRX        int
	SampleRate int
	Format     int
	Codec      int
	CRC        uint32
	DataLength uint32
	Type       BinaryMessageType
	Data       []float32
}

BinaryMessage represents a binary message that is exchanged between the TCI server and a client.

func ParseBinaryMessage

func ParseBinaryMessage(b []byte) (BinaryMessage, error)

ParseBinaryMessage parses the given byte slice as incoming binary message.

type BinaryMessageListener

type BinaryMessageListener interface {
	BinaryMessage(msg BinaryMessage)
}

A BinaryMessageListener is notified when any binary message (IQ data, audio data, or tx chrono) is received from the TCI server.

type BinaryMessageType

type BinaryMessageType uint32

BinaryMessageType represents the type of a BinaryMessage

const (
	IQStreamMessage BinaryMessageType = iota
	RXAudioStreamMessage
	TXAudioStreamMessage
	TXChronoMessage
)

All message types available in TCI.

type CTCSSEnableListener

type CTCSSEnableListener interface {
	SetCTCSSEnable(trx int, enabled bool)
}

A CTCSSEnableListener is notified when a CTCSS_ENABLE message is received from the TCI server.

type CTCSSLevelListener

type CTCSSLevelListener interface {
	SetCTCSSLevel(trx int, percent int)
}

A CTCSSLevelListener is notified when a CTCSS_LEVEL message is received from the TCI server.

type CTCSSMode

type CTCSSMode int

CTCSSMode represents the operation mode for CTCSS subtones.

const (
	CTCSSModeBoth CTCSSMode = iota
	CTCSSModeRXOnly
	CTCSSModeTXOnly
)

All available CTCSS modes.

type CTCSSModeListener

type CTCSSModeListener interface {
	SetCTCSSMode(trx int, mode CTCSSMode)
}

A CTCSSModeListener is notified when a CTCSS_MODE message is received from the TCI server.

type CTCSSRXToneListener

type CTCSSRXToneListener interface {
	SetCTCSSRXTone(trx int, tone CTCSSTone)
}

A CTCSSRXToneListener is notified when a CTCSS_RX_TONE message is received from the TCI server.

type CTCSSTXToneListener

type CTCSSTXToneListener interface {
	SetCTCSSTXTone(trx int, tone CTCSSTone)
}

A CTCSSTXToneListener is notified when a CTCSS_TX_TONE message is received from the TCI server.

type CTCSSTone

type CTCSSTone int

CTCSSTone represents a certain CTCSS subtone.

type CWMacrosDelayListener

type CWMacrosDelayListener interface {
	SetCWMacrosDelay(delay int)
}

A CWMacrosDelayListener is notified when a CW_MACROS_DELAY message is received from the TCI server.

type CWMacrosEmptyListener added in v0.3.0

type CWMacrosEmptyListener interface {
	CWMacrosEmpty()
}

A CWMacrosEmptyListener is notified then a CW_MACROS_EMPTY message is received from the TCI server. (since TCI 1.5)

type CWMacrosSpeedListener

type CWMacrosSpeedListener interface {
	SetCWMacrosSpeed(wpm int)
}

A CWMacrosSpeedListener is notified when a CW_MACROS_SPEED message is received from the TCI server.

type ChannelCountListener

type ChannelCountListener interface {
	SetChannelCount(count int)
}

A ChannelCountListener is notified when a CHANNEL_COUNT message is received from the TCI server.

type Client

type Client struct {
	DeviceInfo
	// contains filtered or unexported fields
}

Client represents a TCI client.

func KeepOpen

func KeepOpen(host *net.TCPAddr, retryInterval time.Duration, trace bool, listeners ...interface{}) *Client

KeepOpen opens a connection to the given host and tries to keep an open connection by automatically trying to reconnect when an established connection is lost (after the given grace period). The given listeners are notified about any incoming message. KeepOpen returns immediately. If you want to know when the connection is available, add a ConnectionListener to the list of listeners.

func Open

func Open(host *net.TCPAddr, trace bool, listeners ...interface{}) (*Client, error)

Open a connection to the given host. The given listeners are notified about any incoming message. Open returns as soon as the READY; message was received.

func (*Client) AddSpot

func (c *Client) AddSpot(callsign string, mode Mode, frequency int, color ARGB, text string) error

AddSpot adds a spot to the panorama display.

func (*Client) AudioSampleRate

func (c *Client) AudioSampleRate() (AudioSampleRate, error)

AudioSampleRate reads the sample rate for Audio data.

func (*Client) BringToFront

func (c *Client) BringToFront() error

BringToFront brings main ExpertSDR window into the focus.

func (*Client) CTCSSEnable

func (c *Client) CTCSSEnable(trx int) (bool, error)

CTCSSEnable reads enable state of CTCSS for the given TRX.

func (*Client) CTCSSLevel

func (c *Client) CTCSSLevel(trx int) (int, error)

CTCSSLevel reads the given TRX's CTCSS subtone level for transmitting in percent.

func (*Client) CTCSSMode

func (c *Client) CTCSSMode(trx int) (CTCSSMode, error)

CTCSSMode reads the CTCSS mode of the given TRX.

func (*Client) CTCSSRXTone

func (c *Client) CTCSSRXTone(trx int) (CTCSSTone, error)

CTCSSRXTone reads the given TRX's CTCSS subtone for receiving.

func (*Client) CTCSSTXTone

func (c *Client) CTCSSTXTone(trx int) (CTCSSTone, error)

CTCSSTXTone reads the given TRX's CTCSS subtone for transmitting.

func (*Client) CWMacrosDelay

func (c *Client) CWMacrosDelay() (int, error)

CWMacrosDelay reads the delay for transmitting CW macros in milliseconds.

func (*Client) CWMacrosSpeed

func (c *Client) CWMacrosSpeed() (int, error)

CWMacrosSpeed reads the speed in WPM for CW macros.

func (*Client) CWMacrosSpeedDec

func (c *Client) CWMacrosSpeedDec(delta int) error

CWMacrosSpeedDec decreases the speed for CW macros by the given delta in WPM.

func (*Client) CWMacrosSpeedInc

func (c *Client) CWMacrosSpeedInc(delta int) error

CWMacrosSpeedInc increases the speed for CW macros by the given delta in WPM.

func (*Client) ClearSpots

func (c *Client) ClearSpots() error

ClearSpots deletes all spots.

func (*Client) Connected

func (c *Client) Connected() bool

Connected indicates if there is currently a TCI connection established.

func (*Client) DDS

func (c *Client) DDS(trx int) (int, error)

DDS reads the center frequency of the given TRX's panorama.

func (*Client) DeleteSpot

func (c *Client) DeleteSpot(callsign string) error

DeleteSpot deletes the spot with the given callsign.

func (*Client) Disconnect

func (c *Client) Disconnect()

Disconnect the TCI connection. If this client was created using KeepOpen, the automatic retry stops and the client stays disconnected.

func (*Client) Drive

func (c *Client) Drive() (int, error)

Drive reads the output power in percent. Starting from TCI version 1.5, this command affects TRX 0.

func (*Client) ECoderSwitchChannel

func (c *Client) ECoderSwitchChannel(ecoder int) (VFO, error)

ECoderSwitchChannel reads which channel is assigned to the given E-Coder.

func (*Client) ECoderSwitchRX

func (c *Client) ECoderSwitchRX(ecoder int) (int, error)

ECoderSwitchRX reads which TRX is assigned to the given E-Coder.

func (*Client) IF

func (c *Client) IF(trx int, vfo VFO) (int, error)

IF reads the tuning frequency of the given TRX's vfo.

func (*Client) IQSampleRate

func (c *Client) IQSampleRate() (IQSampleRate, error)

IQSampleRate reads the sample rate for IQ data.

func (*Client) Mode

func (c *Client) Mode(trx int) (Mode, error)

Mode reads the mode of the given TRX.

func (*Client) Mute

func (c *Client) Mute() (bool, error)

Mute reads main volume's mute state.

func (Client) Notify

func (n Client) Notify(listener interface{})

Notify registers the given listener. The listener is then notified about incoming messages.

func (*Client) RITEnable

func (c *Client) RITEnable(trx int) (bool, error)

RITEnable reads the RIT enable state of the given TRX.

func (*Client) RITOffset

func (c *Client) RITOffset(trx int) (int, error)

RITOffset reads the RIT offset in Hz for the given TRX.

func (*Client) RXANCEnable added in v0.3.0

func (c *Client) RXANCEnable(trx int) (bool, error)

RXANCEnable reads the given TRX's automatic noise cancellation enable state. (since TCI 1.6)

func (*Client) RXANFEnable added in v0.3.0

func (c *Client) RXANFEnable(trx int) (bool, error)

RXANFEnable reads the given TRX's automatic notch filter enable state. (since TCI 1.6)

func (*Client) RXAPFEnable added in v0.3.0

func (c *Client) RXAPFEnable(trx int) (bool, error)

RXANFEnable reads the given TRX's analogue peak filter enable state. (since TCI 1.6)

func (*Client) RXBalance

func (c *Client) RXBalance(trx int, vfo VFO) (int, error)

RXBalance reads the given TRX's channel balance in dB (range from -40dB to 40dB).

func (*Client) RXBinEnable added in v0.3.0

func (c *Client) RXBinEnable(trx int) (bool, error)

RXBinEnable reads the given TRX's pseudo stereo enable state. (since TCI 1.6)

func (*Client) RXChannelEnable

func (c *Client) RXChannelEnable(trx int, vfo VFO) (bool, error)

RXChannelEnable reads the enable state of the given TRX's additional RX channel with the given index.

func (*Client) RXDSEEnable added in v0.3.0

func (c *Client) RXDSEEnable(trx int) (bool, error)

RXDSEEnable reads the given TRX's digital surround sound effect enable state. (since TCI 1.6)

func (*Client) RXEnable

func (c *Client) RXEnable(trx int) (bool, error)

RXEnable reads the RX enable state of the given TRX.

func (*Client) RXFilterBand

func (c *Client) RXFilterBand(trx int) (int, int, error)

RXFilterBand reads the IF filter boundaries of the given TRX.

func (*Client) RXMute

func (c *Client) RXMute(trx int) (bool, error)

RXMute reads given TRX's receiver mute state.

func (*Client) RXNBEnable added in v0.3.0

func (c *Client) RXNBEnable(trx int) (bool, error)

RXNBEnable reads the given TRX's noise blanker enable state. (since TCI 1.6)

func (*Client) RXNBParams added in v0.3.0

func (c *Client) RXNBParams(trx int) (int, int, error)

RXNBParams reads the given TRX's noise blanker parameters. (since TCI 1.6)

func (*Client) RXNFEnable added in v0.3.0

func (c *Client) RXNFEnable(trx int) (bool, error)

RXNFEnable reads the given TRX's band notch filters enable state. (since TCI 1.6)

func (*Client) RXNREnable added in v0.3.0

func (c *Client) RXNREnable(trx int) (bool, error)

RXNREnable reads the given TRX's noise reduction enable state. (since TCI 1.6)

func (*Client) RXSMeter

func (c *Client) RXSMeter(trx int, vfo VFO) (int, error)

RXSMeter reads the signal level of the given TRX's RX channel with the given index.

func (*Client) RXVolume

func (c *Client) RXVolume(trx int, vfo VFO) (int, error)

RXVolume reads the given TRX's channel volume in dB (range from -60dB to 0dB).

func (*Client) Ready

func (c *Client) Ready()

Ready handles the READY; message coming from the TCI host. Should not be called from outside!

func (*Client) SendCWMacro

func (c *Client) SendCWMacro(trx int, text string) error

SendCWMacro sends the given text, which may contain macro characters <. >, and | to change the speed and send abbreviations.

func (*Client) SendCWMessage

func (c *Client) SendCWMessage(trx int, before string, callsign string, after string) error

SendCWMessage sends the given text, allowing to changes the callsign as long as it was not transmitted yet.

func (*Client) SendCallsign

func (c *Client) SendCallsign(callsign string) error

SendCallsign changes the callsign of a previous SendCWMessage call, if the callsign was not transmitted yet.

func (*Client) SendTXAudio

func (c *Client) SendTXAudio(trx int, sampleRate AudioSampleRate, samples []float32) error

SendTXAudio sends the given samples as reply to a TXChrono message. The samples need to be in stereo, i.e. channel 1 and channel 2 interleaved.

func (*Client) SetAudioSampleRate

func (c *Client) SetAudioSampleRate(sampleRate AudioSampleRate) error

SetAudioSampleRate sets sample rate for Audio data.

func (*Client) SetCTCSSEnable

func (c *Client) SetCTCSSEnable(trx int, muted bool) error

SetCTCSSEnable enables CTCSS for the given TRX.

func (*Client) SetCTCSSLevel

func (c *Client) SetCTCSSLevel(trx int, percent int) error

SetCTCSSLevel sets the given TRX's CTCSS subtone level for transmitting in percent.

func (*Client) SetCTCSSMode

func (c *Client) SetCTCSSMode(trx int, mode CTCSSMode) error

SetCTCSSMode sets the CTCSS mode of the given TRX.

func (*Client) SetCTCSSRXTone

func (c *Client) SetCTCSSRXTone(trx int, tone CTCSSTone) error

SetCTCSSRXTone sets the given TRX's CTCSS subtone for receiving.

func (*Client) SetCTCSSTXTone

func (c *Client) SetCTCSSTXTone(trx int, tone CTCSSTone) error

SetCTCSSTXTone sets the given TRX's CTCSS subtone for transmitting.

func (*Client) SetCWMacrosDelay

func (c *Client) SetCWMacrosDelay(delay int) error

SetCWMacrosDelay sets the delay between keying the TRX and transmitting a CW macros in milliseconds.

func (*Client) SetCWMacrosSpeed

func (c *Client) SetCWMacrosSpeed(wpm int) error

SetCWMacrosSpeed sets the speed in WPM for CW macros.

func (*Client) SetCWTerminal added in v0.3.0

func (c *Client) SetCWTerminal(enabled bool) error

SetCWTerminal enables/disables the terminal mode for CW transmission (since TCI 1.5)

func (*Client) SetDDS

func (c *Client) SetDDS(trx int, frequency int) error

SetDDS sets the center frequency of the given TRX's panorama.

func (*Client) SetDrive

func (c *Client) SetDrive(percent int) error

SetDrive sets the output power in percent. Starting from TCI version 1.5, this command affects TRX 0.

func (*Client) SetECoderSwitchChannel

func (c *Client) SetECoderSwitchChannel(ecoder int, vfo VFO) error

SetECoderSwitchChannel assigns the given channel's control to the given E-Coder.

func (*Client) SetECoderSwitchRX

func (c *Client) SetECoderSwitchRX(ecoder int, trx int) error

SetECoderSwitchRX assigns the given TRX's control to the given E-Coder.

func (*Client) SetIF

func (c *Client) SetIF(trx int, vfo VFO, frequency int) error

SetIF sets the tuning frequency of the given TRX's vfo.

func (*Client) SetIQSampleRate

func (c *Client) SetIQSampleRate(sampleRate IQSampleRate) error

SetIQSampleRate sets sample rate for IQ data.

func (*Client) SetMode

func (c *Client) SetMode(trx int, mode Mode) error

SetMode sets the mode of the given TRX.

func (*Client) SetMute

func (c *Client) SetMute(muted bool) error

SetMute mutes the main volume.

func (*Client) SetRITEnable

func (c *Client) SetRITEnable(trx int, enabled bool) error

SetRITEnable enables the RIT of the given TRX.

func (*Client) SetRITOffset

func (c *Client) SetRITOffset(trx int, offset int) error

SetRITOffset sets the RIT offset in Hz for the given TRX.

func (*Client) SetRXANCEnable added in v0.3.0

func (c *Client) SetRXANCEnable(trx int, enabled bool) error

SetRXANCEnable enables/disables the given TRX's automatic noise cancellation. (since TCI 1.6)

func (*Client) SetRXANFEnable added in v0.3.0

func (c *Client) SetRXANFEnable(trx int, enabled bool) error

SetRXANFEnable enables/disables the given TRX's automatic notch filter. (since TCI 1.6)

func (*Client) SetRXAPFEnable added in v0.3.0

func (c *Client) SetRXAPFEnable(trx int, enabled bool) error

SetRXAPFEnable enables/disables the given TRX's analogue peak filter. (since TCI 1.6)

func (*Client) SetRXBalance

func (c *Client) SetRXBalance(trx int, vfo VFO, dB int) error

SetRXBalance sets the given TRX's channel balance in dB (range from -40dB to 40dB).

func (*Client) SetRXBinEnable added in v0.3.0

func (c *Client) SetRXBinEnable(trx int, enabled bool) error

SetRXBinEnable enables/disables the given TRX's pseudo stereo for CW. (since TCI 1.6)

func (*Client) SetRXChannelEnable

func (c *Client) SetRXChannelEnable(trx int, vfo VFO, enabled bool) error

SetRXChannelEnable enables the given TRX's additional RX channel with the given index.

func (*Client) SetRXDSEEnable added in v0.3.0

func (c *Client) SetRXDSEEnable(trx int, enabled bool) error

SetRXDSEEnable enables/disables the given TRX's digital surround sound effect. (since TCI 1.6)

func (*Client) SetRXEnable

func (c *Client) SetRXEnable(trx int, enabled bool) error

SetRXEnable enables the RX of the given TRX.

func (*Client) SetRXFilterBand

func (c *Client) SetRXFilterBand(trx int, min, max int) error

SetRXFilterBand sets the IF filter boundaries of the given TRX using the given limit frequencies in Hz.

func (*Client) SetRXMute

func (c *Client) SetRXMute(trx int, muted bool) error

SetRXMute mutes the given TRX's receiver.

func (*Client) SetRXNBEnable added in v0.3.0

func (c *Client) SetRXNBEnable(trx int, enabled bool) error

SetRXNBEnable enables/disables the given TRX's noise blanker. (since TCI 1.6)

func (*Client) SetRXNBParams added in v0.3.0

func (c *Client) SetRXNBParams(trx int, threshold int, impulseLength int) error

SetRXNBParams sets the given TRX's noise blanker parameters. (since TCI 1.6)

func (*Client) SetRXNFEnable added in v0.3.0

func (c *Client) SetRXNFEnable(trx int, enabled bool) error

SetRXNFEnable enables/disables the given TRX's band notch filters. (since TCI 1.6)

func (*Client) SetRXNREnable added in v0.3.0

func (c *Client) SetRXNREnable(trx int, enabled bool) error

SetRXNREnable enables/disables the given TRX's noise reduction. (since TCI 1.6)

func (*Client) SetRXSMeter

func (c *Client) SetRXSMeter(trx int, vfo VFO, level int) error

SetRXSMeter sets the signal level of the given TRX's RX channel with the given index.

func (*Client) SetRXSensorsEnable added in v0.3.0

func (c *Client) SetRXSensorsEnable(enabled bool, milliseconds int) error

SetRXSensorsEnable enables/disables the sharing of receiver sensor readings with the given interval in milliseconds. (since TCI 1.5)

func (*Client) SetRXVolume

func (c *Client) SetRXVolume(trx int, vfo VFO, dB int) error

SetRXVolume sets the given TRX's channel volume in dB (range from -60dB to 0dB).

func (*Client) SetSplitEnable

func (c *Client) SetSplitEnable(trx int, enabled bool) error

SetSplitEnable enables the split mode of the given TRX. When split mode is enabled, VFOB is used for transmitting.

func (*Client) SetSquelchEnable

func (c *Client) SetSquelchEnable(trx int, enabled bool) error

SetSquelchEnable enables the given TRX's squelch.

func (*Client) SetSquelchLevel

func (c *Client) SetSquelchLevel(dB int) error

SetSquelchLevel sets given TRX's squelch threshold in dB (range from -140dB to 0dB).

func (*Client) SetTRXDrive added in v0.3.0

func (c *Client) SetTRXDrive(trx int, percent int) error

SetTRXDrive sets the output power for a certain TRX in percent. (since TCI 1.5)

func (*Client) SetTRXTuneDrive added in v0.3.0

func (c *Client) SetTRXTuneDrive(trx int, percent int) error

SetTRXTuneDrive sets the output power for tuning for a certain TRX in percent. (since TCI 1.5)

func (*Client) SetTX

func (c *Client) SetTX(trx int, enabled bool, source SignalSource) error

SetTX enables the TX of the given TRX using the given signal source. Use "" (SignalSourceDefault) if you want to use the default source for the current mode.

func (*Client) SetTXSensorsEnable added in v0.3.0

func (c *Client) SetTXSensorsEnable(enabled bool, milliseconds int) error

SetTXSensorsEnable enables/disables the sharing of transmitter sensor readings with the given interval in milliseconds. (since TCI 1.5)

func (*Client) SetTimeout

func (c *Client) SetTimeout(timeout time.Duration)

SetTimeout sets the duration to wait for the reply to a command.

func (*Client) SetTune

func (c *Client) SetTune(trx int, enabled bool) error

SetTune enables the given TRX's transmitter in tuning.

func (*Client) SetTuneDrive

func (c *Client) SetTuneDrive(percent int) error

SetTuneDrive sets the output power for tuning in percent.

func (*Client) SetVFOFrequency

func (c *Client) SetVFOFrequency(trx int, vfo VFO, frequency int) error

SetVFOFrequency sets the tuning frequency of the given TRX's vfo.

func (*Client) SetVolume

func (c *Client) SetVolume(dB int) error

SetVolume sets the main volume in dB (range from -60dB to 0dB).

func (*Client) SetXITEnable

func (c *Client) SetXITEnable(trx int, enabled bool) error

SetXITEnable enables the XIT of the given TRX.

func (*Client) SetXITOffset

func (c *Client) SetXITOffset(trx int, offset int) error

SetXITOffset sets the XIT offset in Hz for the given TRX.

func (*Client) SplitEnable

func (c *Client) SplitEnable(trx int) (bool, error)

SplitEnable reads the split mode enable state of the given TRX. When split mode is enabled, VFOB is used for transmitting.

func (*Client) SquelchEnable

func (c *Client) SquelchEnable(trx int) (bool, error)

SquelchEnable reads the enable state of the given TRX's squelch.

func (*Client) SquelchLevel

func (c *Client) SquelchLevel() (int, error)

SquelchLevel reads the given TRX's squelch threshold in dB (range from -140dB to 0dB).

func (*Client) Start

func (c *Client) Start() error

Start the SDR operation.

func (*Client) StartAudio

func (c *Client) StartAudio(trx int) error

StartAudio starts the transmission of audio data for the given TRX.

func (*Client) StartIQ

func (c *Client) StartIQ(trx int) error

StartIQ starts the transmission of IQ data for the given TRX.

func (*Client) Stop

func (c *Client) Stop() error

Stop the SDR operation.

func (*Client) StopAudio

func (c *Client) StopAudio(trx int) error

StopAudio stops the transmission of audio data for the given TRX.

func (*Client) StopCW

func (c *Client) StopCW() error

StopCW stops the current CW transmission.

func (*Client) StopIQ

func (c *Client) StopIQ(trx int) error

StopIQ stops the transmission of IQ data for the given TRX.

func (*Client) TRXDrive added in v0.3.0

func (c *Client) TRXDrive(trx int) (int, error)

TRXDrive reads the output power of a certain TRX in percent. (since TCI 1.5)

func (*Client) TRXTuneDrive added in v0.3.0

func (c *Client) TRXTuneDrive(trx int) (int, error)

TRXTuneDrive reads the output power for tuning of a certain TRX in percent. (since TCI 1.5)

func (*Client) TX

func (c *Client) TX(trx int) (bool, error)

TX reads the current state of the given TRX's transmitter.

func (*Client) Timeout

func (c *Client) Timeout() time.Duration

Timeout is the duration to wait for the reply to a command.

func (*Client) Tune

func (c *Client) Tune(trx int) (bool, error)

Tune reads the current state of the given TRX's tuning transmitter.

func (*Client) TuneDrive

func (c *Client) TuneDrive() (int, error)

TuneDrive reads the output power for tuning in percent.

func (*Client) VFOFrequency

func (c *Client) VFOFrequency(trx int, vfo VFO) (int, error)

VFOFrequency reads the tuning frequency of the given TRX's vfo.

func (*Client) Volume

func (c *Client) Volume() (int, error)

Volume reads the main volume in dB (range from -60dB to 0dB).

func (*Client) WhenDisconnected

func (c *Client) WhenDisconnected(f func())

WhenDisconnected calls the given function when the client gets disconnected.

func (*Client) XITEnable

func (c *Client) XITEnable(trx int) (bool, error)

XITEnable reads the XIT enable state of the given TRX.

func (*Client) XITOffset

func (c *Client) XITOffset(trx int) (int, error)

XITOffset reads the XIT offset in Hz for the given TRX.

type ConnectionListener

type ConnectionListener interface {
	Connected(connected bool)
}

ConnectionListener is notified when the TCI connection is established or disconnected.

type ConnectionListenerFunc

type ConnectionListenerFunc func(bool)

ConnectionListenerFunc wraps a function with the ConnectionListener interface.

func (ConnectionListenerFunc) Connected

func (f ConnectionListenerFunc) Connected(connected bool)

Implements the ConnectionListener interface.

type DDSListener

type DDSListener interface {
	SetDDS(trx int, frequency int)
}

A DDSListener is notified when a DDS message is received from the TCI server.

type DeviceInfo

type DeviceInfo struct {
	DeviceName      string
	ProtocolName    string
	ProtocolVersion string
	MinVFOFrequency int
	MaxVFOFrequency int
	MinIFFrequency  int
	MaxIFFrequency  int
	TRXCount        int
	ChannelCount    int
	RXOnly          bool
	Modes           []Mode
}

DeviceInfo contains the basic information about the SunSDR device which are transmitted when the TCI connection is established. This information cannot be requested through TCI, so it is automatically collected by the client and provided through this type.

func (*DeviceInfo) SetChannelCount

func (d *DeviceInfo) SetChannelCount(count int)

SetChannelCount handles the CHANNEL_COUNT message.

func (*DeviceInfo) SetDeviceName

func (d *DeviceInfo) SetDeviceName(name string)

SetDeviceName handles the DEVICE message.

func (*DeviceInfo) SetIFLimits

func (d *DeviceInfo) SetIFLimits(min int, max int)

SetIFLimits handles the IF_LIMITS message.

func (*DeviceInfo) SetModes

func (d *DeviceInfo) SetModes(modes []Mode)

SetModes handles the MODULATIONS_LIST message.

func (*DeviceInfo) SetProtocol

func (d *DeviceInfo) SetProtocol(name string, version string)

SetProtocol handles the PROTOCOL message.

func (*DeviceInfo) SetRXOnly

func (d *DeviceInfo) SetRXOnly(value bool)

SetRXOnly handles the RECEIVE_ONLY message.

func (*DeviceInfo) SetTRXCount

func (d *DeviceInfo) SetTRXCount(count int)

SetTRXCount handles the TRX_COUNT message.

func (*DeviceInfo) SetVFOLimits

func (d *DeviceInfo) SetVFOLimits(min int, max int)

SetVFOLimits handles the VFO_LIMITS message.

type DeviceNameListener

type DeviceNameListener interface {
	SetDeviceName(name string)
}

A DeviceNameListener is notified when a DEVICE message is received from the TCI server.

type DriveListener

type DriveListener interface {
	SetDrive(percent int)
}

A DriveListener is notified when a DRIVE message is received from the TCI server.

type ECoderSwitchChannelListener

type ECoderSwitchChannelListener interface {
	SetECoderSwitchChannel(ecoder int, vfo VFO)
}

A ECoderSwitchChannelListener is notified when a ECODER_SWITCH_CHANNEL message is received from the TCI server.

type ECoderSwitchRXListener

type ECoderSwitchRXListener interface {
	SetECoderSwitchRX(ecoder int, trx int)
}

A ECoderSwitchRXListener is notified when a EXODER_SWITCH_RX message is received from the TCI server.

type IFLimitsListener

type IFLimitsListener interface {
	SetIFLimits(min, max int)
}

An IFLimitsListener is notified when an IF_LIMITS message is received from the TCI server.

type IFListener

type IFListener interface {
	SetIF(trx int, vfo VFO, frequency int)
}

An IFListener is notified when an IF_LIMITS message is received from the TCI server.

type IQDataListener

type IQDataListener interface {
	IQData(trx int, sampleRate IQSampleRate, data []float32)
}

A IQDataListener is notified when IQ data is received from the TCI server.

type IQSampleRate

type IQSampleRate int

IQSampleRate represents the sample rate for IQ data in samples per second.

type IQSampleRateListener

type IQSampleRateListener interface {
	SetIQSampleRate(sampleRate IQSampleRate)
}

A IQSampleRateListener is notified when a IQ_SAMPLERATE message is received from the TCI server.

type Message

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

Message represents a message that is exchanged between the TCI server and a client.

func NewCommandMessage added in v0.2.1

func NewCommandMessage(name string, args ...interface{}) Message

NewCommandMessage returns a new message with the given name and the given arguments that does not require a response.

func NewRequestMessage added in v0.2.1

func NewRequestMessage(name string, args ...interface{}) Message

NewRequestMessage returns a new message with the given name and the given arguments that requires a response.

func ParseTextMessage

func ParseTextMessage(s string) (Message, error)

ParseMessage interprets the given string as a TCI message.

func (Message) Args

func (m Message) Args() []string

Args of the message

func (Message) IsReplyTo

func (m Message) IsReplyTo(o Message) bool

IsReplyTo indicates if this message is a reply to the given message.

func (Message) Name

func (m Message) Name() string

Name of the message

func (Message) String

func (m Message) String() string

func (Message) ToBool

func (m Message) ToBool(i int) (bool, error)

ToBool returns the argument with the given index as boolean.

func (Message) ToFloat

func (m Message) ToFloat(i int) (float64, error)

ToFloat returns the argument with the given index as float.

func (Message) ToInt

func (m Message) ToInt(i int) (int, error)

ToInt returns the argument with the given index as integer.

func (Message) ToString

func (m Message) ToString(i int) (string, error)

ToString returns the argument with the given index as string.

type MessageListener

type MessageListener interface {
	Message(msg Message)
}

MessageListener is notified when any text message is received from the TCI server.

type Mode

type Mode string

Mode represents the modulation type of a TRX.

type ModeListener

type ModeListener interface {
	SetMode(trx int, mode Mode)
}

A ModeListener is notified when a MODULATION message is received from the TCI server.

type ModesListener

type ModesListener interface {
	SetModes(modes []Mode)
}

A ModesListener is notified when a MODULATIONS_LIST message is received from the TCI server.

type MuteListener

type MuteListener interface {
	SetMute(muted bool)
}

A MuteListener is notified when a MUTE message is received from the TCI server.

type ProtocolListener

type ProtocolListener interface {
	SetProtocol(name string, version string)
}

A ProtocolListener is notified when a PROTOCOL message is received from the TCI server.

type RITEnableListener

type RITEnableListener interface {
	SetRITEnable(trx int, enabled bool)
}

A RITEnableListener is notified when a RIT_ENABLE message is received from the TCI server.

type RITOffsetListener

type RITOffsetListener interface {
	SetRITOffset(trx int, offset int)
}

A RITOffsetListener is notified when a RIT_OFFSET message is received from the TCI server.

type RXANCEnableListener added in v0.3.0

type RXANCEnableListener interface {
	SetRXANCEnable(trx int, enabled bool)
}

A RXANCEnableListener is notified when a RX_ANC_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXANFEnableListener added in v0.3.0

type RXANFEnableListener interface {
	SetRXANFEnable(trx int, enabled bool)
}

A RXANFEnableListener is notified when a RX_ANF_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXAPFEnableListener added in v0.3.0

type RXAPFEnableListener interface {
	SetRXAPFEnable(trx int, enabled bool)
}

A RXAPFEnableListener is notified when a RX_APF_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXAudioListener

type RXAudioListener interface {
	RXAudio(trx int, sampleRate AudioSampleRate, samples []float32)
}

A RXAudioListener is notified when RX audio data is received from the TCI server.

type RXBalanceListener

type RXBalanceListener interface {
	SetRXBalance(trx int, vfo VFO, dB int)
}

A RXBalanceListener is notified when a RX_BALANCE message is received from the TCI server.

type RXBinEnableListener added in v0.3.0

type RXBinEnableListener interface {
	SetRXBinEnable(trx int, enabled bool)
}

A RXBinEnableListener is notified when a RX_BIN_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXChannelEnableListener

type RXChannelEnableListener interface {
	SetRXChannelEnable(trx int, vfo VFO, enabled bool)
}

A RXChannelEnableListener is notified when a RX_CHANNEL_ENABLE message is received from the TCI server.

type RXDSEEnableListener added in v0.3.0

type RXDSEEnableListener interface {
	SetRXDSEEnable(trx int, enabled bool)
}

A RXDSEEnableListener is notified when a RX_DSE_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXEnableListener

type RXEnableListener interface {
	SetRXEnable(trx int, enabled bool)
}

A RXEnableListener is notified when a RX_ENABLE message is received from the TCI server.

type RXFilterBandListener

type RXFilterBandListener interface {
	SetRXFilterBand(trx int, min, max int)
}

A RXFilterBandListener is notified when a RX_FILTER_BAND message is received from the TCI server.

type RXMuteListener

type RXMuteListener interface {
	SetRXMute(trx int, muted bool)
}

A RXMuteListener is notified when a RX_MUTE message is received from the TCI server.

type RXNBEnableListener added in v0.3.0

type RXNBEnableListener interface {
	SetRXNBEnable(trx int, enabled bool)
}

A RXNBEnableListener is notified when a RX_NB_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXNBParamsListener added in v0.3.0

type RXNBParamsListener interface {
	SetRXNBParams(trx int, threshold int, impulseLength int)
}

A RXNBParamsListener is notified when a RX_NB_PARAM message is received from the TCI server. (since TCI 1.6)

type RXNFEnableListener added in v0.3.0

type RXNFEnableListener interface {
	SetRXNFEnable(trx int, enabled bool)
}

A RXNFEnableListener is notified when a RX_NF_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXNREnableListener added in v0.3.0

type RXNREnableListener interface {
	SetRXNREnable(trx int, enabled bool)
}

A RXNREnableListener is notified when a RX_NR_ENABLE message is received from the TCI server. (since TCI 1.6)

type RXOnlyListener

type RXOnlyListener interface {
	SetRXOnly(value bool)
}

A RXOnlyListener is notified when a RECEIVE_ONLY message is received from the TCI server.

type RXSMeterListener

type RXSMeterListener interface {
	SetRXSMeter(trx int, vfo VFO, level int)
}

A RXSMeterListener is notified when a RX_SMETER message is received from the TCI server.

type RXSensorsListener added in v0.3.0

type RXSensorsListener interface {
	SetRXSensors(trx int, dBm float64)
}

A RXSensorsListener is notified when a RX_SENSORS message is received from the TCI server. (since TCI 1.5)

type RXVolumeListener

type RXVolumeListener interface {
	SetRXVolume(trx int, vfo VFO, dB int)
}

A RXVolumeListener is notified when a RX_VOLUME message is received from the TCI server.

type ReadyListener

type ReadyListener interface {
	Ready()
}

A ReadyListener is notified when a READY message is received from the TCI server.

type SignalSource

type SignalSource string

SignalSource represents the source of the TX audio signal.

type SplitEnableListener

type SplitEnableListener interface {
	SetSplitEnable(trx int, enabled bool)
}

A SplitEnableListener is notified when a SPLIT_ENABLE message is received from the TCI server.

type SquelchEnableListener

type SquelchEnableListener interface {
	SetSquelchEnable(trx int, enabled bool)
}

A SquelchEnableListener is notified when a SQL_ENABLE message is received from the TCI server.

type SquelchLevelListener

type SquelchLevelListener interface {
	SetSquelchLevel(dB int)
}

A SquelchLevelListener is notified when a SQL_LEVEL message is received from the TCI server.

type StartAudioListener

type StartAudioListener interface {
	StartAudio(trx int)
}

A StartAudioListener is notified when a AUDIO_START message is received from the TCI server.

type StartIQListener

type StartIQListener interface {
	StartIQ(trx int)
}

A StartIQListener is notified when a IQ_START message is received from the TCI server.

type StartListener

type StartListener interface {
	Start()
}

A StartListener is notified when a START message is received from the TCI server.

type StopAudioListener

type StopAudioListener interface {
	StopAudio(trx int)
}

A StopAudioListener is notified when a AUDIO_STOP message is received from the TCI server.

type StopIQListener

type StopIQListener interface {
	StopIQ(trx int)
}

A StopIQListener is notified when a IQ_STOP message is received from the TCI server.

type StopListener

type StopListener interface {
	Stop()
}

A StopListener is notified when a STOP message is received from the TCI server.

type TRXCountListener

type TRXCountListener interface {
	SetTRXCount(count int)
}

A TRXCountListener is notified when a TRX_COUNT message is received from the TCI server.

type TRXDriveListener added in v0.3.0

type TRXDriveListener interface {
	SetTRXDrive(trx int, percent int)
}

A TRXDriveListener is notified when a DRIVE message for a certain TRX is received from the TCI server. (since TCI 1.5)

type TRXTuneDriveListener added in v0.3.0

type TRXTuneDriveListener interface {
	SetTRXTuneDrive(trx int, percent int)
}

A TRXTuneDriveListener is notified when a TUNE_DRIVE message for a certain TRX is received from the TCI server.

type TXChronoListener

type TXChronoListener interface {
	TXChrono(trx int, sampleRate AudioSampleRate, requestedSampleCount uint32)
}

A TXChronoListener is notified when a TX chrono message is received from the TCI server.

type TXEnableListener

type TXEnableListener interface {
	SetTXEnable(trx int, enabled bool)
}

A TXEnableListener is notified when a TX_ENABLE message is received from the TCI server.

type TXFootswitchListener

type TXFootswitchListener interface {
	SetTXFootswitch(trx int, pressed bool)
}

A TXFootswitchListener is notified when a TX_FOOTSWITCH message is received from the TCI server.

type TXFrequencyListener added in v0.3.0

type TXFrequencyListener interface {
	SetTXFrequency(trx int, frequency int)
}

A TXFrequencyListener is notified when a TX_FREQUENCY message is received from the TCI server. (since TCI 1.6)

type TXListener

type TXListener interface {
	SetTX(trx int, enabled bool)
}

A TXListener is notified when a TRX message is received from the TCI server.

type TXPowerListener

type TXPowerListener interface {
	SetTXPower(watts float64)
}

A TXPowerListener is notified when a TX_POWER message is received from the TCI server.

type TXSWRListener

type TXSWRListener interface {
	SetTXSWR(ratio float64)
}

A TXSWRListener is notified when a TX_SWR message is received from the TCI server.

type TXSensorsListener added in v0.3.0

type TXSensorsListener interface {
	SetTXSensors(trx int, micdBm float64, txRMS float64, txPeak float64, swr float64)
}

A TXSensorsListener is notified when a TX_SENSORS message is received from the TCI server. (since TCI 1.5)

type TuneDriveListener

type TuneDriveListener interface {
	SetTuneDrive(percent int)
}

A TuneDriveListener is notified when a TUNE_DRIVE message is received from the TCI server.

type TuneListener

type TuneListener interface {
	SetTune(trx int, enabled bool)
}

A TuneListener is notified when a TUNE message is received from the TCI server.

type VFO

type VFO int

VFO represents a VFO in TCI. In the TCI documentation the VFOs area also named "channel".

type VFOFrequencyListener

type VFOFrequencyListener interface {
	SetVFOFrequency(trx int, vfo VFO, frequency int)
}

A VFOFrequencyListener is notified when a VFO message is received from the TCI server.

type VFOLimitsListener

type VFOLimitsListener interface {
	SetVFOLimits(min, max int)
}

A VFOLimitsListener is notified when a VFO_LIMITS message is received from the TCI server.

type VolumeListener

type VolumeListener interface {
	SetVolume(dB int)
}

A VolumeListener is notified when a VOLUME message is received from the TCI server.

type XITEnableListener

type XITEnableListener interface {
	SetXITEnable(trx int, enabled bool)
}

A XITEnableListener is notified when a XIT_ENABLE message is received from the TCI server.

type XITOffsetListener

type XITOffsetListener interface {
	SetXITOffset(trx int, offset int)
}

A XITOffsetListener is notified when a XIT_OFFSET message is received from the TCI server.

Jump to

Keyboard shortcuts

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