Expand description
Client library for Pulse-Eight MatrixOS devices (neo matrices, OneIP 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.
- BayAudio
Details - The audio a bay signal report describes.
- BayContent
Field - One thing an input’s source is showing, such as its channel name.
- 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 OneIP device.
- Device
V2ip Sink - The sink-side route a OneIP device is subscribed to, as the mesh believes it.
- 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 every unit, or one, 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.
- OsdCaption
- A caption, as a setting gives it.
- OsdCaption
Align - How a caption’s lines are aligned.
- OsdCaption
Field - The caption fields an overlay setting gives. A field left out keeps what the unit has.
- OsdCaption
Format - How a caption’s text is read.
- OsdLogo
- A logo choice and place, as a setting gives it.
- OsdLogo
Field - The logo fields an overlay setting gives. A field left out keeps what the unit has.
- OsdMessage
- The message on a unit’s output, as the unit last reported it.
- OsdMessage
Flag - What a unit says of the message on its output.
- OsdMessage
Priority - Where a message stands against the unit’s own messages: its upgrade, Locate Device and encrypted source messages.
- OsdSync
- A sync, as its source sent it.
- OsdSync
Content - What this client has units copy.
- OsdSync
Entry - One setting of a sync this client sends.
- OsdSync
Image - The logo image for one slot.
- OsdSync
Report - How a unit is getting on with a sync.
- OsdSync
Request - A unit asking for a sync, or for settings of one it is taking, or management asking for a new sync for a unit.
- OsdSync
Setting - One setting of a sync, which its source sends to one unit.
- OsdSync
Size - The output size an overlay setting applies at.
- OsdSync
Slot - One logo slot, as a sync describes it.
- OsdSync
State - How far a unit has got with taking an overlay sync.
- OsdSync
What - The kinds of overlay setting an overlay sync copies.
- 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 every unit, or one, 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.
- Time
Zone - The time zone a device announces for its mesh.
- Topology
Entry - One device a unit found behind its switch ports, in its topology report.
- UidParse
Error - A UID could not be read from the given text or bytes.
- Unit
Command - A command for one unit, as a peer sent it.
- Unit
Command Flag - The flags of a unit command.
- Unit
Command Kind - What a unit command asks of its unit.
- Unit
Flag - The flags of a unit’s status report.
- Unit
NetConfig - An IP configuration: the addresses a unit uses, or is told to use.
- Unit
Power Save - What a unit offers at one power save level.
- Unit
Status - A unit’s health and IP configuration, as it last reported them.
- 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 - The sample rate and channel count a OneIP audio stream is decoded at.
- V2ip
Blacklist Change - Adds multicast groups to, or removes them from, the mesh-wide list that automatic address assignment avoids.
- V2ip
Colour Space - The colour space a OneIP output scales to.
- V2ip
Decoder Format - The colour space a decoder recovered from a codestream.
- V2ip
Decoder Reason - Why a decoder reports the state it does.
- V2ip
Decoder Report - What a sink’s decoder recovered from the codestream it is being given.
- V2ip
Decoder State - The health state of a OneIP decoder.
- V2ip
Device Setting - The device settings a OneIP configuration can carry, each on its own bit.
- V2ip
Device Settings - The device settings of a OneIP unit, as it reports them and as its controller changes them.
- V2ip
Device Stats - The cumulative and per-minute transmit and receive statistics.
- V2ip
Downmix - How a OneIP output mixes 5.1 and 7.1 PCM down to stereo, and whether it does now.
- V2ip
Downmix Level - How loud a OneIP output’s stereo downmix is.
- V2ip
Downmix Mode - When a OneIP output mixes 5.1 and 7.1 PCM down to stereo.
- V2ip
Dscp Config - The per-stream DSCP marking in a OneIP device configuration.
- V2ip
Fpga Feature - What a OneIP device’s video processor supports, as the device reports it in its configuration.
- V2ip
Output Mode - The output format to scale a OneIP sink to.
- V2ip
Power Save Level - How far a OneIP device powers down in power save, each level saving more than the one before.
- V2ip
Power Save Request - Asks a sink to enter or leave power save.
- V2ip
Power Save Schedule - A OneIP device’s daily power save windows, Monday first, in the device’s time zone.
- V2ip
Privacy - How a OneIP source unit’s streams are encrypted, as it last reported it.
- V2ip
Privacy Stream - How one of a OneIP source unit’s streams is encrypted, as the unit reports
it: the values of the stream’s
a=privacyanda=extmapsession description attributes. - V2ip
PtpFlag - The flags of a OneIP device’s PTP state.
- V2ip
PtpLock - How far a OneIP device’s PTP clock has locked to its master.
- V2ip
PtpMessages - How a OneIP device paces its PTP messages, its SAP timings, its streams’
TTL and its output’s rotation, which a frame carries in the same block. Each value is behind its own bit of
V2ipDeviceSettings::valid, one ofSETTINGS_BLOCK. - V2ip
PtpMode - How a OneIP device takes part in PTP.
- V2ip
PtpState - A OneIP device’s PTP state, as it reports it about itself.
- V2ip
Route - The three streams a manual route points a OneIP sink at.
- V2ip
Route Target - One multicast destination in a route the caller assembles.
- V2ip
RxStats - Receiver stream statistics.
- V2ip
Scaling Settings - A OneIP output’s scaling mode, refresh rate and flags.
- V2ip
SdpClock Mode - What a OneIP output’s video processor times a described stream by.
- V2ip
SdpClock State - How far a OneIP output’s video processor has got with a described stream’s timing.
- V2ip
SdpEncoding - The sample encoding of a stream a OneIP output plays from a description.
- V2ip
SdpFlag - The flags of what a OneIP output plays from a session description.
- V2ip
SdpMedia Clock - Where a described stream’s media clock comes from.
- V2ip
SdpRef Clock - The reference clock a described stream names.
- V2ip
Sink Sdp - What a OneIP output plays from a session description, as it last reported it. The stream’s fields are zero while it plays none.
- V2ip
Stream Source - A single multicast stream address.
- V2ip
Stream Sources - The streams advertised by a single OneIP source.
- V2ip
Test Pattern - The test pattern a OneIP sink draws on its output.
- V2ip
Test Sync - A OneIP sink’s lip-sync flash: a pattern frame is marked every
period, the frameleadafter a mark flashes white, and aBEEPtone startsoffsetsample periods after it. - V2ip
Test Tone - A OneIP sink’s test tone.
- V2ip
Testcard - The test card a OneIP sink draws on its output, as it last reported it.
- V2ip
Testcard Flag - What a OneIP sink reports about its test card.
- V2ip
Tiling Config - The window a sink is currently told to show.
- V2ip
Tone Mode - The test tone a OneIP sink plays on its output.
- V2ip
TxStats - Transmitter stream statistics.
- V2ip
Vlan - VLAN tagging on a OneIP device’s uplink.
- V2ip
Vlan Flag - The flags of a OneIP device’s VLAN configuration.
- 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. - Video
Wall Window - Where a video-wall sink’s window sits, and the picture it was measured against.
- 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.
- OsdSync
Value - What one setting of a sync sets.
- 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 OneIP device’s streams an address describes.
- V2ip
Decoder Detail - What a statistics report says about the sink’s decoder.
- 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.
- BAY_
CONTENT_ KEY_ MAX - The most bytes in a
BayContentField::key. - BAY_
CONTENT_ VALUE_ MAX - The most bytes in a
BayContentField::value. - 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.
- OSD_
MESSAGE_ TEXT_ MAX - The longest message text a unit takes, in bytes.
- OSD_
SYNC_ FONT_ MAX - The longest caption font name, in bytes.
- OSD_
SYNC_ IMAGE_ HEIGHT_ MAX - See
OSD_SYNC_IMAGE_WIDTH_MAX. - OSD_
SYNC_ IMAGE_ MAX - The largest logo image a unit takes, in bytes.
- OSD_
SYNC_ IMAGE_ WIDTH_ MAX - The widest and tallest logo image a unit takes, in pixels.
- OSD_
SYNC_ PERCENT_ MAX - The largest size a logo is shown at, in percent.
- OSD_
SYNC_ RECORDS_ MAX - The most settings one sync carries.
- OSD_
SYNC_ SLOTS - The logo slots a sync can copy.
- OSD_
SYNC_ TEXT_ MAX - The longest caption text a unit shows, in bytes. It cuts a longer one short.
- 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_ MATCH_ SOURCE - Set when the output follows its source’s format instead of a fixed one.
- SCALING_
FLAG_ MODE_ VALID - Set when the frame carries a scaling mode and refresh rate.
- SCALING_
FLAG_ OPTION S2_ VALID - Set when the frame carries the second group of scaling options.
- SCALING_
FLAG_ OPTIONS_ VALID - Set when the frame carries the scaling options.
- SCALING_
FLAG_ SKIP_ 420 - Set when the output declines 4:2:0 rather than scaling it.
- TIME_
ZONE_ NAME_ LEN - Bytes a time zone’s IANA name takes on the wire, its terminating NUL included.
- TIME_
ZONE_ RULE_ LEN - Bytes a time zone’s POSIX rule takes on the wire, its terminating NUL included.
- UNIT_
MAX_ TEMPERATURES - The most temperature sensors a unit reports.
- UNIT_
POWER_ SAVE_ LEVELS - The power save levels a unit reports what it offers at, from
REDUCEDup. - V2IP_
AUDIO_ DEFAULT_ CHANNELS - Channel count a OneIP audio stream uses when none is given.
- V2IP_
AUDIO_ DEFAULT_ SAMPLE_ RATE - Sample rate a OneIP audio stream uses when none is given.
- V2IP_
AUDIO_ MAX_ CHANNELS - Highest channel count a OneIP audio stream accepts.
- V2IP_
AUDIO_ MIN_ CHANNELS - Lowest channel count a OneIP audio stream accepts.
- V2IP_
DOWNMIX_ LFE_ MAX - The largest percent a OneIP output mixes its LFE channel in at.
- 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_
IR_ PROFILE_ MAX - One past the highest infrared profile: the default profile is 0, the Atlona profile 1, and user-defined profiles 1 to 16 are 2 to 17.
- V2IP_
IR_ PROFILE_ NOT_ SET - The infrared profile an output’s port reports when it follows the device’s global one.
- V2IP_
MINUTES_ PER_ DAY - Minutes in a day: every time in a
V2ipPowerSaveScheduleis below this. - V2IP_
PORT_ ANC - Default destination UDP port of a OneIP ancillary-data stream.
- V2IP_
PORT_ AUDIO - Default destination UDP port of a OneIP audio stream.
- V2IP_
PORT_ VIDEO - Default destination UDP port of a OneIP video stream.
- V2IP_
PTP_ DOMAIN_ MAX - The highest PTP domain a OneIP device runs in.
- V2IP_
SCALING_ REFRESH_ MAX - Highest refresh rate a OneIP output stage accepts, in Hz. See
V2IP_SCALING_REFRESH_MIN. - V2IP_
SCALING_ REFRESH_ MIN - Lowest refresh rate a OneIP output stage accepts, in Hz.
- V2IP_
SDP_ MAX - The longest session description a OneIP output takes, in bytes.
- V2IP_
SINK_ ROTATION_ MAX - The largest angle a OneIP device’s HDMI output is turned by, in degrees.
- 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.
- V2IP_
STREAM_ TTL_ DEFAULT - The TTL a OneIP device’s streams carry until it is set.
- V2IP_
SYNC_ BEEP_ MS_ MAX - The longest lip-sync beep, in milliseconds.
- V2IP_
SYNC_ BEEP_ MS_ MIN - The shortest lip-sync beep, in milliseconds.
- V2IP_
SYNC_ OFFSET_ MAX - The largest lip-sync beep offset, in sample periods.
- V2IP_
TONE_ CHANNELS_ MAX - The most channels a test tone plays on.
- V2IP_
TONE_ FREQ_ MAX - The highest test tone frequency, in Hz.
- V2IP_
TONE_ FREQ_ MIN - The lowest test tone frequency, in Hz.
- V2IP_
TONE_ LEVEL_ MIN - The quietest test tone level, in dBFS; the loudest is 0.
- V2IP_
TONE_ RATES - The sample rates a test tone plays at, in Hz.
- V2IP_
VLAN_ ID_ MAX - The highest VLAN id: 0 means untagged, and 4095 is reserved by IEEE 802.1Q.
- V2IP_
VLAN_ PORTS - The external network ports a
V2ipVlancovers, in the order ofV2ipVlan::port: the SFP port, the UTP port with PoE, then the UTP port. - V2IP_
VLAN_ PORT_ SFP - The index of the SFP port in
V2ipVlan::port. - VERSION
- Version of this library.
- VIDEO_
WALL_ CLEARED - The window that clears a wall, leaving the sink showing the whole frame.
- VIDEO_
WALL_ MIN_ SIZE - Neither side of a window may be smaller than this, the scaler’s minimum.
- VIDEO_
WALL_ POS_ ALIGN - The horizontal origin must be a multiple of this: the sink’s buffer start has to be aligned.
- VIDEO_
WALL_ WIDTH_ ALIGN - The width must be a multiple of this: the sink’s pipeline moves four pixels per clock.
- VOLUME_
UNCHANGED - The value that means “leave this one alone” in a volume or mute field.
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.