simpleradio

package
v0.0.0-...-03c8f45 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

package simpleradio contains a bespoke SimpleRadio-Standalone client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Audio

type Audio []float32

type Client

type Client interface {
	// Run starts the SimpleRadio-Standalone client. It should be called exactly once.
	Run(context.Context, *sync.WaitGroup) error
	// Send sends a message to the SRS server.
	Send(types.Message) error
	// Receive returns a channel that receives transmissions over the radio. Each transmission is F32LE PCM audio data.
	Receive() <-chan Transmission
	// Transmit queues a transmission to send over the radio. The audio data should be in F32LE PCM format.
	Transmit(Transmission)
	// Frequencies returns the frequencies the client is listening on.
	Frequencies() []RadioFrequency
	// ClientsOnFrequency returns the number of peers on the client's frequencies.
	ClientsOnFrequency() int
	// HumansOnFrequency returns the number of human peers on the client's frequencies.
	// A human peer is any client whose name does not end with "[BOT]".
	HumansOnFrequency() int
	// BotsOnFrequency returns the number of bot peers on the client's frequencies.
	// A bot peer is any client whose name ends with "[BOT]".
	BotsOnFrequency() int
	// IsOnFrequency checks if the named unit is on any of the client's frequencies.
	IsOnFrequency(string) bool
}

Client is a SimpleRadio-Standalone client.

func NewClient

func NewClient(config types.ClientConfiguration) (Client, error)

type RadioFrequency

type RadioFrequency struct {
	Frequency  unit.Frequency
	Modulation types.Modulation
}

RadioFrequency selects a frequency and either AM or FM modulation.

func ParseRadioFrequency

func ParseRadioFrequency(s string) (*RadioFrequency, error)

ParseRadioFrequency parses a string into a RadioFrequency. The string should be a postive decimal number optionally followed by either "AM" or "FM". If the modulation is not recognized, it defaults to AM.

func (RadioFrequency) IsSameFrequency

func (f RadioFrequency) IsSameFrequency(other RadioFrequency) bool

func (RadioFrequency) String

func (f RadioFrequency) String() string

String representation of the RadioFrequency.

type Transmission

type Transmission struct {
	TraceID     string
	ClientName  string
	Frequencies []voice.Frequency
	Audio       Audio
}

Directories

Path Synopsis
package types contains types used by the SRS clients.
package types contains types used by the SRS clients.
package voice contains the types used by the SRS audio protocol to send and receive audio data over the network.
package voice contains the types used by the SRS audio protocol to send and receive audio data over the network.

Jump to

Keyboard shortcuts

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