eiscp

package module
v0.0.0-...-53a261e Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: MPL-2.0 Imports: 14 Imported by: 3 modules, 3 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

go-onkyo

This started as a fork of github.com/reddec/go-eiscp, but has mutated into its own thing.

eISCP is a 1980's serial-line protocol with a 1990's update to stream over TCP/IP. It does its job, but not in any modern sort of way. It really expects the listener to keep track of all state and doesn't do well with short-lived (one-shot) commands. I'm trying to work around some of these limitations.

For a small CLI tool, it is still one-shot. But for longer-lived processes I am trying to make persistent connections work more sanely.

For now this is more feature-full than the project I initially forked this from, but I am no where near where I intend to be when I get it working as I envision.

Documentation

Index

Constants

View Source
const (
	NetSrcDLNA        NetSource = "00"
	NetSrcFavorite              = "01"
	NetSrcVTuner                = "02"
	NetSrcSiriusXM              = "03"
	NetSrcPandora               = "04"
	NetSrcRhapsody              = "05"
	NetSrcLastFM                = "06"
	NetSrcNapster               = "07"
	NetSrcSlacker               = "08"
	NetSrcMediafly              = "09"
	NetSrcSpotify               = "0A"
	NetSrcAUPEO                 = "0B"
	NetSrcRadiko                = "0C"
	NetSrcEOnkyo                = "0D"
	NetSrcTuneIn                = "0E"
	NetSrcMP3Tunes              = "0F"
	NetSrcSimfy                 = "10"
	NetSrcHomeMedia             = "11"
	NetSrcDeezer                = "12"
	NetSrciHeartRadio           = "13"
	NetSrcUnknown               = "FF"
)

Sample sources

View Source
const (
	SrcVCR           Source = "00"
	SrcCBL                  = "01"
	SrcGame                 = "02"
	SrcAux1                 = "03"
	SrcAux2                 = "04"
	SrcPC                   = "05"
	SrcVideo7               = "06"
	SrcDVD                  = "10"
	SrcStrm                 = "11"
	SrcTV                   = "12"
	SrcTape                 = "20"
	SrcTape2                = "21"
	SrcPhono                = "22"
	SrcCD                   = "23"
	SrcFM                   = "24"
	SrcAM                   = "25"
	SrcTuner                = "26"
	SrcDLNA2                = "27"
	SrcInternetRadio        = "28"
	SrcUsbFront             = "29"
	SrcUsbRear              = "2A"
	SrcNetwork              = "2B"
	SrcUSBToggle            = "2C"
	SrcAirplay              = "2D"
	SrcBluetooth            = "2E"
	SrcDAC                  = "2F"
	SrcMultiChan            = "30"
	SrcXM                   = "31"
	SrcSirius               = "32"
	SrcDAB                  = "33"
	SrcUniversal            = "40"
	SrcLine                 = "41"
	SrcLine2                = "42"
	SrcOptical              = "44"
	SrcCoax                 = "45"
	SrcHDMI5                = "55"
	SrcHDMI6                = "56"
	SrcHDMI7                = "57"
)

Sample sources

Variables

View Source
var DimmerState = map[string]string{
	"Bright":           "00",
	"Medium":           "01",
	"Dim":              "02",
	"Off":              "03",
	"Bright & LED-Off": "08",
	"unknown":          "ff",
}
View Source
var ListeningModes = map[string]string{
	"00":     "stereo",
	"01":     "direct",
	"02":     "surround",
	"03":     "[film, game-rpg]",
	"04":     "thx",
	"05":     "[action, game-action]",
	"06":     "[musical, game-rock]",
	"07":     "mono-movie",
	"08":     "orchestra",
	"09":     "unplugged",
	"0A":     "studio-mix",
	"0B":     "tv-logic",
	"0C":     "all-ch-stereo",
	"0D":     "theater-dimensional",
	"0E":     "enhanced-7, enhance, game-sports",
	"0F":     "mono",
	"11":     "pure-audio",
	"12":     "multiplex",
	"13":     "full-mono",
	"14":     "[dolby-virtual, surround-enhanced]",
	"15":     "dts-surround-sensation",
	"16":     "audyssey-dsx",
	"1F":     "whole house",
	"23":     "stage",
	"25":     "action",
	"26":     "music",
	"2E":     "sports",
	"40":     "straight-decode",
	"41":     "dolby-ex",
	"42":     "thx-cinema",
	"43":     "thx-surround-ex",
	"44":     "thx-music",
	"45":     "thx-games",
	"50":     "[thx-u2, s1, i, s-cinema, cinema2]",
	"51":     "[thx-musicmode, thx-u2, s2, i, s-music]",
	"52":     "[thx-games, thx-u2, s2, i, s-games]",
	"80":     "[plii, pliix-movie, dolby-atmos, dolby-surround]",
	"81":     "[plii, pliix-music]",
	"82":     "[neo-6-cinema, neo-x-cinema, dts-x, neural-x]",
	"83":     "[neo-6-music, neo-x-music]",
	"84":     "[plii, pliix-thx-cinema, dolby-surround-thx-cinema]",
	"85":     "[neo-6, neo-x-thx-cinema, dts-neural-x-thx-cinema]",
	"86":     "[plii, pliix-game]",
	"87":     "neural-surr",
	"88":     "[neural-thx, nexural-surround]",
	"89":     "[plii, pliix-thx-games, dolby-surround-thx-games]",
	"8A":     "[neo-6, neo-x-thx-games, dts-neural-x-thx-games]",
	"8B":     "[plii, pliix-thx-music, dolby-surround-thx-music]",
	"8C":     "[neo-6, neo-x-thx-music, dts-neural-x-thx-music]",
	"8D":     "neural-thx-cinema",
	"8E":     "neural-thx-music",
	"8F":     "neural-thx-games",
	"90":     "pliiz-height",
	"91":     "neo-6-cinema-dts-surround-sensation",
	"92":     "neo-6-music-dts-surround-sensation",
	"93":     "neural-digital-music",
	"94":     "pliiz-height-thx-cinema",
	"95":     "pliiz-height-thx-music",
	"96":     "pliiz-height-thx-games",
	"97":     "[pliiz-height-thx-u2, s2-cinema]",
	"98":     "[pliiz-height-thx-u2, s2-music]",
	"99":     "[pliiz-height-thx-u2, s2-games]",
	"9A":     "neo-x-game",
	"A0":     "[pliix, plii-movie-audyssey-dsx]",
	"A1":     "[pliix, plii-music-audyssey-dsx]",
	"A2":     "[pliix, plii-game-audyssey-dsx]",
	"A3":     "neo-6-cinema-audyssey-dsx",
	"A4":     "neo-6-music-audyssey-dsx",
	"A5":     "neural-surround-audyssey-dsx",
	"A6":     "neural-digital-music-audyssey-dsx",
	"A7":     "dolby-ex-audyssey-dsx",
	"FF":     "auto-surround",
	"MOVIE":  "movie",
	"MUSIC":  "music",
	"GAME":   "game",
	"THX":    "thx",
	"AUTO":   "auto",
	"SURR":   "surr",
	"STEREO": "stereo",
}
View Source
var Menu menu
View Source
var NetSourceByName = map[string]NetSource{
	"DLNA":        NetSrcDLNA,
	"Favorite":    NetSrcFavorite,
	"vTuner":      NetSrcVTuner,
	"SiriusXM":    NetSrcSiriusXM,
	"Pandora":     NetSrcPandora,
	"Rhapsody":    NetSrcRhapsody,
	"Last.fm":     NetSrcLastFM,
	"Napster":     NetSrcNapster,
	"Slacker":     NetSrcSlacker,
	"Mediafly":    NetSrcMediafly,
	"Spotify":     NetSrcSpotify,
	"AUPEO!":      NetSrcAUPEO,
	"radiko":      NetSrcRadiko,
	"e-Onkyo":     NetSrcEOnkyo,
	"TuneIn":      NetSrcTuneIn,
	"mp3Tunes":    NetSrcMP3Tunes,
	"Simfy":       NetSrcSimfy,
	"HomeMedia":   NetSrcHomeMedia,
	"Deezer":      NetSrcDeezer,
	"iHeartRadio": NetSrciHeartRadio,
	"unknown":     NetSrcUnknown,
}

SourceByName - map channel name to source enum const

View Source
var NetSourceToName = map[NetSource]string{
	NetSrcDLNA:        "DLNA",
	NetSrcFavorite:    "Favorite",
	NetSrcVTuner:      "vTuner",
	NetSrcSiriusXM:    "SiriusXM",
	NetSrcPandora:     "Pandora",
	NetSrcRhapsody:    "Rhapsody",
	NetSrcLastFM:      "Last.fm",
	NetSrcNapster:     "Napster",
	NetSrcSlacker:     "Slacker",
	NetSrcMediafly:    "Mediafly",
	NetSrcSpotify:     "Spotify",
	NetSrcAUPEO:       "AUPEO!",
	NetSrcRadiko:      "radiko",
	NetSrcEOnkyo:      "e-Onkyo",
	NetSrcTuneIn:      "TuneIn",
	NetSrcMP3Tunes:    "mp3Tunes",
	NetSrcSimfy:       "Simfy",
	NetSrcHomeMedia:   "HomeMedia",
	NetSrcDeezer:      "Deezer",
	NetSrciHeartRadio: "iHeartRadio",
	NetSrcUnknown:     "unknown",
}
View Source
var SourceByName = map[string]Source{
	"vcr":            SrcVCR,
	"cbl":            SrcCBL,
	"game":           SrcGame,
	"aux1":           SrcAux1,
	"aux2":           SrcAux2,
	"pc":             SrcPC,
	"dvd":            SrcDVD,
	"phono":          SrcPhono,
	"cd":             SrcCD,
	"fm":             SrcFM,
	"am":             SrcAM,
	"tuner":          SrcTuner,
	"dlna2":          SrcDLNA2,
	"internet-radio": SrcInternetRadio,
	"usb-front":      SrcUsbFront,
	"usb-rear":       SrcUsbRear,
	"network":        SrcNetwork,
	"video7":         SrcVideo7,
	"strm-box":       SrcStrm,
	"tape":           SrcTape,
	"tape2":          SrcTape2,
	"tv":             SrcTV,
	"bluetooth":      SrcBluetooth,
	"dac":            SrcDAC,
	"airplay":        SrcAirplay,
	"usb-toggle":     SrcUSBToggle,
	"line":           SrcLine,
	"line2":          SrcLine2,
	"universal":      SrcUniversal,
	"optical":        SrcOptical,
	"coax":           SrcCoax,
	"multi-ch":       SrcMultiChan,
	"xm":             SrcXM,
	"sirius":         SrcSirius,
	"dab":            SrcDAB,
	"hdmi-5":         SrcHDMI5,
	"hdmi-6":         SrcHDMI6,
	"hdmi-7":         SrcHDMI7,
}

SourceByName - map channel name to source enum const

View Source
var SourceToName = map[Source]string{
	SrcVCR:           "vcr",
	SrcCBL:           "cbl",
	SrcGame:          "game",
	SrcAux1:          "aux1",
	SrcAux2:          "aux2",
	SrcPC:            "pc",
	SrcVideo7:        "video7",
	SrcDVD:           "dvd",
	SrcStrm:          "strm-box",
	SrcTV:            "TV",
	SrcTape:          "tape",
	SrcTape2:         "tape1",
	SrcPhono:         "phono",
	SrcCD:            "cd",
	SrcFM:            "fm",
	SrcAM:            "am",
	SrcTuner:         "tuner",
	SrcDLNA2:         "dlna2",
	SrcInternetRadio: "internet-radio",
	SrcUsbFront:      "usb-front",
	SrcUsbRear:       "usb-rear",
	SrcNetwork:       "network",
	SrcUSBToggle:     "usb-toggle",
	SrcAirplay:       "airplay",
	SrcBluetooth:     "bluetooth",
	SrcDAC:           "dac",
	SrcMultiChan:     "multi-ch",
	SrcXM:            "xm",
	SrcSirius:        "sirius",
	SrcDAB:           "dab",
	SrcUniversal:     "universal",
	SrcLine:          "line",
	SrcLine2:         "line2",
	SrcOptical:       "optical",
	SrcCoax:          "coax",
	SrcHDMI5:         "hdmi-5",
	SrcHDMI6:         "hdmi-6",
	SrcHDMI7:         "hdmi-7",
}

SourceToName - map source enum to channel name XXX finish this

Functions

func Discover

func Discover() (string, error)

func SetLogger

func SetLogger(l onkyologger)

Types

type Command

type Command struct {
	Code  string
	Value string
}

type Device

type Device struct {
	Responses chan Message
	Host      string
	// contains filtered or unexported fields
}

Device of Onkyo receiver

func NewReceiver

func NewReceiver(host string, persistent bool) (*Device, error)

NewReceiver - sugar for NewDevice with Receiver as device type and version 1

func (*Device) Close

func (d *Device) Close() error

Close connection

func (*Device) Connect

func (d *Device) Connect() error

Connect to an eISCP device by v4 IP address (not host name)

func (*Device) GetAudioInformation

func (d *Device) GetAudioInformation() (string, error)

func (*Device) GetDetails

func (d *Device) GetDetails() (*NRI, error)

func (*Device) GetDimmer

func (d *Device) GetDimmer() (string, error)

func (*Device) GetDisplayMode

func (d *Device) GetDisplayMode() (string, error)

func (*Device) GetFLInformation

func (d *Device) GetFLInformation() (string, error)

hangs

func (*Device) GetFirmwareVersion

func (d *Device) GetFirmwareVersion() (string, error)

func (*Device) GetHDMIOut

func (d *Device) GetHDMIOut() (string, error)

hangs

func (*Device) GetISF

func (d *Device) GetISF() (string, error)

hangs

func (*Device) GetListeningMode

func (d *Device) GetListeningMode() (string, error)

func (*Device) GetMonitorResolution

func (d *Device) GetMonitorResolution() (string, error)

func (*Device) GetMute

func (d *Device) GetMute() (bool, error)

func (*Device) GetNetworkInfo

func (d *Device) GetNetworkInfo() (string, error)

hangs

func (*Device) GetNetworkJacketArt

func (d *Device) GetNetworkJacketArt() (string, error)

func (*Device) GetNetworkListInfo

func (d *Device) GetNetworkListInfo() (*NLS, error)

func (*Device) GetNetworkMenuStatus

func (d *Device) GetNetworkMenuStatus() (*NetworkMenuStatus, error)

func (*Device) GetNetworkPlayStatus

func (d *Device) GetNetworkPlayStatus() (*NetworkPlayStatus, error)

func (*Device) GetNetworkStatus

func (d *Device) GetNetworkStatus() (*NetworkStatus, error)

func (*Device) GetNetworkTitle

func (d *Device) GetNetworkTitle() (*NLT, error)

func (*Device) GetNetworkTitleName

func (d *Device) GetNetworkTitleName() (string, error)

func (*Device) GetPower

func (d *Device) GetPower() (bool, error)

GetPower - get Onkyo power state

func (*Device) GetPreset

func (d *Device) GetPreset() (string, error)

AM/FM tuner preset

func (*Device) GetSource

func (d *Device) GetSource() (string, error)

GetSource - Get Onkyo source channel. Use SourceToName to get readable name

func (*Device) GetSourceByCode

func (d *Device) GetSourceByCode() (Source, error)

GetSourceByCode - Get Onkyo source channel. Use SourceToName to get readable name

func (*Device) GetTempData

func (d *Device) GetTempData() (uint8, error)

func (*Device) GetVideoInformation

func (d *Device) GetVideoInformation() (string, error)

func (*Device) GetVolume

func (d *Device) GetVolume() (uint8, error)

GetVolume - get master volume in Onkyo receiver

func (*Device) GetWideVideoMode

func (d *Device) GetWideVideoMode() (string, error)

hangs

func (*Device) SelectNetworkListItem

func (d *Device) SelectNetworkListItem(i int) error

func (*Device) SetGetAll

func (d *Device) SetGetAll(command, arg string) (*MultiMessage, error)

Set sends a command and returns all responses

func (*Device) SetGetOne

func (d *Device) SetGetOne(command, arg string) (*Message, error)

func (*Device) SetListeningMode

func (d *Device) SetListeningMode(code string) (string, error)

func (*Device) SetMute

func (d *Device) SetMute(mute bool) (bool, error)

func (*Device) SetNetworkJacketArt

func (d *Device) SetNetworkJacketArt(s bool) (bool, error)

this should return a bool...

func (*Device) SetNetworkPlayStatus

func (d *Device) SetNetworkPlayStatus(s string) (string, error)

prs : e.g. Sxx or Pxx p -> Play Status: "S": STOP, "P": Play, "p": Pause, "F": FF, "R": FR, "E": EOF r Repeat Status: "-": Off, "R": All, "F": Folder, "1": Repeat 1, "x": disable s Shuffle Status: "-": Off, "S": All , "A": Album, "F": Folder, "x": disable

func (*Device) SetNetworkPreset

func (d *Device) SetNetworkPreset(p string) (string, error)

func (*Device) SetNetworkService

func (d *Device) SetNetworkService(s string) error

func (*Device) SetNetworkServiceTuneIn

func (d *Device) SetNetworkServiceTuneIn() error

func (*Device) SetOnly

func (d *Device) SetOnly(command, arg string) error

SetOnly sends a command and does not check for a response

func (*Device) SetPower

func (d *Device) SetPower(on bool) (*Message, error)

SetPower - turn on/off Onkyo device

func (*Device) SetPreset

func (d *Device) SetPreset(p string) (string, error)

AM/FM tuner preset

func (*Device) SetSource

func (d *Device) SetSource(source Source) (*Message, error)

SetSource - Set Onkyo source channel by friendly name

func (*Device) SetSourceByCode

func (d *Device) SetSourceByCode(code int) (*Message, error)

SetSourceByCode - Set Onkyo source channel by code

func (*Device) SetVolume

func (d *Device) SetVolume(level uint8) (uint8, error)

SetVolume - set master volume in Onkyo receiver

type DeviceType

type DeviceType byte

DeviceType - device destination code in ISCP

const (
	TypeReceiver DeviceType = 0x31
)

Destination code

type Message

type Message struct {
	Parsed   interface{} // the response value pased into ... whatever is appropriate
	Command  string      // verify you've got the right Command
	Response string      // the response value

	Version     byte // always the same
	Destination byte // always the same
	Valid       bool // if the packet was able to be parsed
	// contains filtered or unexported fields
}

Message eISCP

func (*Message) BuildEISCP

func (msg *Message) BuildEISCP() []byte

BuildEISCP - Build ISCP message into ethernet frame

func (*Message) BuildISCP

func (msg *Message) BuildISCP() []byte

BuildISCP - Build ISCP message

func (*Message) Parse

func (msg *Message) Parse(rawP *[]byte)

Parse raw message from network into an eISCP message

type MultiMessage

type MultiMessage struct {
	Messages []*Message
}

type NLS

type NLS struct {
	InfoType string // (A : ASCII letter, C : Cursor Info, U : Unicode letter)
	LineInfo string // (0-9 : 1st to 10th Line)
	Property string // varies based on context
	Line     string
}

type NLT

type NLT struct {
	ServiceType NetSource
	UIType      string // 1 - int // 0 : List, 1 : Menu, 2 : Playback, 3 : Popup, 4 : Keyboard, 5 : Menu
	LayerType   string // 1 - int // 0 : NET TOP, 1 : Service Top,DLNA/USB/iPod Top, 2 : under 2nd Layer
	CurrentPos  string // 4 - hex
	NumItems    string // 4 - hex
	NumLayers   string // 2 - hex
	Reserved    string // 2 - unused
	IconL       NetSource
	IconR       NetSource
	Status      string // 2 -- hex -- lookup table // 00 : None, 01 : Connecting, 02 : Acquiring License, 03 : Buffering 04 : Cannot Play, 05 : Searching, 06 : Profile update, 07 : Operation disabled 08 : Server Start-up, 09 : Song rated as Favorite, 0A : Song banned from station, 0B : Authentication Failed, 0C : Spotify Paused(max 1 device), 0D : Track Not Available, 0E : Cannot Skip
	Title       string // the rest
}

type NRI

type NRI struct {
	XMLName xml.Name `xml:"response"`
	Device  struct {
		ID               string `xml:"id,attr"`
		Brand            string `xml:"brand"`
		Category         string `xml:"category"`
		Year             string `xml:"year"`
		Model            string `xml:"model"`
		Destination      string `xml:"destination"`
		ProductID        string `xml:"productid"`
		DeviceSerial     string `xml:"deviceserial"`
		MacAddress       string `xml:"macaddress"`
		ModelIconURL     string `xml:"modeliconurl"`
		FriendlyName     string `xml:"friendlyname"`
		FirmwareVersion  string `xml:"firmwareversion"`
		EcosystemVersion string `xml:"ecosystemversion"`
		NetServiceList   struct {
			NetService []struct {
				ID       string `xml:"id,attr"`
				Value    string `xml:"value,attr"`
				Name     string `xml:"name,attr"`
				Account  string `xml:"account,attr"`
				Password string `xml:"password,attr"`
				Zone     string `xml:"zone,attr"`
				Enable   string `xml:"enable,attr"`
				Addqueue string `xml:"addqueue,attr"`
				Sort     string `xml:"sort,attr"`
			} `xml:"netservice"`
		} `xml:"netservicelist"`
		ZoneList struct {
			Zone []struct {
				ID       string `xml:"id,attr"`
				Value    string `xml:"value,attr"`
				Name     string `xml:"name,attr"`
				Volmax   string `xml:"volmax,attr"`
				Volstep  string `xml:"volstep,attr"`
				Src      string `xml:"src,attr"`
				Dst      string `xml:"dst,attr"`
				Lrselect string `xml:"lrselect,attr"`
			} `xml:"zone"`
		} `xml:"zonelist"`
		SelectorList struct {
			Selector []struct {
				ID     string `xml:"id,attr"`
				Value  string `xml:"value,attr"`
				Name   string `xml:"name,attr"`
				Zone   string `xml:"zone,attr"`
				Iconid string `xml:"iconid,attr"`
			} `xml:"selector"`
		} `xml:"selectorlist"`
		PresetList struct {
			Preset []struct {
				ID   string `xml:"id,attr"`
				Band string `xml:"band,attr"`
				Freq string `xml:"freq,attr"`
				Name string `xml:"name,attr"`
			} `xml:"preset"`
		} `xml:"presetlist"`
		ControlList struct {
			Control []struct {
				ID       string `xml:"id,attr"`
				Value    string `xml:"value,attr"`
				Zone     string `xml:"zone,attr"`
				Min      string `xml:"min,attr"`
				Max      string `xml:"max,attr"`
				Step     string `xml:"step,attr"`
				Code     string `xml:"code,attr"`
				Position string `xml:"position,attr"`
			} `xml:"control"`
		} `xml:"controllist"`
		FunctionList struct {
			Function []struct {
				ID    string `xml:"id,attr"`
				Value string `xml:"value,attr"`
			} `xml:"function"`
		} `xml:"functionlist"`
		Tuners struct {
			Tuner []struct {
				Band string `xml:"band,attr"`
				Min  string `xml:"min,attr"`
				Max  string `xml:"max,attr"`
				Step string `xml:"step,attr"`
			} `xml:"tuner"`
		} `xml:"tuners"`
	} `xml:"device"`
}

type NetSource

type NetSource string

Source name of input channel

type NetworkMenuStatus

type NetworkMenuStatus struct {
	Service            string
	ServiceName        string
	ElapsedTimeMode    int
	Menu               bool
	PositiveButtonIcon bool
	NegativeButtonIcon bool
	SeekTime           bool
}

type NetworkPlayStatus

type NetworkPlayStatus struct {
	State   string
	Repeat  string
	Shuffle string
}

type NetworkStatus

type NetworkStatus struct {
	Source string
	Front  string
	Rear   string
}

type Source

type Source string

Source name of input channel

Directories

Path Synopsis
cmd
onkyo command

Jump to

Keyboard shortcuts

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