Expand description
Ryu Hardware Protocol (RHP) v1 — Rust mirror of the wire contract.
This is the node-side implementation of the SAME contract defined in
apps/hardware/PROTOCOL.md §3. The WebSocket handler
(apps/core/src/server/hardware_ws.rs, wired in a later phase) (de)serializes
these types on each TEXT frame; BINARY frames carry Opus/JPEG payloads and are
not modeled here.
Keep this in lockstep with the two sibling implementations:
- C (firmware): apps/hardware/firmware/shared/protocol/include/rhp_protocol.h
- TS (relay): packages/protocol/src/hardware.ts
Message type strings and field names are NORMATIVE. The serde attributes
below are chosen so the emitted JSON matches the spec exactly:
#[serde(tag = "type", rename_all = "snake_case")]makes the enum a{ "type": "..." }-tagged union; snake_case yieldscamera_meta,hello_ack,tts_start,chat_delta, etc.Sttrenames tostt,TtsStart/TtsEndtotts_start/tts_end.
Structs§
- Audio
Format - Audio format descriptor (mic uplink in
hello, TTS downlink inhello_ack). - Caps
- Capability profile a device advertises in
hello. - Device
List Item - One entry in GET /api/hardware/devices.
- Device
Update - PATCH /api/hardware/devices/:id request body.
- Pair
Request - POST /api/hardware/pair request body.
- Pair
Response - POST /api/hardware/pair response body.
Enums§
- Device
Type - Physical device class. Wire:
watch|necklace|desk. - Emotion
- Face/emotion state driving the “Island eyes” renderer.
Wire:
neutral|listening|thinking|happy|sad|surprised|speaking. - Listen
State - Chat-turn boundary marker. Wire:
start|stop. - Mode
- Device operating mode. Wire:
idle|chat|ambient. - RhpClient
Msg - Every control message a device/relay sends to the node, tagged on
type. - RhpServer
Msg - Every control message the node sends to a device/relay, tagged on
type. - Surface
- Display surface a
displaymessage targets. Wire:eink|lcd.
Functions§
- device_
type_ str - Wire string for a
DeviceType(mirrors Crhp_device_type_str). Used by the SQLite registry, which stores the device class as its wire token rather than re-deriving it via serde. - parse_
device_ type - Parse a
DeviceTypefrom its wire string (mirrors Crhp_device_type_parse). ReturnsNonefor any unrecognized value.