trx

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Rx          *chain.Chain
	Tx          *chain.Chain
	FromNetwork *pbReader.PbReader
	ToNetwork   *pbWriter.PbWriter
	Broker      broker.Broker
	Vox         *vox.Vox
}

Options is the data structure holding the values used for instantiating a Trx object. This struct has to be provided the the object constructor.

type Trx

type Trx struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Trx is a data structure which holds the components needed for a 2-way radio. It holds the available audio servers, the communication means, the audio rx and tx chains etc.

func NewTrx

func NewTrx(opts Options) (*Trx, error)

NewTrx is the constructor method of a Trx object.

func (*Trx) AddServer

func (x *Trx) AddServer(asvr *proxy.AudioServer)

AddServer adds a remote audio server, represented through a proxy object.

func (*Trx) RemoveServer

func (x *Trx) RemoveServer(asName string) error

RemoveServer removes a remote audio server from the Trx.

func (*Trx) RxState

func (x *Trx) RxState() (bool, error)

RxState returns a boolean if the remote audio server is streaming audio or not.

func (*Trx) RxVolume

func (x *Trx) RxVolume() (float32, error)

RxVolume returns the currently set volume for the local speakers.

func (*Trx) SelectServer

func (x *Trx) SelectServer(name string) error

SelectServer selects a particular remote audio server from which the audio will be received / sent to.

func (*Trx) SelectedServer

func (x *Trx) SelectedServer() string

SelectedServer returns the name of the currently selected Audio Server.

func (*Trx) Server

func (x *Trx) Server(name string) (*proxy.AudioServer, bool)

Server returns a particular AudioServer. If no AudioServer exists with that name, (nil, false) will be returned.

func (*Trx) Servers

func (x *Trx) Servers() []string

Servers returns a list with the names of the registered audio servers.

func (*Trx) SetNotifyServerChangeCb

func (x *Trx) SetNotifyServerChangeCb(f func())

SetNotifyServerChangeCb allows to set a callback which get's executed when a remote audio server changes / disappears.

func (*Trx) SetPTT

func (x *Trx) SetPTT(pttState bool) error

SetPTT (Push To Talk) turns on/off the audio stream sent to the remote audio server. In case VOX is active, the application will continue streaming audio to the server.

func (*Trx) SetRxState

func (x *Trx) SetRxState(on bool) error

SetRxState turns on/off the audio stream sent from the remote audio server.

func (*Trx) SetRxVolume

func (x *Trx) SetRxVolume(vol float32) error

SetRxVolume sets the volume of the local speakers.

func (*Trx) SetTxVolume

func (x *Trx) SetTxVolume(vol float32) error

SetTxVolume sets the volume of the audio sent to the remote audio server.

func (*Trx) SetVOX

func (x *Trx) SetVOX(voxState bool) error

SetVOX sets the vox. This method should not be exposed through the REST API.

func (*Trx) SetVOXEnabled

func (x *Trx) SetVOXEnabled(enable bool)

SetVOXEnabled enables the vox in the tx chain

func (*Trx) SetVOXHoldTime

func (x *Trx) SetVOXHoldTime(t time.Duration)

SetVOXHoldTime sets the vox hold time

func (*Trx) SetVOXThreshold

func (x *Trx) SetVOXThreshold(v float32)

SetVOXThreshold sets the vox threshold level

func (*Trx) TxState

func (x *Trx) TxState() (bool, error)

TxState returns a boolean if audio is currently sent to the remote audio server, or not.

func (*Trx) TxUser

func (x *Trx) TxUser() (string, error)

TxUser returns the current user from which the remote audio server is receiving audio. If nobody is transmitting / sending audio to the remote audio server, an empty string will be returned.

func (*Trx) TxVolume

func (x *Trx) TxVolume() (float32, error)

TxVolume returns the current volume level for the audio sent to the remote audio server.

func (*Trx) VOX

func (x *Trx) VOX() bool

VOX returns if the VOX is currently active

func (*Trx) VOXEnabled

func (x *Trx) VOXEnabled() bool

VOXEnabled indicates if the vox is enabled

func (*Trx) VOXHoldTime

func (x *Trx) VOXHoldTime() time.Duration

VOXHoldTime returns the vox hold time

func (*Trx) VOXThreshold

func (x *Trx) VOXThreshold() float32

VOXThreshold returns the vox threshold level

Jump to

Keyboard shortcuts

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