Section
Getting Started
API
Features
Guides
Reference
AI Access
Frame types
FrameType and DecodedFrame for low-level workLow-level types for inspecting raw frame traffic: FrameType is the TYPE byte and DecodedFrame is one parsed frame.
VARIANTS
| Variant | Opcode | Meaning |
|---|---|---|
Move | 0x01 | Motion-tagged cursor or wheel movement (PC to box). |
Inject | 0x03 | Class-tagged button, key, or media override (PC to box). |
Reset | 0x04 | Clear all injection (PC to box). |
Query | 0x05 | Request a state snapshot (PC to box). |
Resp | 0x06 | Reply to a query, with the request's seq echoed (box to PC). |
RebootDl | 0x07 | Reboot a chip to download or run (PC to box). |
Log | 0x08 | Unsolicited device diagnostics (box to PC). |
Led | 0x09 | Drive a status LED (PC to box). |
Lock | 0x0A | Block a physical input (PC to box). |
Catch | 0x0B | Subscribe to physical-input events (PC to box). |
MotionEvent | 0x0C | An unsolicited relative-axis catch event, dx/dy/dz (box to PC). |
UsageEvent | 0x0F | An unsolicited held-usage snapshot: button, key, or media (box to PC). |
Option | 0x11 | Set a persistent box option by id, e.g. imperfect-clone opt-in or movement riding (PC to box). |
ClipAppend | 0x12 | Append buffered-clip entries to the device ring; seq = append seq (PC to box). |
ClipCtrl | 0x13 | Start/stop/arm/config buffered clip playback (PC to box). |
DECODEDFRAME
| Field | Type | Description |
|---|---|---|
ty | FrameType | Which opcode this frame carries. |
seq | u8 | The sequence byte; a reply echoes the request's value. |
payload | Vec<u8> | The raw payload bytes, already CRC-checked. |
EXAMPLE
use medius::{FrameType, DecodedFrame};
// Byte -> variant is fallible; an unknown opcode is an Err.
assert_eq!(FrameType::try_from(0x06), Ok(FrameType::Resp));
assert!(FrameType::try_from(0xFF).is_err());
// Variant -> byte always works.
assert_eq!(u8::from(FrameType::Log), 0x08);
// Read a decoded frame by field: a MOTION_EVENT carrying dx=5, dy=-5, dz=1.
let frame = DecodedFrame { ty: FrameType::MotionEvent, seq: 7, payload: vec![5, 0, 0xFB, 0xFF, 1, 0] };
println!("{:?} seq={} {} bytes", frame.ty, frame.seq, frame.payload.len());Full wire layout is on the frame page. For everyday work, stay on Requests and Diagnostics instead.