mxremote

package module
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

README

MX Remote — Pulse-Eight device interface

Go library for discovering and controlling Pulse-Eight AV distribution hardware over a local network: video/audio matrices, HDMI-over-IP encoders/decoders, multiviewers, and audio amplifiers. Supports device discovery, video/audio routing, volume control, remote-control key passthrough, HDMI-over-IP streaming, multiviewer control, and more.

If you are looking to integrate Pulse-Eight neo, OneIP, or ProAmp8 devices into your own software or home-automation system, this is the library for it.

What is MX Remote?

MX Remote is the network protocol these Pulse-Eight devices use to discover and control one another over UDP (multicast or broadcast). All of them run the shared MatrixOS firmware, which speaks this protocol natively. This library is a client implementation of that protocol — its purpose is to expose the devices to third-party software.

Supported devices

All devices below run MatrixOS and are controlled through the same protocol:

  • Pulse-Eight neo — HDBaseT video/audio matrices (neo:4, neo:8, neo:X, and splitters)
  • Pulse-Eight OneIP — HDMI-over-IP units: Transmitter (TX), Receiver (RX), Transceiver (TZ), and Multiviewer
  • Pulse-Eight ProAmp8 — 8-zone audio amplifier with Dolby support

Requirements

  • Go 1.19 or later (Linux, macOS, or Windows)
  • Network access to one or more of the Pulse-Eight devices above (multicast or broadcast)

Installation

import mxremote "github.com/opdenkamp/mx-remote-golang"

Quick start

ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
defer cancel()

mx := mxremote.New(mxremote.Config{
    Name: "my app",
    Callbacks: mxremote.Callbacks{
        OnDeviceConfigComplete: func(d *mxremote.Device) {
            fmt.Println("ready:", d.Serial(), d.ModelName(), d.Address())
        },
        OnVideoSourceChanged: func(b, src *mxremote.Bay) {
            fmt.Printf("%s -> %s\n", b.BayLabel(), src.BayLabel())
        },
    },
})
if err := mx.Start(ctx); err != nil {
    log.Fatal(err)
}
defer mx.Close()

Start opens the connection (multicast 224.8.8.8:8812 by default), announces this client, and begins discovery in the background. Devices and their bays are populated as frames arrive; use the callbacks or poll mx.Devices().

See examples/discover for a runnable program:

go run ./examples/discover            # multicast
go run ./examples/discover -b         # broadcast
go run ./examples/discover -l 192.168.1.20
go run ./examples/discover -i br_v8   # join multicast on a named interface (no-IP VLAN)

Configuration

mxremote.Config{
    TargetIP:  "",    // multicast/broadcast IP; empty = default
    Port:      0,     // 0 = default for the mode (8812 mcast / 8811 bcast)
    LocalIP:   "",    // interface to bind by IP; empty = first non-loopback
    Interface: "",    // interface name for multicast (takes precedence over LocalIP)
    Broadcast: false, // broadcast instead of multicast
    Name:      "",    // advertised name
    Callbacks: mxremote.Callbacks{ /* optional handlers */ },
}

Interface selects the multicast interface by name (e.g. "br_v8") rather than by local IP. It joins the group and sends egress keyed on the interface index, so it works even on an interface with no IPv4 address — a tagged VLAN where the devices are reachable but the host has no address in their subnet. It takes precedence over LocalIP when set. This index-based join is Linux only; on macOS and Windows the named interface must have an IPv4 address.

Devices and bays

for _, d := range mx.Devices() {
    d.Serial(); d.Name(); d.ModelName(); d.Address(); d.Status()
    d.IsV2IP(); d.IsOneIPTx(); d.IsOneIPRx(); d.IsOneIPMultiviewer()
    d.V2IPSources(); d.V2IPDetails(); d.V2IPSink()
    for _, b := range d.Outputs() { /* ... */ }
    for _, b := range d.Inputs()  { /* ... */ }
}

b.BayLabel(); b.Mode(); b.SignalDetected(); b.PowerStatusValue()
b.VideoSource(); b.AudioSource(); b.V2IPSource()

All accessors are safe for concurrent use.

V2IP routing control

On a V2IP sink bay:

sink.SelectVideoSource(0)              // route video from source port 0
sink.SelectAudioSource(0)              // route audio from source port 0
sink.SelectAudioSourceAddr("239.1.2.4", 50022, nil) // raw multicast address

Other control: bay.SetName, bay.SetHidden, bay.SelectEdidProfile, bay.TxAction, bay.VolumeSet, device.Reboot.

Callbacks and the fan-in model

Like the reference library, every specific callback (e.g. OnPowerChanged) also fires the generic OnBayUpdate (or OnDeviceUpdate for device-level events). Consumers that just want "something changed, re-read state" can set only OnBayUpdate/OnDeviceUpdate. Per-device and per-bay callbacks can also be registered directly with Device.RegisterCallback / Bay.RegisterCallback.

OnKeyPressed and OnActionReceived do not fan into OnBayUpdate (matching the reference).

  • Virtual links: Bay.Link()*BayLink (Serial, LinkedBayName, LinkedBay, IsAudio, IsVideo, Configured), plus Bay.LinkConfigured, Bay.LinkedBay, and the OnBayLinked/OnBayUnlinked callbacks.
  • Mirroring: Bay.Mirroring()BayMirrorStatus and OnMirrorStatusChanged.
  • Mesh: Device.MeshMaster(), Device.IsMeshMaster(), Device.IsMeshMember().
  • Cross-device bay identity: Bay.BayUID() (resolves V2IP sources to their originating device), Remote.GetBayByPortnum.

Multiviewer

Device.Multiviewer()*Multiviewer: full status readout (view mode, PIP, audio, EDID, HDCP, output mode, per-screen sources, source mappings, firmware versions) and control (SetViewMode, SetVideoSource, SetAudioSource, SetAudioVolume, SetPipSize/Position, SetScreenAspect, SetAutoSwitch, SetOutputMode, SetOutputITCMode, SetHDCPMode, SetEdidTemplate, SetRemoteControl, SetConnectedSource, AutoRoute).

V2IP audio

Device.AudioEndpoints(), Device.AudioEndpointByID, Bay.AudioEndpoint(): audio endpoint tree with features, addresses, parent/child and input routing; audio links; and control (Device.AudioMute, AudioTrigger, AudioVolumeSet, AudioSelectInput).

Amplifier (ProAmp8)

Bay.AmpSettings() (gain, volume range, delay, bass/treble, bridging, power mode/level/timeout, 5-band EQ per channel) and Bay.SetZoneSettings; Device.DolbySettings() with the OnAmpDolbySettingsChanged / OnAmpZoneSettingsChanged callbacks.

Diagnostics

Device.NetworkStatus() (per-port link speed/duplex, link errors, VCT, UTP cable pairs, IP/MAC/IGMP querier; both pre-0x22 and 0x22+ wire formats), Device.MACAddress(); V2IP statistics via Device.ReadStats(bool) + Device.V2IPStats() (TX/RX cumulative and per-minute counters, decoder state); firmware versions (Device.FirmwareVersions()); detailed signal status with SVD resolution decoding (Bay.SignalType shows e.g. 1920x1080 / RGB / 8bpp / 60Hz, LookupSvd); and system status (Device.SystemStatus(), Device.StatusMessage()).

License

BSD 3-Clause. See LICENSE.

Documentation

Overview

Package mxremote is a Go library for interfacing with Pulse-Eight MX Remote compatible devices over a local network (UDP multicast or broadcast): video/ audio matrices, OneIP/V2IP units (transmitter/receiver/transceiver/ multiviewer) and amplifiers, all running the shared MatrixOS firmware.

The wire protocol is byte-for-byte compatible with the reference Python library and the MatrixOS firmware. The Go API itself is idiomatic and does not mirror the Python class layout.

Typical use:

mx := mxremote.New(mxremote.Config{
	Callbacks: mxremote.Callbacks{
		OnDeviceConfigComplete: func(d *mxremote.Device) {
			fmt.Println("ready:", d.Serial(), d.ModelName())
		},
	},
})
if err := mx.Start(ctx); err != nil {
	log.Fatal(err)
}
defer mx.Close()

Discovery runs in the background; devices and their bays are populated as hello and configuration frames arrive. Callbacks fire from a single internal goroutine. V2IP routing is driven from sink bays via Bay.SelectVideoSource, Bay.SelectAudioSource and Bay.SelectAudioSourceAddr.

Index

Constants

View Source
const (
	ArcNone    = "Inactive"
	ArcHDMI    = "HDMI"
	ArcOptical = "optical"
	ArcAnalog  = "analog"
)

ARC (audio return channel) status strings.

View Source
const (
	// Version is the version of this library.
	Version = "1.1.0"

	// ProtocolVersion is the highest MX Remote protocol version understood.
	ProtocolVersion uint16 = 0x27
)

Library and protocol versions.

View Source
const (
	// BroadcastPort is the UDP port used in broadcast mode.
	BroadcastPort = 8811

	// MulticastIP is the multicast group address used for discovery.
	MulticastIP = "224.8.8.8"

	// MulticastPort is the UDP port used in multicast mode.
	MulticastPort = 8812
)

Network defaults.

View Source
const (
	V2IPPortVideo = 50020
	V2IPPortANC   = 50021
	V2IPPortAudio = 50022
)

Default V2IP stream destination UDP ports.

View Source
const (
	V2IPAudioDefaultSampleRate = 48000
	V2IPAudioDefaultChannels   = 2
	V2IPAudioMinChannels       = 1
	V2IPAudioMaxChannels       = 8
)

V2IP audio defaults.

Variables

This section is empty.

Functions

func BayStatusHDCP

func BayStatusHDCP(status uint32) int

BayStatusHDCP extracts the HDCP status (2 bits) from a bay-status word.

func BayStatusRCType

func BayStatusRCType(status uint32) int

BayStatusRCType extracts the RC type (4 bits) from a bay-status word.

func ValidAddresses

func ValidAddresses() []string

ValidAddresses returns the non-loopback IPv4 addresses usable as LocalIP.

Types

type AmpDolbySettings

type AmpDolbySettings struct {
	Mode           int
	PCMUpmix       bool
	DolbyDetected  bool
	PCMUpmixActive bool
}

AmpDolbySettings holds the Dolby processing state of a ProAmp8.

type AmpZoneSettings

type AmpZoneSettings struct {
	GainLeft     int
	GainRight    int
	VolumeMin    int
	VolumeMax    int
	DelayLeft    uint32
	DelayRight   uint32
	Bass         int
	Treble       int
	Bridged      int
	PowerMode    int
	PowerLevel   int
	PowerTimeout uint32
	EQLeft       [5]int
	EQRight      [5]int
}

AmpZoneSettings holds the per-zone settings of a ProAmp8 output.

type AudioChangeSource

type AudioChangeSource struct {
	SourceUID DeviceUID
	TargetUID DeviceUID
	SourceID  int
	TargetID  int
}

AudioChangeSource describes an audio input-selection change.

type AudioEndpoint

type AudioEndpoint struct {
	ID       int
	Features AudioFeatures
	Address  *V2IPStreamSource
	// contains filtered or unexported fields
}

AudioEndpoint is a single audio endpoint on a V2IP device (an input, output, or processor node in the device's audio tree).

func (*AudioEndpoint) Bay

func (e *AudioEndpoint) Bay() *Bay

Bay returns the bay this endpoint is associated with, or nil.

func (*AudioEndpoint) Input

func (e *AudioEndpoint) Input() *AudioEndpoint

Input returns the currently routed input endpoint, or nil.

func (*AudioEndpoint) InputsAvailable

func (e *AudioEndpoint) InputsAvailable() []*AudioEndpoint

InputsAvailable returns the input endpoints that can be routed to this one.

func (*AudioEndpoint) IsInput

func (e *AudioEndpoint) IsInput() bool

func (*AudioEndpoint) IsOutput

func (e *AudioEndpoint) IsOutput() bool

func (*AudioEndpoint) IsV2IP

func (e *AudioEndpoint) IsV2IP() bool

type AudioEndpoints

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

AudioEndpoints is the collection of audio endpoints reported by a device.

func (*AudioEndpoints) Get

func (a *AudioEndpoints) Get(id int) *AudioEndpoint

Get returns the endpoint with the given id, or nil.

func (*AudioEndpoints) List

func (a *AudioEndpoints) List() []*AudioEndpoint

List returns all endpoints in wire order.

type AudioFeatures

type AudioFeatures uint32

AudioFeatures is the capability bitmask of a V2IP audio endpoint.

func (AudioFeatures) HasTrigger

func (a AudioFeatures) HasTrigger() bool

func (AudioFeatures) IsAmp

func (a AudioFeatures) IsAmp() bool

func (AudioFeatures) IsHDMI

func (a AudioFeatures) IsHDMI() bool

func (AudioFeatures) IsInput

func (a AudioFeatures) IsInput() bool

func (AudioFeatures) IsOutput

func (a AudioFeatures) IsOutput() bool

func (AudioFeatures) IsRCA

func (a AudioFeatures) IsRCA() bool

func (AudioFeatures) IsSPDIF

func (a AudioFeatures) IsSPDIF() bool

func (AudioFeatures) IsV2IP

func (a AudioFeatures) IsV2IP() bool

func (AudioFeatures) IsV2IPRx

func (a AudioFeatures) IsV2IPRx() bool

func (AudioFeatures) IsV2IPTx

func (a AudioFeatures) IsV2IPTx() bool

func (AudioFeatures) SupportMute

func (a AudioFeatures) SupportMute() bool

func (AudioFeatures) SupportVolume

func (a AudioFeatures) SupportVolume() bool
type AudioLink struct {
	Endpoint     int
	LinkEndpoint int
	LinkDevice   DeviceUID
}

AudioLink links a local audio endpoint to an endpoint on another device.

type Bay

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

Bay is a single input or output port on a Device.

All exported methods are safe for concurrent use. Values returned are snapshots taken under the owning Remote's lock.

func (*Bay) ARC

func (b *Bay) ARC() string

ARC returns the audio-return-channel status string.

func (*Bay) AmpSettings

func (b *Bay) AmpSettings() *AmpZoneSettings

AmpSettings returns the amplifier zone settings for this bay, or nil.

func (*Bay) AudioEndpoint

func (b *Bay) AudioEndpoint() *AudioEndpoint

AudioEndpoint returns the audio endpoint associated with this bay, or nil.

func (*Bay) AudioRouteEndpoint

func (b *Bay) AudioRouteEndpoint() string

AudioRouteEndpoint returns the raw "ip:port" of an active V2IP sink audio subscription that maps to no known source bay, or "".

func (*Bay) AudioSource

func (b *Bay) AudioSource() *Bay

AudioSource returns the currently routed audio source bay, or nil.

func (*Bay) BayLabel

func (b *Bay) BayLabel() string

BayLabel returns "name (user name)" for logging.

func (*Bay) BayName

func (b *Bay) BayName() string

BayName returns the device-assigned port name.

func (*Bay) BayNumber

func (b *Bay) BayNumber() int

BayNumber returns the bay number used by the device API/topology.

func (*Bay) BayUID

func (b *Bay) BayUID() BayUID

BayUID returns the cross-device unique identifier of this bay.

func (*Bay) CECDetected

func (b *Bay) CECDetected() bool

CECDetected reports whether a CEC device is detected.

func (*Bay) DecoderDisabled

func (b *Bay) DecoderDisabled() bool

DecoderDisabled reports whether the V2IP decoder is disabled.

func (*Bay) Device

func (b *Bay) Device() *Device

Device returns the owning device.

func (*Bay) DolbyInput

func (b *Bay) DolbyInput() string

DolbyInput returns the input bay name providing the Dolby audio source, or "".

func (*Bay) EdidProfileValue

func (b *Bay) EdidProfileValue() (EdidProfile, bool)

EdidProfileValue returns the EDID profile of an HDMI input bay.

func (*Bay) EncoderDisabled

func (b *Bay) EncoderDisabled() bool

EncoderDisabled reports whether the V2IP encoder is disabled.

func (*Bay) Faulty

func (b *Bay) Faulty() bool

Faulty reports whether the bay is faulty.

func (*Bay) Features

func (b *Bay) Features() BayFeaturesMask

Features returns the bay feature bitmask.

func (*Bay) HDBTConnected

func (b *Bay) HDBTConnected() bool

HDBTConnected reports whether the HDBaseT link is up.

func (*Bay) HPDDetected

func (b *Bay) HPDDetected() bool

HPDDetected reports whether hotplug is detected.

func (*Bay) Hidden

func (b *Bay) Hidden() bool

Hidden reports whether the bay is hidden.

func (*Bay) IsAudio

func (b *Bay) IsAudio() bool

IsAudio reports whether this is an audio-only bay.

func (*Bay) IsHDBaseT

func (b *Bay) IsHDBaseT() bool

IsHDBaseT reports whether this is an HDBaseT output bay.

func (*Bay) IsHDMI

func (b *Bay) IsHDMI() bool

IsHDMI reports whether this is an HDMI bay.

func (*Bay) IsInput

func (b *Bay) IsInput() bool

IsInput reports whether this is a source bay.

func (*Bay) IsLocal

func (b *Bay) IsLocal() bool

IsLocal reports whether this bay is local (not a remote V2IP bay).

func (*Bay) IsOutput

func (b *Bay) IsOutput() bool

IsOutput reports whether this is a sink bay.

func (*Bay) IsV2IPRemote

func (b *Bay) IsV2IPRemote() bool

IsV2IPRemote reports whether this bay is a remote (mesh-forwarded) V2IP bay.

func (*Bay) IsV2IPSink

func (b *Bay) IsV2IPSink() bool

IsV2IPSink reports whether this bay is a V2IP sink.

func (*Bay) IsV2IPSource

func (b *Bay) IsV2IPSource() bool

IsV2IPSource reports whether this bay is a V2IP source.

func (b *Bay) Link() *BayLink

Link returns the virtual link configured on this bay, or nil.

func (*Bay) LinkConfigured

func (b *Bay) LinkConfigured() bool

LinkConfigured reports whether this bay is linked to another bay.

func (*Bay) LinkedBay

func (b *Bay) LinkedBay() *Bay

LinkedBay returns the bay linked to this one, or nil.

func (*Bay) Mirroring

func (b *Bay) Mirroring() BayMirrorStatus

Mirroring returns the bay's mirror status.

func (*Bay) Mode

func (b *Bay) Mode() string

Mode returns "Input", "Output" or "unknown".

func (*Bay) MuteSet

func (b *Bay) MuteSet(mute bool) error

MuteSet sets the mute state, keeping the current volume.

func (*Bay) Muted

func (b *Bay) Muted() (bool, bool)

Muted returns the mute state. ok is false when unknown.

func (*Bay) PoEPowered

func (b *Bay) PoEPowered() bool

PoEPowered reports whether PoE is supplying power on this bay.

func (*Bay) Port

func (b *Bay) Port() int

Port returns the port number used for routing operations.

func (*Bay) PowerOff

func (b *Bay) PowerOff() error

PowerOff sends a power-off action to the device connected to this bay.

func (*Bay) PowerOn

func (b *Bay) PowerOn() error

PowerOn sends a power-on action to the device connected to this bay.

func (*Bay) PowerStatusValue

func (b *Bay) PowerStatusValue() PowerStatus

PowerStatusValue returns the computed CEC power status of the connected device.

func (*Bay) RCTypeValue

func (b *Bay) RCTypeValue() (RCType, bool)

RCTypeValue returns the remote-control type of an HDMI input bay.

func (*Bay) RegisterCallback

func (b *Bay) RegisterCallback(fn func(*Bay))

RegisterCallback registers fn to be called whenever this bay changes.

func (*Bay) SelectAudioSource

func (b *Bay) SelectAudioSource(port int) error

SelectAudioSource routes the audio source of this output bay to the given source port. Only V2IP sinks are supported.

func (*Bay) SelectAudioSourceAddr

func (b *Bay) SelectAudioSourceAddr(audioIP string, audioPort int, fmt *V2IPAudioFormat) error

SelectAudioSourceAddr routes the audio of this V2IP sink to a raw multicast address, optionally overriding the audio format. A zero port defaults to the standard V2IP audio port. video and ancillary streams are left unchanged.

func (*Bay) SelectAudioSourceByName

func (b *Bay) SelectAudioSourceByName(name string, format *V2IPAudioFormat) error

SelectAudioSourceByName routes audio from the input bay with the given user-assigned name. When fmt is non-nil the manual switch frame is used so the receiver's sample rate / channel count can be overridden. V2IP sinks only.

func (*Bay) SelectEdidProfile

func (b *Bay) SelectEdidProfile(profile EdidProfile) error

SelectEdidProfile sets the EDID profile of this input bay.

func (*Bay) SelectVideoSource

func (b *Bay) SelectVideoSource(port int) error

SelectVideoSource routes the video source of this output bay to the given source port. Only V2IP sinks are supported.

func (*Bay) SelectVideoSourceByUserName

func (b *Bay) SelectVideoSourceByUserName(name string) error

SelectVideoSourceByUserName routes video from the input bay with the given user-assigned name. Only V2IP sinks are supported.

func (*Bay) SetHidden

func (b *Bay) SetHidden(hidden bool) error

SetHidden hides or shows this bay.

func (*Bay) SetName

func (b *Bay) SetName(name string) error

SetName sets the user-assigned name of this bay.

func (*Bay) SetZoneSettings

func (b *Bay) SetZoneSettings(s AmpZoneSettings) error

SetZoneSettings applies amplifier zone settings to this bay.

func (*Bay) SignalDetected

func (b *Bay) SignalDetected() bool

SignalDetected reports whether a signal is present.

func (*Bay) SignalType

func (b *Bay) SignalType() string

SignalType returns the current signal type description.

func (*Bay) String

func (b *Bay) String() string

func (*Bay) TxAction

func (b *Bay) TxAction(action RCAction) error

TxAction sends a remote-control action targeting this bay.

func (*Bay) UserName

func (b *Bay) UserName() string

UserName returns the user-assigned name, falling back to the bay name.

func (*Bay) V2IPSource

func (b *Bay) V2IPSource() *V2IPStreamSources

V2IPSource returns the V2IP stream addresses advertised by this source bay.

func (*Bay) V2IPUID

func (b *Bay) V2IPUID() DeviceUID

V2IPUID returns the source device UID this V2IP bay maps to (from bay mappings), or the zero UID.

func (*Bay) VideoRouteEndpoint

func (b *Bay) VideoRouteEndpoint() string

VideoRouteEndpoint returns the raw "ip:port" of an active V2IP sink video subscription that maps to no known source bay, or "".

func (*Bay) VideoSource

func (b *Bay) VideoSource() *Bay

VideoSource returns the currently routed video source bay, or nil.

func (*Bay) Volume

func (b *Bay) Volume() (int, bool)

Volume returns the current volume percentage. ok is false when unknown.

func (*Bay) VolumeDown

func (b *Bay) VolumeDown() error

VolumeDown lowers the volume by one step.

func (*Bay) VolumeSet

func (b *Bay) VolumeSet(volume int, muted *bool) error

VolumeSet sets the volume (0-100) and optional mute state of this bay.

func (*Bay) VolumeStatus

func (b *Bay) VolumeStatus() *VolumeMuteStatus

VolumeStatus returns the current volume/mute state, or nil if unknown.

func (*Bay) VolumeUp

func (b *Bay) VolumeUp() error

VolumeUp raises the volume by one step.

type BayFeaturesMask

type BayFeaturesMask uint32

BayFeaturesMask is the bitmask of a bay's capabilities.

const (
	BayHDMIOut          BayFeaturesMask = 1 << 0
	BayHDMIIn           BayFeaturesMask = 1 << 1
	BayAudioDigOut      BayFeaturesMask = 1 << 2
	BayAudioDigIn       BayFeaturesMask = 1 << 3
	BayAudioAnaOut      BayFeaturesMask = 1 << 4
	BayAudioAnaIn       BayFeaturesMask = 1 << 5
	BayIRIn             BayFeaturesMask = 1 << 6
	BayIROut            BayFeaturesMask = 1 << 7
	BayAudioAmpOut      BayFeaturesMask = 1 << 8
	BayRCOut            BayFeaturesMask = 1 << 9
	BayRCIn             BayFeaturesMask = 1 << 10
	BayDolby            BayFeaturesMask = 1 << 11
	BayAutoOff          BayFeaturesMask = 1 << 12
	BayV2IPSourceRemote BayFeaturesMask = 1 << 13
	BayV2IPSinkRemote   BayFeaturesMask = 1 << 14
	BayV2IPSourceLocal  BayFeaturesMask = 1 << 15
	BayV2IPSinkLocal    BayFeaturesMask = 1 << 16
)

func (BayFeaturesMask) Has

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

BayLink is a virtual link between two bays on two devices (e.g. an amp output linked to a OneIP sink). All exported methods are safe for concurrent use.

func (*BayLink) Configured

func (l *BayLink) Configured() bool

Configured reports whether a link has been set up.

func (*BayLink) IsAudio

func (l *BayLink) IsAudio() bool

IsAudio reports whether this link carries audio.

func (*BayLink) IsVideo

func (l *BayLink) IsVideo() bool

IsVideo reports whether this link carries HDMI video.

func (*BayLink) LinkedBay

func (l *BayLink) LinkedBay() *Bay

LinkedBay returns the bay on the other end of this link, or nil.

func (*BayLink) LinkedBayName

func (l *BayLink) LinkedBayName() string

LinkedBayName returns the name of the linked bay.

func (*BayLink) Serial

func (l *BayLink) Serial() string

Serial returns the serial of the linked device.

type BayMirrorStatus

type BayMirrorStatus struct {
	Target *BayUID
}

BayMirrorStatus describes whether an output bay mirrors another device's output, and which one. The zero value means "not mirroring".

func (BayMirrorStatus) IsMirroring

func (m BayMirrorStatus) IsMirroring() bool

IsMirroring reports whether this bay mirrors another.

type BayStatusMask

type BayStatusMask uint32

BayStatusMask is the bitmask of a bay's live status flags. Note that bits 16-19 (RC type) and 22-23 (HDCP) are bit-fields, not flags; use BayStatusRCType and BayStatusHDCP to extract them.

const (
	BayStatusFault          BayStatusMask = 1 << 0
	BayStatusHidden         BayStatusMask = 1 << 1
	BayStatusPowered        BayStatusMask = 1 << 2
	BayStatusSignalDetected BayStatusMask = 1 << 3
	BayStatusHPDDetected    BayStatusMask = 1 << 4
	BayStatusSignalScramble BayStatusMask = 1 << 5
	BayStatusHDBTConnected  BayStatusMask = 1 << 6
	BayStatusCECDetected    BayStatusMask = 1 << 7
	BayStatusPoweredOn      BayStatusMask = 1 << 8
	BayStatusPoweredOff     BayStatusMask = 1 << 9
	BayStatusAudioARCHDMI   BayStatusMask = 1 << 10
	BayStatusAudioARCOptic  BayStatusMask = 1 << 11
	BayStatusAudioARCAnalog BayStatusMask = 1 << 12
	BayStatusOffline        BayStatusMask = 1 << 13
	BayStatusDecoderDisable BayStatusMask = 1 << 14
	BayStatusEncoderDisable BayStatusMask = 1 << 15
	BayStatusCECDisabled    BayStatusMask = 1 << 20
	BayStatusEncoderError   BayStatusMask = 1 << 21
)

func (BayStatusMask) Has

func (b BayStatusMask) Has(f BayStatusMask) bool

type BayUID

type BayUID struct {
	Device DeviceUID
	Port   int
}

BayUID identifies a single bay (port) by its owning device and port number.

func (BayUID) String

func (b BayUID) String() string

type Callbacks

type Callbacks struct {
	// Device-level events.
	OnDeviceConfigChanged       func(d *Device)
	OnDeviceConfigComplete      func(d *Device)
	OnDeviceOnlineStatusChanged func(d *Device, online bool)
	OnDeviceTemperatureChanged  func(d *Device)
	OnDeviceUpdate              func(d *Device)

	// Bay-level events.
	OnBayRegistered               func(b *Bay)
	OnBayUpdate                   func(b *Bay)
	OnVideoSourceChanged          func(b *Bay, videoSource *Bay)
	OnAudioSourceChanged          func(b *Bay, audioSource *Bay)
	OnVolumeChanged               func(b *Bay, volume *VolumeMuteStatus)
	OnPowerChanged                func(b *Bay, power PowerStatus)
	OnNameChanged                 func(b *Bay, name string)
	OnStatusSignalDetectedChanged func(b *Bay, detected bool)
	OnStatusFaultyChanged         func(b *Bay, faulty bool)
	OnStatusHiddenChanged         func(b *Bay, hidden bool)
	OnStatusPoePoweredChanged     func(b *Bay, powered bool)
	OnStatusHdbtConnectedChanged  func(b *Bay, connected bool)
	OnStatusSignalTypeChanged     func(b *Bay, signalType string)
	OnStatusHpdDetectedChanged    func(b *Bay, detected bool)
	OnStatusCecDetectedChanged    func(b *Bay, detected bool)
	OnStatusArcChanged            func(b *Bay, arc string)
	OnEdidProfileChanged          func(b *Bay, profile EdidProfile)
	OnRcTypeChanged               func(b *Bay, rcType RCType)
	OnKeyPressed                  func(b *Bay, key RCKey)
	OnActionReceived              func(b *Bay, action RCAction)
	OnMirrorStatusChanged         func(b *Bay, mirror BayMirrorStatus)
	OnBayLinked                   func(b *Bay, linkedSerial, linkedBay string, features LinkFeature)
	OnBayUnlinked                 func(b *Bay, linkedSerial, linkedBay string)
	OnAmpZoneSettingsChanged      func(b *Bay, settings AmpZoneSettings)
	OnAmpDolbySettingsChanged     func(d *Device, settings AmpDolbySettings)
}

Callbacks holds optional event handlers invoked when device or bay state changes. Every field is optional; leave a field nil to ignore that event.

Handlers are invoked sequentially from a single dispatcher goroutine, so they must not block for long. It is safe to call Remote/Device/Bay methods from a handler.

type Config

type Config struct {
	// TargetIP is the multicast/broadcast destination. Empty uses the default
	// (multicast 224.8.8.8, or the interface broadcast address when Broadcast).
	TargetIP string
	// Port is the UDP port. Zero uses the default for the selected mode.
	Port int
	// LocalIP binds to a specific interface. Empty picks the first non-loopback.
	LocalIP string
	// Interface is the network interface name (e.g. "br_v8") for multicast
	// discovery. When set it takes precedence over LocalIP and works even on an
	// interface with no IPv4 address (tagged VLANs): membership and egress are
	// keyed by interface index. Linux only; on macOS/Windows the interface must
	// have an IPv4 address. Empty keeps the LocalIP behaviour.
	Interface string
	// Broadcast uses broadcast instead of multicast.
	Broadcast bool
	// Name is advertised on the network.
	Name string
	// Callbacks receives state-change events.
	Callbacks Callbacks
}

Config configures a Remote.

type ConnectStatus

type ConnectStatus int

ConnectStatus is the connect / signal-detect state reported for a bay.

const (
	ConnectUnknown ConnectStatus = 0
	Connected      ConnectStatus = 1
	Disconnected   ConnectStatus = 2
)

func (ConnectStatus) String

func (c ConnectStatus) String() string

type Device

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

Device is a discovered device on the MX Remote network (matrix, OneIP unit or amplifier). All exported methods are safe for concurrent use.

func (*Device) Address

func (d *Device) Address() string

Address returns the device IP address.

func (*Device) AmpDolbyChannels

func (d *Device) AmpDolbyChannels() int

AmpDolbyChannels returns the number of Dolby-capable channels on an amplifier.

func (*Device) AudioEndpointByID

func (d *Device) AudioEndpointByID(id int) *AudioEndpoint

AudioEndpointByID returns the audio endpoint with the given id, or nil.

func (*Device) AudioEndpoints

func (d *Device) AudioEndpoints() *AudioEndpoints

AudioEndpoints returns the device's audio endpoint collection, or nil.

func (*Device) AudioMute

func (d *Device) AudioMute(endpointID int, mute bool) error

AudioMute sets the mute state of an audio endpoint on this device.

func (*Device) AudioSelectInput

func (d *Device) AudioSelectInput(sinkEP *AudioEndpoint, source DeviceUID, sourceEP *AudioEndpoint) error

AudioSelectInput routes a source endpoint (on the given source device) to a sink endpoint on this device.

func (*Device) AudioTrigger

func (d *Device) AudioTrigger(endpointID int, trigger bool) error

AudioTrigger sets the trigger state of an audio endpoint on this device.

func (*Device) AudioVolumeSet

func (d *Device) AudioVolumeSet(endpointID, volume int) error

AudioVolumeSet sets the volume of an audio endpoint on this device.

func (*Device) Bays

func (d *Device) Bays() map[int]*Bay

Bays returns all bays keyed by port number.

func (*Device) ConfigurationComplete

func (d *Device) ConfigurationComplete() bool

ConfigurationComplete reports whether all configuration has been received.

func (*Device) DolbySettings

func (d *Device) DolbySettings() *AmpDolbySettings

DolbySettings returns the amplifier Dolby settings, or nil.

func (*Device) Features

func (d *Device) Features() DeviceFeature

Features returns the device feature bitmask.

func (*Device) FirmwareVersions

func (d *Device) FirmwareVersions() map[FirmwareType]FirmwareVersion

FirmwareVersions returns the V2IP firmware components keyed by type.

func (*Device) FirstInput

func (d *Device) FirstInput() *Bay

FirstInput returns the first input bay, or nil.

func (*Device) FirstOutput

func (d *Device) FirstOutput() *Bay

FirstOutput returns the first output bay, or nil.

func (*Device) GetByPortname

func (d *Device) GetByPortname(name string) *Bay

GetByPortname returns the bay with the given port name, or nil.

func (*Device) GetByPortnum

func (d *Device) GetByPortnum(portnum int) *Bay

GetByPortnum returns the bay with the given port number, or nil.

func (*Device) Inputs

func (d *Device) Inputs() []*Bay

Inputs returns all visible input bays, ordered by port number.

func (*Device) IsAmp

func (d *Device) IsAmp() bool

IsAmp reports whether this is an amplifier.

func (*Device) IsAudioMatrix

func (d *Device) IsAudioMatrix() bool

IsAudioMatrix reports whether this is an audio-only matrix.

func (*Device) IsMeshMaster

func (d *Device) IsMeshMaster() bool

IsMeshMaster reports whether this device is the mesh controller.

func (*Device) IsMeshMember

func (d *Device) IsMeshMember() bool

IsMeshMember reports whether this device is a mesh member.

func (*Device) IsOneIPMultiviewer

func (d *Device) IsOneIPMultiviewer() bool

IsOneIPMultiviewer reports whether this is a OneIP multiviewer.

func (*Device) IsOneIPRx

func (d *Device) IsOneIPRx() bool

IsOneIPRx reports whether this is a OneIP receiver.

func (*Device) IsOneIPTx

func (d *Device) IsOneIPTx() bool

IsOneIPTx reports whether this is a OneIP transmitter.

func (*Device) IsOneIPTz

func (d *Device) IsOneIPTz() bool

IsOneIPTz reports whether this is a OneIP transceiver.

func (*Device) IsV2IP

func (d *Device) IsV2IP() bool

IsV2IP reports whether this is a OneIP/V2IP device.

func (*Device) IsVideoMatrix

func (d *Device) IsVideoMatrix() bool

IsVideoMatrix reports whether this is a video matrix.

func (*Device) MACAddress

func (d *Device) MACAddress() string

MACAddress returns the first non-zero MAC address reported by a network port, or "".

func (*Device) MeshMaster

func (d *Device) MeshMaster() *Device

MeshMaster returns the mesh controller device. For non-V2IP devices or when the master is unknown it returns the device itself.

func (*Device) ModelName

func (d *Device) ModelName() string

ModelName returns a friendly model name.

func (*Device) Multiviewer

func (d *Device) Multiviewer() *Multiviewer

Multiviewer returns the multiviewer controller for this device.

func (*Device) Name

func (d *Device) Name() string

Name returns the device name.

func (*Device) NetworkStatus

func (d *Device) NetworkStatus() map[int]NetworkPortStatus

NetworkStatus returns the network port status keyed by port id.

func (*Device) Online

func (d *Device) Online() bool

Online reports whether the device has pinged recently.

func (*Device) Outputs

func (d *Device) Outputs() []*Bay

Outputs returns all output bays, ordered by port number.

func (*Device) Protocol

func (d *Device) Protocol() int

Protocol returns the protocol version the device supports.

func (*Device) ReadStats

func (d *Device) ReadStats(enable bool) error

ReadStats enables or disables V2IP statistics reporting on the device.

func (*Device) Reboot

func (d *Device) Reboot() error

Reboot reboots the device.

func (*Device) RegisterCallback

func (d *Device) RegisterCallback(fn func(*Device))

RegisterCallback registers fn to be called whenever this device changes.

func (*Device) Serial

func (d *Device) Serial() string

Serial returns the device serial number.

func (*Device) Status

func (d *Device) Status() DeviceStatus

Status returns the high-level device status.

func (*Device) StatusMessage

func (d *Device) StatusMessage() string

StatusMessage returns a human-readable health summary combining the device status, crash flag, and any system-status message.

func (*Device) String

func (d *Device) String() string

func (*Device) SystemStatus

func (d *Device) SystemStatus() (status int, message string, ok bool)

SystemStatus returns the device's numeric status code and message. ok is false when no system-status report has been received.

func (*Device) Temperatures

func (d *Device) Temperatures() map[string]int

Temperatures returns the named temperature sensor readings.

func (*Device) Topology

func (d *Device) Topology() []TopologyEntry

Topology returns the most recent topology report from this device.

func (*Device) UID

func (d *Device) UID() DeviceUID

UID returns the device unique id.

func (*Device) V2IPDetails

func (d *Device) V2IPDetails() *DeviceV2IPDetails

V2IPDetails returns the device's V2IP encoder/decoder configuration, or nil.

func (*Device) V2IPSink

func (d *Device) V2IPSink() *DeviceV2IPSink

V2IPSink returns the device's current sink subscription, or nil.

func (*Device) V2IPSourceLocal

func (d *Device) V2IPSourceLocal() *V2IPStreamSources

V2IPSourceLocal returns the V2IP stream sources of this device's local input, or nil.

func (*Device) V2IPSources

func (d *Device) V2IPSources() []V2IPStreamSources

V2IPSources returns the V2IP stream sources advertised by this device, or nil.

func (*Device) V2IPStats

func (d *Device) V2IPStats() *V2IPDeviceStats

V2IPStats returns the most recent V2IP statistics, or nil.

func (*Device) Version

func (d *Device) Version() string

Version returns the firmware version string.

type DeviceFeature

type DeviceFeature uint32

DeviceFeature is the bitmask of capabilities a device reports in its hello frame.

const (
	FeatureIRRx           DeviceFeature = 1 << 0
	FeatureIRTx           DeviceFeature = 1 << 1
	FeatureCEC            DeviceFeature = 1 << 2
	FeatureV2IPSource     DeviceFeature = 1 << 3
	FeatureV2IPSink       DeviceFeature = 1 << 4
	FeatureVideoRouting   DeviceFeature = 1 << 5
	FeatureAudioRouting   DeviceFeature = 1 << 6
	FeatureVolumeControl  DeviceFeature = 1 << 7
	FeatureAudioReturn    DeviceFeature = 1 << 8
	FeatureRemoteControl  DeviceFeature = 1 << 9
	FeatureSetupCompleted DeviceFeature = 1 << 10
	FeatureMeshMaster     DeviceFeature = 1 << 11
	FeatureStatusNotify   DeviceFeature = 1 << 12
	FeatureStatusWarning  DeviceFeature = 1 << 13
	FeatureStatusError    DeviceFeature = 1 << 14
	FeatureStatusReboot   DeviceFeature = 1 << 15
	FeatureMeshMember     DeviceFeature = 1 << 16
	FeatureAudioAmplifier DeviceFeature = 1 << 17
	FeatureBooting        DeviceFeature = 1 << 18
	FeatureManager        DeviceFeature = 1 << 19
	FeatureStatusPowSave  DeviceFeature = 1 << 20
	FeatureMesh           DeviceFeature = 1 << 21
	FeatureMultiviewer    DeviceFeature = 1 << 22
	FeatureStatusCrashed  DeviceFeature = 1 << 23
	FeatureBootBit        DeviceFeature = 1 << 31
)

func (DeviceFeature) Has

func (d DeviceFeature) Has(f DeviceFeature) bool

Has reports whether all bits in f are set.

type DeviceStatus

type DeviceStatus int

DeviceStatus is the high-level state of a device or bay on the network.

const (
	StatusOnline    DeviceStatus = 0
	StatusOffline   DeviceStatus = 1
	StatusRebooting DeviceStatus = 2
	StatusBooting   DeviceStatus = 3
	StatusInactive  DeviceStatus = 4
)

func (DeviceStatus) String

func (s DeviceStatus) String() string

type DeviceUID

type DeviceUID [16]byte

DeviceUID is the 16-byte unique identifier of an MX Remote device on the network. The zero value is the empty (all-zero) UID.

func DeviceUIDFromBytes

func DeviceUIDFromBytes(b []byte) (DeviceUID, error)

DeviceUIDFromBytes builds a UID from raw bytes. An empty slice yields the zero UID; any other length shorter than 16 is an error.

func ParseDeviceUID

func ParseDeviceUID(s string) (DeviceUID, error)

ParseDeviceUID parses the human-readable "aaaaaaaa.bbbbbbbb.cccccccc.dddddddd" form (four little-endian 32-bit words printed big-endian in hex) into a UID.

func (DeviceUID) Bytes

func (u DeviceUID) Bytes() []byte

Bytes returns the raw 16-byte value.

func (DeviceUID) Empty

func (u DeviceUID) Empty() bool

Empty reports whether the UID is all zero.

func (DeviceUID) String

func (u DeviceUID) String() string

String returns the human-readable dotted-hex form.

type DeviceV2IPDetails

type DeviceV2IPDetails struct {
	Video   V2IPStreamSource
	Audio   V2IPStreamSource
	Anc     V2IPStreamSource
	Arc     V2IPStreamSource
	TxRate  uint8
	Scaling V2IPScalingSettings
}

DeviceV2IPDetails is the local encoder/decoder configuration of a V2IP device.

type DeviceV2IPSink

type DeviceV2IPSink struct {
	Addresses V2IPStreamSources
	AudioFmt  *V2IPAudioFormat
}

DeviceV2IPSink is the sink-side route a V2IP device is currently subscribed to.

type EdidProfile

type EdidProfile int

EdidProfile is an EDID preset selectable on an HDMI input.

const (
	Edid1080PStereo     EdidProfile = 0
	EdidFixed           EdidProfile = 1
	Edid4K              EdidProfile = 2
	Edid1080P51         EdidProfile = 3
	Edid720P            EdidProfile = 4
	Edid1080P71         EdidProfile = 5
	Edid4K71            EdidProfile = 6
	Edid4KHDRStereo     EdidProfile = 7
	Edid4KHDR71         EdidProfile = 8
	Edid4KHDRAVROnly    EdidProfile = 9
	EdidLowestCommon    EdidProfile = 10
	EdidLowestCommonAll EdidProfile = 11
	Edid4KHDRAtmos      EdidProfile = 12
	EdidSink1           EdidProfile = 101
	EdidSink32          EdidProfile = 132
	EdidCustom0         EdidProfile = 500
	EdidUnknown         EdidProfile = 0xFFF
)

func (EdidProfile) String

func (e EdidProfile) String() string

type FirmwareType

type FirmwareType int

FirmwareType identifies a firmware component.

const (
	FirmwareUnknown        FirmwareType = 0
	FirmwareFPGA           FirmwareType = 1
	FirmwareLinux          FirmwareType = 2
	FirmwareLoadingOverlay FirmwareType = 3
)

func (FirmwareType) String

func (f FirmwareType) String() string

type FirmwareVersion

type FirmwareVersion struct {
	Type      FirmwareType
	Timestamp int64
	Version   string
	Hash      uint32
}

FirmwareVersion describes a firmware component reported by a device.

func (FirmwareVersion) String

func (f FirmwareVersion) String() string

type HiddenStatus

type HiddenStatus int

HiddenStatus is the visibility state of a bay.

const (
	HiddenUnknown HiddenStatus = 0
	Hidden        HiddenStatus = 1
	Visible       HiddenStatus = 2
)

func (HiddenStatus) String

func (h HiddenStatus) String() string

type LinkFeature

type LinkFeature uint32

LinkFeature is the bitmask of media carried by a virtual link.

const (
	LinkNone         LinkFeature = 0
	LinkVideoHDMI    LinkFeature = 1 << 0
	LinkAudioOptical LinkFeature = 1 << 1
	LinkAudioAnalog  LinkFeature = 1 << 2
	LinkIR           LinkFeature = 1 << 3
	LinkRC           LinkFeature = 1 << 4
)

func (LinkFeature) Has

func (l LinkFeature) Has(f LinkFeature) bool

type Multiviewer

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

Multiviewer provides read access and control for a OneIP multiviewer device. Obtain one from Device.Multiviewer. All methods are safe for concurrent use; control methods are no-ops (returning an error) on non-multiviewer devices.

func (*Multiviewer) AudioMuted

func (m *Multiviewer) AudioMuted() MultiviewerBool

AudioMuted returns the output mute state.

func (*Multiviewer) AudioSource

func (m *Multiviewer) AudioSource() MultiviewerSource

AudioSource returns the screen whose audio is selected.

func (*Multiviewer) AudioVolume

func (m *Multiviewer) AudioVolume() int

AudioVolume returns the output volume (0-100), or -1 when unknown.

func (*Multiviewer) AutoRoute

func (m *Multiviewer) AutoRoute() error

AutoRoute triggers automatic source routing.

func (*Multiviewer) AutoSwitch

func (m *Multiviewer) AutoSwitch() MultiviewerBool

AutoSwitch returns whether auto-switching is enabled.

func (*Multiviewer) ConnectedSource

func (m *Multiviewer) ConnectedSource(input int) (DeviceUID, bool)

ConnectedSource returns the device UID mapped to the given multiviewer input.

func (*Multiviewer) EdidTemplate

func (m *Multiviewer) EdidTemplate() MultiviewerEDIDTemplate

EdidTemplate returns the active EDID template.

func (*Multiviewer) HDCPMode

func (m *Multiviewer) HDCPMode() MultiviewerHDCPMode

HDCPMode returns the HDCP mode.

func (*Multiviewer) MCUVersion

func (m *Multiviewer) MCUVersion() string

MCUVersion returns the multiviewer MCU firmware version.

func (*Multiviewer) OutputITCMode

func (m *Multiviewer) OutputITCMode() MultiviewerITCMode

OutputITCMode returns the output IT-content mode.

func (*Multiviewer) OutputMode

func (m *Multiviewer) OutputMode() MultiviewerOutputMode

OutputMode returns the output resolution/refresh mode.

func (*Multiviewer) PipPosition

func (m *Multiviewer) PipPosition() MultiviewerPipPosition

PipPosition returns the picture-in-picture window position.

func (*Multiviewer) PipSize

func (m *Multiviewer) PipSize() MultiviewerPipSize

PipSize returns the picture-in-picture window size.

func (*Multiviewer) RemoteControl

func (m *Multiviewer) RemoteControl() MultiviewerSource

RemoteControl returns the screen receiving remote-control passthrough.

func (*Multiviewer) ScalerVersion

func (m *Multiviewer) ScalerVersion() string

ScalerVersion returns the multiviewer scaler firmware version.

func (*Multiviewer) ScreenAspect

func (m *Multiviewer) ScreenAspect() MultiviewerAspectRatio

ScreenAspect returns the output aspect ratio.

func (*Multiviewer) SetAudioSource

func (m *Multiviewer) SetAudioSource(source MultiviewerSource) error

SetAudioSource selects which screen's audio to output.

func (*Multiviewer) SetAudioVolume

func (m *Multiviewer) SetAudioVolume(volume int, muted bool) error

SetAudioVolume sets the output volume and mute state.

func (*Multiviewer) SetAutoSwitch

func (m *Multiviewer) SetAutoSwitch(enable bool) error

SetAutoSwitch enables or disables auto-switching.

func (*Multiviewer) SetConnectedSource

func (m *Multiviewer) SetConnectedSource(input int, source DeviceUID) error

SetConnectedSource maps a source device UID to a multiviewer input. Pass the zero UID to clear the mapping.

func (*Multiviewer) SetEdidTemplate

func (m *Multiviewer) SetEdidTemplate(e MultiviewerEDIDTemplate) error

SetEdidTemplate sets the EDID template.

func (*Multiviewer) SetHDCPMode

func (m *Multiviewer) SetHDCPMode(h MultiviewerHDCPMode) error

SetHDCPMode sets the HDCP mode.

func (*Multiviewer) SetOutputITCMode

func (m *Multiviewer) SetOutputITCMode(o MultiviewerITCMode) error

SetOutputITCMode sets the output IT-content mode.

func (*Multiviewer) SetOutputMode

func (m *Multiviewer) SetOutputMode(o MultiviewerOutputMode) error

SetOutputMode sets the output resolution/refresh mode.

func (*Multiviewer) SetPipPosition

func (m *Multiviewer) SetPipPosition(p MultiviewerPipPosition) error

SetPipPosition sets the PIP window position.

func (*Multiviewer) SetPipSize

func (m *Multiviewer) SetPipSize(s MultiviewerPipSize) error

SetPipSize sets the PIP window size.

func (*Multiviewer) SetRemoteControl

func (m *Multiviewer) SetRemoteControl(source MultiviewerSource) error

SetRemoteControl sets which screen receives remote-control passthrough.

func (*Multiviewer) SetScreenAspect

func (m *Multiviewer) SetScreenAspect(a MultiviewerAspectRatio) error

SetScreenAspect sets the output aspect ratio.

func (*Multiviewer) SetVideoSource

func (m *Multiviewer) SetVideoSource(screen int, source MultiviewerSource) error

SetVideoSource assigns a source to a screen.

func (*Multiviewer) SetViewMode

func (m *Multiviewer) SetViewMode(v MultiviewerViewMode) error

SetViewMode sets the screen layout mode.

func (*Multiviewer) VideoSource

func (m *Multiviewer) VideoSource(screen int) MultiviewerSource

VideoSource returns the source assigned to the given screen index.

func (*Multiviewer) ViewMode

func (m *Multiviewer) ViewMode() MultiviewerViewMode

ViewMode returns the current screen layout mode.

type MultiviewerAspectRatio

type MultiviewerAspectRatio int

Multiviewer aspect ratio.

const (
	MVAspectUnknown MultiviewerAspectRatio = 0
	MVAspectFull    MultiviewerAspectRatio = 1
	MVAspect16x9    MultiviewerAspectRatio = 2
)

type MultiviewerBool

type MultiviewerBool int

MultiviewerBool is a tri-state on/off/unknown setting.

const (
	MVBoolOff     MultiviewerBool = 0
	MVBoolOn      MultiviewerBool = 1
	MVBoolUnknown MultiviewerBool = 0xFF
)

type MultiviewerEDIDTemplate

type MultiviewerEDIDTemplate int

Multiviewer EDID template.

const (
	MVEdidUnknown MultiviewerEDIDTemplate = 0
)

type MultiviewerHDCPMode

type MultiviewerHDCPMode int

Multiviewer HDCP mode.

const (
	MVHDCPUnknown MultiviewerHDCPMode = 0
	MVHDCPV14     MultiviewerHDCPMode = 1
	MVHDCPV22     MultiviewerHDCPMode = 2
)

type MultiviewerITCMode

type MultiviewerITCMode int

Multiviewer IT-content mode.

const (
	MVITCUnknown MultiviewerITCMode = 0
	MVITCVideo   MultiviewerITCMode = 1
	MVITCPC      MultiviewerITCMode = 2
)

type MultiviewerOutputMode

type MultiviewerOutputMode int

Multiviewer output resolution/refresh mode.

const (
	MVOutUnknown        MultiviewerOutputMode = 0
	MVOut4096x2160P60   MultiviewerOutputMode = 1
	MVOut4096x2160P50   MultiviewerOutputMode = 2
	MVOut3840x2160P60   MultiviewerOutputMode = 3
	MVOut3840x2160P50   MultiviewerOutputMode = 4
	MVOut3840x2160P30   MultiviewerOutputMode = 5
	MVOut3840x2160P25   MultiviewerOutputMode = 6
	MVOut1920x1200P60RB MultiviewerOutputMode = 7
	MVOut1920x1080P60   MultiviewerOutputMode = 8
	MVOut1920x1080P50   MultiviewerOutputMode = 9
	MVOut1360x768P60    MultiviewerOutputMode = 10
	MVOut1280x800P60    MultiviewerOutputMode = 11
	MVOut1280x720P60    MultiviewerOutputMode = 12
	MVOut1280x720P50    MultiviewerOutputMode = 13
	MVOut1024x768P60    MultiviewerOutputMode = 14
)

type MultiviewerPipPosition

type MultiviewerPipPosition int

Multiviewer picture-in-picture position.

const (
	MVPipPosUnknown     MultiviewerPipPosition = 0
	MVPipPosLeftTop     MultiviewerPipPosition = 1
	MVPipPosLeftBottom  MultiviewerPipPosition = 2
	MVPipPosRightTop    MultiviewerPipPosition = 3
	MVPipPosRightBottom MultiviewerPipPosition = 4
)

type MultiviewerPipSize

type MultiviewerPipSize int

Multiviewer picture-in-picture size.

const (
	MVPipSizeUnknown MultiviewerPipSize = 0
	MVPipSizeSmall   MultiviewerPipSize = 1
	MVPipSizeMedium  MultiviewerPipSize = 2
	MVPipSizeLarge   MultiviewerPipSize = 3
)

type MultiviewerSource

type MultiviewerSource int

Multiviewer input source selection.

const (
	MVSourceUnknown MultiviewerSource = 0
	MVSource1       MultiviewerSource = 1
	MVSource2       MultiviewerSource = 2
	MVSource3       MultiviewerSource = 3
	MVSource4       MultiviewerSource = 4
)

type MultiviewerViewMode

type MultiviewerViewMode int

Multiviewer view layout modes.

const (
	MVViewUnknown          MultiviewerViewMode = 0
	MVViewSingle           MultiviewerViewMode = 1
	MVViewPIP              MultiviewerViewMode = 2
	MVViewTwoScreenLarge   MultiviewerViewMode = 3
	MVViewTwoScreenSmall   MultiviewerViewMode = 4
	MVViewThreeScreenLarge MultiviewerViewMode = 5
	MVViewThreeScreenSmall MultiviewerViewMode = 6
	MVViewFourScreenLarge  MultiviewerViewMode = 7
	MVViewFourScreenSmall  MultiviewerViewMode = 8
)

type MuteStatus

type MuteStatus uint8

MuteStatus decodes the per-channel mute bitfield (bit0=left, bit1=right).

func (MuteStatus) Left

func (m MuteStatus) Left() bool

func (MuteStatus) Muted

func (m MuteStatus) Muted() bool

func (MuteStatus) Right

func (m MuteStatus) Right() bool

type NetworkPortStatus

type NetworkPortStatus struct {
	Port           int
	Name           string
	LinkSpeed      UtpLinkSpeed
	LinkFullDuplex bool
	IP             string
	Querier        string
	MACAddress     string
	Errors         *UtpLinkErrors
	VCTStatus      []string
	CableStatus    []UtpCableStatus
}

NetworkPortStatus describes the link state and diagnostics of a network port. Optional fields (Errors, VCTStatus, CableStatus) are nil when the port or firmware does not report them.

type PowerStatus

type PowerStatus int

PowerStatus is the CEC power state of a device connected to a bay.

const (
	PowerUnknown PowerStatus = 0
	PowerOn      PowerStatus = 1
	PowerOff     PowerStatus = 2
)

func (PowerStatus) String

func (p PowerStatus) String() string

type RCAction

type RCAction int

RCAction is a remote-control action.

const (
	ActionPowerToggle RCAction = 0
	ActionPowerOn     RCAction = 1
	ActionPowerOff    RCAction = 2
	ActionVolumeDown  RCAction = 3
	ActionVolumeUp    RCAction = 4
	ActionVolumeMute  RCAction = 5
)

type RCKey

type RCKey int

RCKey is a remote-control key code (CEC/IR).

const (
	KeyNum0          RCKey = 0
	KeyNum1          RCKey = 1
	KeyNum2          RCKey = 2
	KeyNum3          RCKey = 3
	KeyNum4          RCKey = 4
	KeyNum5          RCKey = 5
	KeyNum6          RCKey = 6
	KeyNum7          RCKey = 7
	KeyNum8          RCKey = 8
	KeyNum9          RCKey = 9
	KeySelect        RCKey = 10
	KeyBack          RCKey = 11
	KeyUp            RCKey = 12
	KeyDown          RCKey = 13
	KeyLeft          RCKey = 14
	KeyRight         RCKey = 15
	KeyMenu          RCKey = 16
	KeyContentMenu   RCKey = 17
	KeyChannelUp     RCKey = 18
	KeyChannelDown   RCKey = 19
	KeyPlay          RCKey = 20
	KeyPause         RCKey = 21
	KeyStop          RCKey = 22
	KeyRecord        RCKey = 23
	KeyFastForward   RCKey = 24
	KeyRewind        RCKey = 25
	KeyRed           RCKey = 26
	KeyGreen         RCKey = 27
	KeyYellow        RCKey = 28
	KeyBlue          RCKey = 29
	KeyHelp          RCKey = 30
	KeyInformation   RCKey = 31
	KeyText          RCKey = 32
	KeyGuide         RCKey = 33
	KeyVideoOnDemand RCKey = 34
	KeyPreviousChan  RCKey = 80
	Key3DMode        RCKey = 81
	KeySubtitle      RCKey = 82
	KeySoundSelect   RCKey = 83
	KeyInputSelect   RCKey = 84
	KeyEject         RCKey = 85
	KeyNextChapter   RCKey = 86
	KeyPrevChapter   RCKey = 87
	KeyInteractive   RCKey = 128
	KeySearch        RCKey = 129
	KeySky           RCKey = 130
	KeyCustomCEC     RCKey = 1280
	KeyCustomSky     RCKey = 2048
)

type RCType

type RCType int

RCType is the remote-control protocol of a connected sink/source.

const (
	RCTypeIR       RCType = 0
	RCTypeCEC      RCType = 1
	RCTypeSkyUK    RCType = 2
	RCTypeTiVo     RCType = 3
	RCTypeKodi     RCType = 4
	RCTypeDish     RCType = 5
	RCTypeDirecTV  RCType = 6
	RCTypeMXRemote RCType = 7
)

func (RCType) String

func (r RCType) String() string

type Remote

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

Remote is the main entry point. It manages the UDP connection, discovers devices, and maintains the device registry. Create one with New and start it with Start.

func New

func New(cfg Config) *Remote

New creates a Remote from cfg. Call Start to begin discovery.

func (*Remote) Close

func (r *Remote) Close() error

Close stops discovery and closes the connection.

func (*Remote) Devices

func (r *Remote) Devices() []*Device

Devices returns a snapshot of all discovered devices.

func (*Remote) GetBayByPortnum

func (r *Remote) GetBayByPortnum(uid DeviceUID, port int) *Bay

GetBayByPortnum returns the bay on the given device (by UID) and port, or nil.

func (*Remote) GetBySerial

func (r *Remote) GetBySerial(serial string) *Device

GetBySerial returns the device with the given serial number, or nil.

func (*Remote) GetByUID

func (r *Remote) GetByUID(uid DeviceUID) *Device

GetByUID returns the device with the given UID, or nil.

func (*Remote) GetByUIDString

func (r *Remote) GetByUIDString(s string) *Device

GetByUIDString resolves a device by its dotted-hex UID string, falling back to a serial-number match, mirroring the reference get_by_uid.

func (*Remote) Name

func (r *Remote) Name() string

Name returns the advertised name.

func (*Remote) SendMonitoringPulse

func (r *Remote) SendMonitoringPulse() error

SendMonitoringPulse broadcasts a monitoring pulse (opcode 0x2B), asking peers on the network to report their monitoring data immediately.

func (*Remote) Start

func (r *Remote) Start(ctx context.Context) error

Start loads the client UID, opens the connection and begins discovery. It returns once the listener is running; discovery continues in the background until Close. The ctx bounds the background goroutines' lifetime.

func (*Remote) UID

func (r *Remote) UID() DeviceUID

UID returns this client's unique id.

func (*Remote) UpdateConfig

func (r *Remote) UpdateConfig(localIP string, broadcast bool) error

UpdateConfig changes the local interface and/or multicast/broadcast mode at runtime, reconnecting if the network parameters changed.

type Svd

type Svd struct {
	ID               int
	PictureAspect    int
	PixelAspect      int
	HorizontalActive int
	HorizontalTotal  int
	VerticalActive   int
	VerticalTotal    int
	Refresh          int
	Interlaced       bool
	Multiplier       int
}

Svd is a Short Video Descriptor: a standard video resolution/timing entry.

func LookupSvd

func LookupSvd(id int) (Svd, bool)

LookupSvd returns the Short Video Descriptor for the given id.

func (Svd) String

func (s Svd) String() string

type TopologyEntry

type TopologyEntry struct {
	UID  DeviceUID
	Mask uint32
}

TopologyEntry is one device in a topology report: a device UID and the bitmask of devices it is connected to.

type UtpCableStatus

type UtpCableStatus struct {
	Polarity bool
	Pair     int
	Skew     uint32
	Length   uint32
}

UtpCableStatus is the diagnostic status of a single UTP cable pair.

type UtpLinkErrors

type UtpLinkErrors struct {
	InError       bool
	InFCSError    bool
	InCollision   bool
	OutDeferred   bool
	OutExcessive  bool
	PolarityError bool
	SkewWarning   bool
	LengthWarning bool
}

UtpLinkErrors is the decoded link-error bitmask for a network port.

type UtpLinkSpeed

type UtpLinkSpeed int

UtpLinkSpeed is the negotiated speed of a network port.

const (
	LinkSpeedUnknown UtpLinkSpeed = 0
	LinkSpeed10M     UtpLinkSpeed = 1
	LinkSpeed100M    UtpLinkSpeed = 2
	LinkSpeed200M    UtpLinkSpeed = 3
	LinkSpeed1G      UtpLinkSpeed = 4
)

func (UtpLinkSpeed) String

func (u UtpLinkSpeed) String() string

type V2IPAudioFormat

type V2IPAudioFormat struct {
	SampleRate uint32
	Channels   uint8
}

V2IPAudioFormat overrides the sample rate and channel count of a V2IP audio stream. Zero values mean "use the firmware default".

func (V2IPAudioFormat) String

func (f V2IPAudioFormat) String() string

type V2IPDecoderState

type V2IPDecoderState int

V2IPDecoderState is the health state of a V2IP decoder.

const (
	DecoderUnknown V2IPDecoderState = 0
	DecoderHealthy V2IPDecoderState = 1
	DecoderBad     V2IPDecoderState = 2
)

func (V2IPDecoderState) String

func (s V2IPDecoderState) String() string

type V2IPDeviceStats

type V2IPDeviceStats struct {
	Tx          V2IPTxStats
	TxPerMinute V2IPTxStats
	Rx          V2IPRxStats
	RxPerMinute V2IPRxStats
}

V2IPDeviceStats holds the cumulative and per-minute TX/RX statistics.

type V2IPRxStats

type V2IPRxStats struct {
	VideoTotal     uint32
	VideoDropped   uint32
	VideoSeqErrors uint32
	WdtTimeout     uint32
	AudioTotal     uint32
	AudioDropped   uint32
	AudioSeqErrors uint32
	AncTotal       uint32
	AncDropped     uint32
	AncSeqErrors   uint32
	DecoderState   V2IPDecoderState
}

V2IPRxStats holds receiver stream statistics.

type V2IPScalingSettings

type V2IPScalingSettings struct {
	Mode    uint16
	Refresh uint16
	Flags   uint8
}

V2IPScalingSettings holds a V2IP output's scaling mode, refresh rate and flags.

type V2IPStreamSource

type V2IPStreamSource struct {
	Label string
	IP    string
	Port  int
}

V2IPStreamSource is a single multicast stream address (video, audio, or ancillary).

func (V2IPStreamSource) String

func (s V2IPStreamSource) String() string

type V2IPStreamSources

type V2IPStreamSources struct {
	UID   DeviceUID
	Video V2IPStreamSource
	Audio V2IPStreamSource
	Anc   V2IPStreamSource
	Arc   *V2IPStreamSource
}

V2IPStreamSources groups the video, audio, ancillary and (optional) ARC streams advertised by a single V2IP source, with the originating device UID when known (zero UID means unknown).

func (V2IPStreamSources) String

func (s V2IPStreamSources) String() string

type V2IPTxStats

type V2IPTxStats struct {
	Video      uint32
	Audio      uint32
	Anc        uint32
	StreamDown uint32
	Overflow   uint32
}

V2IPTxStats holds transmitter stream statistics.

type VolumeMuteStatus

type VolumeMuteStatus struct {
	VolumeLeft  int
	VolumeRight int
	MutedLeft   *bool
	MutedRight  *bool
}

VolumeMuteStatus holds the volume and mute state of a bay. Left/right values of -1 mean "unknown".

func (VolumeMuteStatus) Muted

func (v VolumeMuteStatus) Muted() (bool, bool)

Muted reports the combined mute state. The second result is false when the mute state is unknown.

func (VolumeMuteStatus) Volume

func (v VolumeMuteStatus) Volume() int

Volume returns the combined left/right volume percentage.

Directories

Path Synopsis
examples
discover command
Command discover finds MX Remote devices on the local network and prints them, along with their bays, as discovery completes.
Command discover finds MX Remote devices on the local network and prints them, along with their bays, as discovery completes.

Jump to

Keyboard shortcuts

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