controller

package
v0.0.0-...-057713a Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ListControlSelect = listControlType("select")
	ListControlPlay   = listControlType("play")
	ListControlReturn = listControlType("return")
	ListControlPeek   = listControlType("peek")
)

Variables

View Source
var (
	InputSpotify   = inputType("spotify")
	InputDeezer    = inputType("deezer")
	InputTidal     = inputType("tidal")
	InputRadio     = inputType("net_radio")
	InputServer    = inputType("server")
	InputBluetooth = inputType("bluetooth")
)
View Source
var (
	RepeatOff     = repeatMode("off")
	RepeatOne     = repeatMode("one")
	RepeatAll     = repeatMode("all")
	ShuffleOff    = shuffleMode("off")
	ShuffleOn     = shuffleMode("on")
	ShuffleSongs  = shuffleMode("songs")
	ShuffleAlbums = shuffleMode("albums")
)
View Source
var (
	PlaybackPlay         = playbackMode("play")
	PlaybackStop         = playbackMode("stop")
	PlaybackPause        = playbackMode("pause")
	PlaybackToggle       = playbackMode("play_pause")
	PlaybackPrevious     = playbackMode("previous")
	PlaybackNext         = playbackMode("next")
	PlaybackSeekForward  = playbackMode("seek_forward")
	PlaybackSeekBackward = playbackMode("seek_backward")
)

Functions

This section is empty.

Types

type AttributeBit

type AttributeBit uint32
const (
	Playable AttributeBit = 1 << iota
	CapableOfStop
	CapableOfPause
	CapableOfPRevSkip
	CapableOfNextSkip
	CapableOfFastReverse
	CapableOfFastForward
	CapableOfRepeat
	CapableOfShuffle
	FeedbaclAvailable
	ThumbsUp
	ThumbsDown
	Video
	CapableOfBookmark
	CapableOfDRM
	StationPlayback
	ADPlayback
	SharedStation
	CapableOfAddTrack
	CapableOfAddAlbum
	ShuffleStation
	CapableOfAddChannel
	SamplePlayback
	MusicPlayPlayback
	CapableOfLinkDistribution
	CapableOfAddPlaylist
	CapableOfAddMusicCastPlaylist
)

type BluetoothDevice

type BluetoothDevice struct {
	Connected bool   `json:"connected"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	Address   string `json:"address"`
}

type BluetoothDeviceList

type BluetoothDeviceList struct {
	ResponseCode int               `json:"response_code"`
	Updating     bool              `json:"updating"`
	DeviceList   []BluetoothDevice `json:"device_list"`
}

type BluetoothInfo

type BluetoothInfo struct {
	ResponseCode int             `json:"response_code"`
	Standby      bool            `json:"bluetooth_standby"`
	TxSetting    bool            `json:"bluetooth_tx_setting"`
	Device       BluetoothDevice `json:"bluetooth_device"`
}

type Controller

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

func New

func New(zone string, srv Server) *Controller

New returns a new controller using the specified Zone and Server.

func (*Controller) ActivatePreset

func (c *Controller) ActivatePreset(ctx context.Context, num int) error

ActivatePreset activates the specified preset index (1 based!).

func (*Controller) BluetoothConnectDevice

func (c *Controller) BluetoothConnectDevice(ctx context.Context, addr string) error

BluetoothConnectDevice attempts to connect to the specified addr.

func (*Controller) BluetoothDisconnectDevice

func (c *Controller) BluetoothDisconnectDevice(ctx context.Context) error

BluetoothDisconnectDevice terminates the connection with the currently connected device.

func (*Controller) BluetoothUpdateDeviceList

func (c *Controller) BluetoothUpdateDeviceList(ctx context.Context) error

BluetoothUpdateDeviceList updates the BT device list.

func (*Controller) GetBlob

func (c *Controller) GetBlob(ctx context.Context, kind, key string) ([]byte, error)

func (*Controller) GetBluetoothDeviceList

func (c *Controller) GetBluetoothDeviceList(ctx context.Context) (*BluetoothDeviceList, error)

GetBluetoothDeviceList returns a list of known devices.

func (*Controller) GetBluetoothInfo

func (c *Controller) GetBluetoothInfo(ctx context.Context) (*BluetoothInfo, error)

GetBluetoothInfo returns the current BT operation mode of the device.

func (*Controller) GetDeviceInfo

func (c *Controller) GetDeviceInfo(ctx context.Context) (*DeviceInfo, error)

GetDeviceInfo returns discovered information about the currently connected device.

func (*Controller) GetFeatures

func (c *Controller) GetFeatures(ctx context.Context) (*Features, error)

func (*Controller) GetIP

func (c *Controller) GetIP() string

GetIP returns the current device IP.

func (*Controller) GetNetworkStatus

func (c *Controller) GetNetworkStatus(ctx context.Context) (*NetworkStatus, error)

func (*Controller) GetPlayInfo

func (c *Controller) GetPlayInfo(ctx context.Context) (*PlayInfo, error)

func (*Controller) GetPresets

func (c *Controller) GetPresets(ctx context.Context) (*PresetContainer, error)

GetPresets returns the presets (favourites) stored on the device.

func (*Controller) GetStatus

func (c *Controller) GetStatus(ctx context.Context) (*ZoneStatus, error)

func (*Controller) ListInfo

func (c *Controller) ListInfo(ctx context.Context, action listControlType, index, page int32, source inputType) (*ListInfoReply, error)

func (*Controller) PowerOff

func (c *Controller) PowerOff(ctx context.Context) error

PowerOff puts the device in standby mode.

func (*Controller) PowerOn

func (c *Controller) PowerOn(ctx context.Context) error

PowerOn turns the device on.

func (*Controller) PowerToggle

func (c *Controller) PowerToggle(ctx context.Context) error

PowerToggle toggles the standby state.

func (*Controller) SendUpnpPlay

func (c *Controller) SendUpnpPlay(ctx context.Context) error

func (*Controller) SendUpnpUrl

func (c *Controller) SendUpnpUrl(ctx context.Context, uri string) error

func (*Controller) SetBluetoothStandby

func (c *Controller) SetBluetoothStandby(ctx context.Context, enable bool) error

SetBluetoothStandby enables or disables the BT standby functionality.

func (*Controller) SetBluetoothTx

func (c *Controller) SetBluetoothTx(ctx context.Context, enable bool) error

SetBluetoothTx enables or disables BT transmission.

func (*Controller) SetInput

func (c *Controller) SetInput(ctx context.Context, input inputType) error

SetInput changes the device input to the given inputType.

func (*Controller) SetPlayPosition

func (c *Controller) SetPlayPosition(ctx context.Context, pos int) error

SetPlayPosition seeks in the currently playing track.

func (*Controller) SetPlayback

func (c *Controller) SetPlayback(ctx context.Context, mode playbackMode) error

SetPlayback changes the controllers playback mode.

func (*Controller) SetRepeat

func (c *Controller) SetRepeat(ctx context.Context, mode repeatMode) error

func (*Controller) SetShuffle

func (c *Controller) SetShuffle(ctx context.Context, mode shuffleMode) error

func (*Controller) SubscribeEvents

func (c *Controller) SubscribeEvents(ctx context.Context, port int) error

func (*Controller) VolumeChange

func (c *Controller) VolumeChange(ctx context.Context, step int) error

VolumeChange increases or decreases the volume by the specified amount.

func (*Controller) VolumeMute

func (c *Controller) VolumeMute(ctx context.Context, muted bool) error

VolumeMute mutes or unmutes the device.

func (*Controller) VolumeSet

func (c *Controller) VolumeSet(ctx context.Context, val int64) error

VolumeSet performs an absolute volume change.

type DeviceInfo

type DeviceInfo struct {
	ResponseCode  int     `json:"response_code"`
	ModelName     string  `json:"model_name"`
	RegionCode    string  `json:"destination"`
	DeviceId      string  `json:"device_id"`
	SystemVersion float32 `json:"system_version"`
	SystemId      string  `json:"system_id"`
}

type Features

type Features struct {
	ResponseCode int            `json:"response_code"`
	System       SystemFeatures `json:"system"`
	Zone         []SystemZone   `json:"zone"`
	Clock        SystemClock    `json:"clock"`
}

type ListInfoItem

type ListInfoItem struct {
	Index      int32  `json:"index"`
	Text       string `json:"text"`
	Thumbnail  string `json:"thumbnail"`
	Playable   bool   `json:"playable"`
	Selectable bool   `json:"selectable"`
	Searchable bool   `json:"searchable"`
	NowPlaying bool   `json:"now_playing"`
}

type ListInfoReply

type ListInfoReply struct {
	MenuName string         `json:"menu_name"`
	Input    string         `json:"input"`
	Layer    int32          `json:"menu_layer"`
	Pages    int32          `json:"pages"`
	Items    []ListInfoItem `json:"items"`
}

type NetworkStatus

type NetworkStatus struct {
	NetworkName string `json:"network_name"`
	Connection  string `json:"connection"`
	IP          string `json:"ip_address"`
	Netmask     string `json:"subnet_mask"`
	Gateway     string `json:"default_gateway"`
	DNS1        string `json:"dns_server_1"`
	DNS2        string `json:"dns_server_2"`
}

type PlayInfo

type PlayInfo struct {
	ResponseCode     int          `json:"response_code"`
	Input            string       `json:"input"`
	Playback         string       `json:"playback"`
	Repeat           string       `json:"repeat"`
	Shuffle          string       `json:"shuffle"`
	PlayTime         int64        `json:"play_time"`
	TotalTime        int64        `json:"total_time"`
	Artist           string       `json:"artist"`
	Album            string       `json:"album"`
	Track            string       `json:"track"`
	AlbumartURL      string       `json:"albumart_url"`
	AutoStopped      bool         `json:"auto_stopped"`
	SeekBackwardStep int64        `json:"seek_backward_step"`
	SeekForwardStep  int64        `json:"seek_forward_step"`
	RepeatAvailable  []string     `json:"repeat_available"`
	ShuffleAvailable []string     `json:"shuffle_available"`
	Attribute        AttributeBit `json:"attribute"`
	AttributeFlags   PlayInfoAttributes
}

type PlayInfoAttributes

type PlayInfoAttributes struct {
	Playable bool
	CanStop  bool
}

type PresetContainer

type PresetContainer struct {
	ResponseCode int          `json:"response_code"`
	PresetInfo   []PresetInfo `json:"preset_info"`
}

type PresetInfo

type PresetInfo struct {
	Url   string `json:"url,omitempty"`
	Input string `json:"input,omitempty"`
	Text  string `json:"text"`
}

type Server

type Server interface {
	SendControl(ctx context.Context, path string) ([]byte, error)
	SendSubscribeUDP(ctx context.Context, port int) error
	SendUpnp(ctx context.Context, action string, payload []byte) error
	GetBlob(ctx context.Context, kind, key string) ([]byte, error)
	IP() string
}

type SystemClock

type SystemClock struct {
	FunctionList    []string          `json:"func_list"`
	RangeStep       []SystemRangeStep `json:"range_step"`
	AlarmInputList  []string          `json:"alarm_input_list"`
	AlarmPresetList []string          `json:"alarm_preset_list"`
}

type SystemFeatures

type SystemFeatures struct {
	FunctionList []string          `json:"func_list"`
	ZoneNum      int64             `json:"zone_num"`
	InputList    []SystemInput     `json:"input_list"`
	RangeStep    []SystemRangeStep `json:"range_step"`
}

type SystemInput

type SystemInput struct {
	Id                 string `json:"id"`
	DistributionEnable bool   `json:"distribution_enable"`
	RenameEnabled      bool   `json:"rename_enabled"`
	AccountEnabled     bool   `json:"account_enabled"`
	PlayInfoType       string `json:"string"`
}

type SystemRangeStep

type SystemRangeStep struct {
	Id   string `json:"id"`
	Min  int64  `json:"min"`
	Max  int64  `json:"max"`
	Step int64  `json:"step"`
}

type SystemZone

type SystemZone struct {
	Id                string            `json:"id"`
	FunctionList      []string          `json:"func_list"`
	InputList         []string          `json:"input_list"`
	SoundProgramList  []string          `json:"sound_program_list"`
	EqualizerModeList []string          `json:"equalizer_mode_list"`
	LinkControlList   []string          `json:"link_control_list"`
	RangeStep         []SystemRangeStep `json:"range_step"`
}

type UpnpAvTransportUri

type UpnpAvTransportUri struct {
	XmlNS              string `xml:"xmlns:s,attr"`
	InstanceID         int    `xml:"InstanceID"`
	CurrentURI         string `xml:"CurrentURI"`
	CurrentURIMetaData string `xml:"CurrentURIMetaData"`
}

type UpnpBody

type UpnpBody struct {
	Play           *UpnpPlay           `xml:"u:Play,omitempty"`
	AVTransportURI *UpnpAvTransportUri `xml:"u:SetAVTransportURI"`
}

type UpnpEnvelope

type UpnpEnvelope struct {
	XMLName       xml.Name  `xml:"s:Envelope"`
	EncodingStyle string    `xml:"s:encodingStyle,attr"`
	XmlNS         string    `xml:"xmlns:s,attr"`
	Body          *UpnpBody `xml:"s:Body,omitempty"`
}

type UpnpPlay

type UpnpPlay struct {
	XmlNS      string `xml:"xmlns:s,attr"`
	InstanceID int    `xml:"InstanceID"`
	Speed      int    `xml:"Speed"`
}

type ZoneStatus

type ZoneStatus struct {
	ResponseCode       int    `json:"response_code"`
	Power              string `json:"power"`
	Sleep              uint32 `json:"sleep"`
	Volume             uint32 `json:"volume"`
	Mute               bool   `json:"mute"`
	Input              string `json:"input"`
	DistributionEnable bool   `json:"distribution_enable"`
}

Jump to

Keyboard shortcuts

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