rotel

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_TTY         = "/dev/ttyUSB0"
	DEFAULT_TTY_BAUD    = 115200
	DEFAULT_TTY_TIMEOUT = 100 * time.Millisecond

	VOLUME_MIN = 1
	VOLUME_MAX = 96
)

Variables

View Source
var (
	SOURCES = []string{
		"pc_usb", "cd", "coax1", "coax2", "opt1", "opt2", "aux1", "aux2", "tuner", "phono", "usb", "bluetooth",
	}
)

Functions

This section is empty.

Types

type Config

type Config struct {
	TTY     string        `yaml:"tty"`
	Baud    uint          `yaml:"baud"`
	Timeout time.Duration `yaml:"timeout"`
}

type Event

type Event struct {
	Flag
	Err error
}

type Flag

type Flag uint16

Flag provides flags on state changes

const (
	ROTEL_FLAG_POWER Flag = (1 << iota)
	ROTEL_FLAG_VOLUME
	ROTEL_FLAG_MUTE
	ROTEL_FLAG_BASS
	ROTEL_FLAG_TREBLE
	ROTEL_FLAG_BALANCE
	ROTEL_FLAG_SOURCE
	ROTEL_FLAG_FREQ
	ROTEL_FLAG_BYPASS
	ROTEL_FLAG_SPEAKER
	ROTEL_FLAG_DIMMER
	ROTEL_FLAG_MODEL
	ROTEL_FLAG_NONE Flag = 0
	ROTEL_FLAG_MIN       = ROTEL_FLAG_POWER
	ROTEL_FLAG_MAX       = ROTEL_FLAG_DIMMER
)

func SetBalance

func SetBalance(this *state, args []string) (Flag, error)

func SetBass

func SetBass(this *state, args []string) (Flag, error)

func SetBypass

func SetBypass(this *state, args []string) (Flag, error)

func SetDimmer

func SetDimmer(this *state, args []string) (Flag, error)

func SetFreq

func SetFreq(this *state, args []string) (Flag, error)

func SetModel

func SetModel(this *state, args []string) (Flag, error)

func SetMute

func SetMute(this *state, args []string) (Flag, error)

func SetPower

func SetPower(this *state, args []string) (Flag, error)

func SetSource

func SetSource(this *state, args []string) (Flag, error)

func SetSpeaker

func SetSpeaker(this *state, args []string) (Flag, error)

func SetTreble

func SetTreble(this *state, args []string) (Flag, error)

func SetUpdateMode

func SetUpdateMode(this *state, args []string) (Flag, error)

func SetVolume

func SetVolume(this *state, args []string) (Flag, error)

func (Flag) FlagString

func (f Flag) FlagString() string

func (Flag) Is

func (f Flag) Is(flag Flag) bool

func (Flag) String

func (f Flag) String() string

type Rotel

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

func NewWithConfig

func NewWithConfig(cfg Config) (*Rotel, error)

func (*Rotel) Balance

func (this *Rotel) Balance() (string, uint)

func (*Rotel) Bass

func (this *Rotel) Bass() int

func (*Rotel) Bypass

func (this *Rotel) Bypass() bool

func (*Rotel) Dimmer

func (this *Rotel) Dimmer() uint

func (*Rotel) Freq

func (this *Rotel) Freq() string

func (*Rotel) Model

func (this *Rotel) Model() string

func (*Rotel) Muted

func (this *Rotel) Muted() bool

func (*Rotel) Power

func (this *Rotel) Power() bool

func (*Rotel) Run

func (self *Rotel) Run(ctx context.Context, ch chan<- Event) error

func (*Rotel) Set

func (this *Rotel) Set(param string) (Flag, error)

Set sets state from data coming from amp

func (*Rotel) SetPower

func (self *Rotel) SetPower(state bool) error

func (*Rotel) SetSource

func (self *Rotel) SetSource(value string) error

func (*Rotel) SetVolume

func (self *Rotel) SetVolume(value uint) error

func (*Rotel) Source

func (this *Rotel) Source() string

func (*Rotel) Speakers

func (this *Rotel) Speakers() []string

func (*Rotel) String

func (self *Rotel) String() string

func (*Rotel) Treble

func (this *Rotel) Treble() int

func (*Rotel) Update

func (this *Rotel) Update() string

Update returns a query to get state of an unknown value

func (*Rotel) Volume

func (this *Rotel) Volume() uint

Jump to

Keyboard shortcuts

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