cwclient

package
v0.2.13 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: MIT Imports: 7 Imported by: 1

Documentation

Overview

Package cwclient provides a client library for the cwdaemon (https://github.com/acerion/cwdaemon) server application.

The client communicates with the cwdaemon server via UDP using the proprietary protocol defined in the cwdaemon documentation.

To run the cwdaemon locally for testing use the following command line: "cwdaemon -yi -xs -n -d null" This will start the cwdaemon as foreground process listening on port 6789, its output is written to stdout and stderr. To kill the process, hit Ctrl+C.

Index

Constants

View Source
const (
	SSBFromMicrophone = 0
	SSBFromSoundcard  = 1
)

The SSB sources supported by the cwdaemon

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a client for the cwdaemon server application.

func New

func New(hostname string, port int) (*Client, error)

New creates a new Client for a cwdaemon server running on the given hostname and port. If the hostname is empty, localhost will be used. If the port is 0, the default port 6789 will be used.

func NewDefault

func NewDefault() (*Client, error)

NewDefault returns a Client for a cwdaemon server running on localhost:6789.

func (*Client) Abort

func (client *Client) Abort()

Abort aborts the output of CW and discards all pending texts.

func (*Client) BandIndex

func (client *Client) BandIndex(bandIndex int)

BandIndex outputs the given band index on the pins 2 (lsb), 7, 8, 9 (msb) of the parport.

func (*Client) Connect

func (client *Client) Connect() error

Connect sets up a connection between the client and the server.

func (*Client) Device

func (client *Client) Device(device string)

Device sets the device for CW output, default is parport0.

func (*Client) Disconnect

func (client *Client) Disconnect()

Disconnect closes the connection between the client and the server.

func (*Client) IsConnected

func (client *Client) IsConnected() bool

IsConnected indicates if the client has an active connection to the server.

func (*Client) IsIdle

func (client *Client) IsIdle() bool

IsIdle returns true if there are no texts waiting on the server for output as CW.

func (*Client) PTT

func (client *Client) PTT(on bool)

PTT enables or disables the PTT keying.

func (*Client) PTTDelay

func (client *Client) PTTDelay(milliseconds int)

PTTDelay sets the PTT delay to the given duration in milliseconds [0..50].

func (*Client) Reset

func (client *Client) Reset()

Reset resets the server to the default values: speed = 24 WpM tone = 800 Hz sound = on wordmode = off weight = 0 UDP port = 6789 PTT delay = 0 (off) device = parport0 sound device = console buzzer

func (*Client) SSBSource

func (client *Client) SSBSource(source SSBSource)

SSBSource sets the source for the SSB signal either to microphone or soundcard.

func (*Client) Send

func (client *Client) Send(text string)

Send sends the given text to the server to be output it as CW.

func (*Client) Soundsystem

func (client *Client) Soundsystem(soundsystem Soundsystem)

Soundsystem instructs the cwdaemon to use the given soundsystem

func (*Client) Speed

func (client *Client) Speed(speed int)

Speed sets the speed to the given speed in WpM [5..60]

func (*Client) Tone

func (client *Client) Tone(tone int)

Tone sets the generated sidetone to the given frequency in Hz [300..1000]

func (*Client) ToneOff

func (client *Client) ToneOff()

ToneOff turns of the generated sidetone

func (*Client) Tune

func (client *Client) Tune(seconds int)

Tune tunes for the given duration in seconds [0..10].

func (*Client) Volume

func (client *Client) Volume(volume int)

Volume sets the volume of the generated sidetone [0..100].

func (*Client) Wait

func (client *Client) Wait()

Wait waits for all pending text to be output as CW.

func (*Client) Weight

func (client *Client) Weight(weight int)

Weight sets the weighting between dit and dah [-50..50].

func (*Client) Wordmode

func (client *Client) Wordmode()

Wordmode sets the cwdaemon server into the word mode

type SSBSource

type SSBSource int

SSBSource supported by cwdaemon

type Soundsystem

type Soundsystem string

Soundsystem supported by the cwdaemon

const (
	PCSpeaker  Soundsystem = "c"
	OSS        Soundsystem = "o"
	ALSA       Soundsystem = "a"
	PulseAudio Soundsystem = "p"
	None       Soundsystem = "n"
	Soundcard  Soundsystem = "s"
)

The Soundsystems supported by the cwdaemon

Jump to

Keyboard shortcuts

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