Documentation
¶
Index ¶
- Variables
- type SerialAmplifier
- type State
- type Zone
- func (z *Zone) ID() string
- func (z *Zone) Refresh() error
- func (z *Zone) SetBalance(level int) error
- func (z *Zone) SetBass(level int) error
- func (z *Zone) SetMute(on bool) error
- func (z *Zone) SetPower(on bool) error
- func (z *Zone) SetSourceChannel(channelID int) error
- func (z *Zone) SetTreble(level int) error
- func (z *Zone) SetVolume(level int) error
- func (z *Zone) State() *State
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCommandCode is returned if an invalid command code is detected ErrInvalidCommandCode = errors.New("invalid command code") // ErrInvalidInput is detected if the command string format doesn't match as expected ErrInvalidInput = errors.New("invalid command string") )
var ( // ErrUnsupportedRange is returned if the requested parameter exceeds the supported range of inputs. ErrUnsupportedRange = errors.New("unsupported range") )
Functions ¶
This section is empty.
Types ¶
type SerialAmplifier ¶
type SerialAmplifier struct {
// contains filtered or unexported fields
}
SerialAmplifier is an implementation of the Monoprice amplifier backed by a serial port.
func NewSerialAmplifier ¶
func NewSerialAmplifier(port *serial.Port) (*SerialAmplifier, error)
NewSerialAmplifier creates a new serial amplifier using the supplied serial port. If the amplifier cannot be queried (i.e. if the port is not ready) an error will be returned.
func (*SerialAmplifier) ID ¶
func (a *SerialAmplifier) ID() int
ID returns the ID (1-3) of this amplifier.
func (*SerialAmplifier) Reset ¶
func (a *SerialAmplifier) Reset() error
Reset is used to clear the underlying serial port and reset things to a good state. This may be used if errors are detected on the port to clear any oddities being read. Any existing zone references will be invalidated and should not be used anymore.
func (*SerialAmplifier) Zone ¶
func (a *SerialAmplifier) Zone(id int) *Zone
Zone retrieves the cached state of the specified zone. If the underlying zone may have changed (using a wall controller, for example), then refresh should be called on the returned zone before using the data.
type State ¶
type State struct {
IsOn bool
IsMuteOn bool
IsDoNotDisturbOn bool
IsPAOn bool
Volume int
Treble int
Bass int
Balance int
SourceChannelID int
IsKeypadConnected bool
}
State contains the current state of a given zone, as retrieved from the controller.
type Zone ¶
type Zone struct {
// contains filtered or unexported fields
}
Zone represents a single output on a receiver.
func (*Zone) SetBalance ¶
SetBalance applies the supplied balance level to the zone.
func (*Zone) SetSourceChannel ¶
SetSourceChannel changes the source input used by the zone.