nad

package
v0.0.0-...-1886b8e Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2018 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cmds

func Cmds() [25]string

Cmds returns all valid commands.

Types

type Client

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

Client reprensents a client to the amplifier.

func New

func New(name string) *Client

New creates a new client to the amplifier, using named device for communication.

func NewTestClient

func NewTestClient() *Client

NewTestClient creates a client that communicates with a simulated amp.

func (*Client) Close

func (n *Client) Close() error

Close closes the underlying device

func (*Client) Model

func (n *Client) Model() (Reply, error)

Model retrieves the amplifier model.

func (*Client) Mute

func (n *Client) Mute(enable bool) (Reply, error)

Mute mutes the amplifier.

func (*Client) Power

func (n *Client) Power(enable bool) (Reply, error)

Power turns the amplifier on/off.

func (*Client) Send

func (n *Client) Send(cmd []byte) ([]byte, error)

Send sends cmd to the amplifier without any preprocessing or validation.

func (*Client) SendCmd

func (n *Client) SendCmd(cmd Cmd) (Reply, error)

SendCmd validates and sends the command cmd to the amplifier.

func (*Client) SendString

func (n *Client) SendString(s string) (string, error)

SendString parses, validates and sends the command s.

func (*Client) Source

func (n *Client) Source(name string) (Reply, error)

Source sets the current audio source, specified by name

func (*Client) SpeakerA

func (n *Client) SpeakerA(enable bool) (Reply, error)

SpeakerA enables/disables output to speaker A.

func (*Client) SpeakerB

func (n *Client) SpeakerB(enable bool) (Reply, error)

SpeakerB enables/disables output to speaker B.

func (*Client) Tape1

func (n *Client) Tape1(enable bool) (Reply, error)

Tape1 enables/disables output to tape 1.

func (*Client) VolumeDown

func (n *Client) VolumeDown() (Reply, error)

VolumeDown decreases volume.

func (*Client) VolumeUp

func (n *Client) VolumeUp() (Reply, error)

VolumeUp increases volume.

type Cmd

type Cmd struct {
	Variable string
	Operator string
	Value    string
}

Cmd represents a command sent to the amplifier.

func ParseCmd

func ParseCmd(s string) (Cmd, error)

ParseCmd parses s into a command.

func (*Cmd) Bytes

func (c *Cmd) Bytes() []byte

Bytes returns a command as bytes.

func (*Cmd) Delimited

func (c *Cmd) Delimited() string

Delimited formats command before sending it to amplifier.

func (*Cmd) String

func (c *Cmd) String() string

String formats command as a string.

func (*Cmd) Valid

func (c *Cmd) Valid() bool

Valid returns true if command is a command accepted by amplifier.

type Reply

type Reply struct{ Cmd }

Reply represents an reply received from the amplifier. A reply has the same fields as a command.

func ParseReply

func ParseReply(b []byte) (Reply, error)

ParseReply parses b into a reply.

Jump to

Keyboard shortcuts

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