Expand description
Client library for Pulse-Eight MatrixOS devices (neo matrices, OneIP/V2IP units, ProAmp8 amplifiers) over UDP multicast/broadcast.
Devices announce themselves and their bays, report signal, audio, streaming
and power state as it changes, and accept routing and configuration
commands. A Remote discovers them, keeps a snapshot of what they have
reported, and sends those commands.
§Getting started
use std::sync::{Arc, OnceLock};
use mx_remote::{Config, DeviceUid, EventHandler, Remote};
// A handler is handed to the client that will call it, so it cannot hold
// one at the time it is built. It is filled in before the client starts,
// which is before anything can call back.
static CLIENT: OnceLock<Arc<Remote>> = OnceLock::new();
struct Printer;
impl EventHandler for Printer {
fn on_device_update(&self, device: DeviceUid) {
let Some(info) = CLIENT.get().and_then(|c| c.device(device)) else {
return;
};
println!("{device} {} {}", info.model, info.name);
}
}
let remote = Arc::new(Remote::new(Config::default(), Arc::new(Printer))?);
let _ = CLIENT.set(Arc::clone(&remote));
remote.start()?;Config::default discovers over multicast on the interface the host
picks, which is the right answer on a single-homed machine and arbitrary on
any other. cargo run --example discover is the program above, complete.
§Events say what moved
Every method on EventHandler has a default that does nothing, so a
caller implements only what it acts on. Most carry just the identifier of
the device or bay that changed: the snapshot read back from Remote is
the same state the event was derived from, and can only be fresher.
EventHandler::on_device_update and EventHandler::on_bay_update fire
after every event at their level, which is enough for a caller that only
wants to know that something moved.
Handler methods run on the receive thread, so they should return quickly.
§Values arrive as they were sent
Every enumeration here is a newtype over its wire integer with named constants rather than a closed set, so a value from firmware newer than this library reaches the caller unchanged instead of being folded onto a neighbour.
An Option on a snapshot is a field the device has not reported yet,
which is a different answer from one reported as zero or false. Zero is a
valid reading for most of them, so a confidently wrong value would be worse
than an absent one.
§Threads
Remote::start takes a receive thread and a timer thread, and
Remote::close - or dropping the Remote - stops and joins them. There
is no async runtime.
Structs§
- Action
Transmit Request - Asks one device to perform a remote-control action.
- AmpDolby
Settings - The Dolby processing state of a ProAmp8.
- AmpZone
Settings - A ProAmp8 zone’s gain, delay, tone and power settings.
- Audio
Change Source - An audio input-selection change: which source endpoint a sink endpoint was switched to.
- Audio
Clip - Reports that a bay detected audio clipping.
- Audio
Endpoint - One audio endpoint: an input, an output, or a processing node between them.
- Audio
Endpoints - The audio endpoints a device reports, in the order it reported them.
- Audio
Features - What one audio endpoint can do.
- Audio
Link - A link from an audio endpoint on this device to one on another.
- BayFeatures
- Capabilities of a single bay.
- BayInfo
- What a bay is, and what is connected to it.
- BayMirror
Status - Whether an output bay mirrors another device’s output, and which one.
- BayName
Change - Asks a device to rename one of its bays.
- BaySignal
Details - What a bay signal status report carries beyond the signal-detected flag and the human-readable signal type.
- BayStatus
- Live status flags of a single bay.
- BayUid
- Identifies a single bay (port) by its owning device and port number.
- Config
- How a
Remotefinds the network. - Device
Feature - Capabilities a device reports in its hello frame.
- Device
Info - What a device is, and what it is doing.
- Device
Uid - The 16-byte unique identifier of an MX Remote device on the network.
- Device
V2ip Details - The local encoder/decoder configuration of a V2IP device.
- Device
V2ip Sink - The sink-side route a V2IP device is currently subscribed to.
- Edid
Profile - An EDID preset selectable on an HDMI input.
- Edid
Profile Change - Asks a device to switch its input EDID profile.
- Edid
Record - One EDID block from a
DEV_EDIDreply. - Edid
Request - Asks one device for its EDID.
- Factory
Reset Request - Asks peers to factory-reset.
- Firmware
Type - A firmware component.
- Firmware
Version - A firmware component reported by a device.
- IrCapture
- Raw IR captured on a bay of the sending device.
- IrMeta
- The raw-IR metadata shared by the IR capture and transmit frames.
- IrTransmit
Request - Asks one device to blast raw IR on one of its local bays.
- KeyTransmit
Request - Asks one device to send a remote-control key on a bay.
- Link
Feature - Media carried by a virtual link.
- MacAddress
- A hardware address.
- Multiviewer
Aspect Ratio - The aspect ratio a multiviewer scales its windows to.
- Multiviewer
Bool - A multiviewer setting that is on, off, or not reported.
- Multiviewer
Command - A command addressed to a multiviewer.
- Multiviewer
Edid Template - The EDID template a multiviewer presents to its sources.
- Multiviewer
Hdcp Mode - The HDCP version a multiviewer output negotiates.
- Multiviewer
ItcMode - The IT-content flag a multiviewer sets on its output.
- Multiviewer
Output Mode - The resolution and refresh rate a multiviewer drives its output at.
- Multiviewer
PipPosition - The corner a multiviewer places its picture-in-picture window in.
- Multiviewer
PipSize - The size of a multiviewer’s picture-in-picture window.
- Multiviewer
Source - One of a multiviewer’s four inputs.
- Multiviewer
Status - A multiviewer’s complete reported state.
- Multiviewer
View Mode - The window layout of a multiviewer.
- Mute
Status - The per-channel mute bitfield: bit 0 is left, bit 1 is right.
- MxrSignal
Type - The 2-byte
mxr_signal_typecarried in scaling configs and bay signal reports. - Network
Port Status - The link state and diagnostics of a network port.
- PduState
- The electrical state a PDU reports.
- RcAction
- A remote-control action.
- RcKey
- A remote-control key code (CEC or IR).
- RcSettings
- The remote-control configuration of a source bay.
- RcType
- The remote-control protocol of a connected sink or source.
- Reboot
Request - Asks one device to reboot.
- Remote
- A client on the MX Remote network.
- SetRoute
Request - Asks a device, addressed by serial, to switch a sink.
- Svd
- A Short Video Descriptor: one standard video resolution and timing.
- Topology
Entry - One device in a topology report.
- UidParse
Error - A UID could not be read from the given text or bytes.
- UtpCable
Status - The diagnostic status of a single UTP cable pair.
- UtpLink
Errors - The decoded link-error bitmask for a network port.
- UtpLink
Speed - The negotiated speed of a network port.
- V2ip
Audio Format - Overrides the sample rate and channel count of a V2IP audio stream.
- V2ip
Blacklist Change - Registers or unregisters a device on the source blacklist.
- V2ip
Decoder State - The health state of a V2IP decoder.
- V2ip
Device Stats - The cumulative and per-minute transmit and receive statistics.
- V2ip
Dscp Config - The per-stream DSCP marking in a V2IP device configuration.
- V2ip
Power Save Request - Asks a sink to enter or leave power save.
- V2ip
RxStats - Receiver stream statistics.
- V2ip
Scaling Settings - A V2IP output’s scaling mode, refresh rate and flags.
- V2ip
Stream Source - A single multicast stream address.
- V2ip
Stream Sources - The streams advertised by a single V2IP source.
- V2ip
Tiling Config - The window a sink is currently told to show.
- V2ip
TxStats - Transmitter stream statistics.
- Video
Wall Command - Asks one sink to crop its source to a wall window.
- Video
Wall Op - What a
VideoWallCommandasks the sink to do with the window. - Volume
Mute Status - The volume and mute state of a bay.
Enums§
- ArcStatus
- The audio return channel a bay is carrying.
- Connect
Status - The connect / signal-detect state reported for a bay.
- Control
Error - Why a control method did nothing.
- Device
Status - The high-level state of a device or bay on the network.
- Event
- Something that changed, or a request that arrived.
- Hidden
Status - The visibility state of a bay.
- Power
Status - The CEC power state of a device connected to a bay.
- Send
Error - Why a frame was not sent.
- Stream
Kind - Which of a V2IP device’s streams an address describes.
- VctStatus
- The result of a virtual cable test on one pair.
Constants§
- AMP_
EQ_ BANDS - Number of EQ bands a zone carries (
AMP_DOLBYEQBANDS_MAX). - AMP_
TONE_ FLAT - The neutral value for bass, treble and the EQ bands.
- AMP_
TONE_ HTTP_ MAX - Highest tone value the amp’s own HTTP API accepts. See
AMP_TONE_HTTP_MIN. - AMP_
TONE_ HTTP_ MIN - Lowest tone value the amp’s own HTTP API accepts.
- BROADCAST_
PORT - UDP port used in broadcast mode.
- MULTICAST_
IP - Multicast group address used for discovery.
- MULTICAST_
PORT - UDP port used in multicast mode.
- MULTIVIEWER_
INPUTS - How many windows a multiviewer can show, and how many sources it maps.
- PROTOCOL_
VERSION - Highest MX Remote protocol version understood.
- SCALING_
FLAGS_ DEFINED - The flag bits that carry meaning.
- SCALING_
FLAG_ AUTO_ SCALING - Set when the output scales automatically.
- SCALING_
FLAG_ MODE_ VALID - Set when the frame carries a scaling mode and refresh rate.
- SCALING_
FLAG_ OPTIONS_ VALID - Set when the frame carries the scaling options.
- V2IP_
AUDIO_ DEFAULT_ CHANNELS - Channel count a V2IP audio stream uses when none is given.
- V2IP_
AUDIO_ DEFAULT_ SAMPLE_ RATE - Sample rate a V2IP audio stream uses when none is given.
- V2IP_
AUDIO_ MAX_ CHANNELS - Highest channel count a V2IP audio stream accepts.
- V2IP_
AUDIO_ MIN_ CHANNELS - Lowest channel count a V2IP audio stream accepts.
- V2IP_
DSCP_ DEFAULT - CS2, the marking the video processor applies at boot and the value firmware falls back to when a peer sends none.
- V2IP_
DSCP_ MAX - Highest DSCP value; the marking occupies the upper 6 bits of the IPv4 TOS byte.
- V2IP_
DSCP_ SET - Marks a DSCP byte as carrying a value.
- V2IP_
PORT_ ANC - Default destination UDP port of a V2IP ancillary-data stream.
- V2IP_
PORT_ AUDIO - Default destination UDP port of a V2IP audio stream.
- V2IP_
PORT_ VIDEO - Default destination UDP port of a V2IP video stream.
- V2IP_
SOURCE_ RATE_ MAX - Highest valid encoder TX rate, in units of 10Mb/s. See
V2IP_SOURCE_RATE_MIN. - V2IP_
SOURCE_ RATE_ MIN - Lowest valid encoder TX rate, in units of 10Mb/s.
- VERSION
- Version of this library.
Traits§
- Event
Handler - Receives events.
Functions§
- lookup_
svd - Looks up the Short Video Descriptor with the given id.
- valid_
addresses - The non-loopback IPv4 addresses that can be used as a local address.