TransponderDevice contractv1

The face profile

Faces are an optional artwork profile. A microphone, lamp or message display can implement the rest of Transponder without a renderer. Set capability bit 10 only when the device can accept and use PFAC v1. A device may ship with fixed artwork while leaving this capability clear. The app omits face selection when support has not been established.

On this page

Try one small face

Sample face with two upright eyes and a curved smile on a mint background.
Reference render
This 217-byte example uses expressive eyes and a single mouth arc. Both are geometry. The package contains zero bitmaps.

Start with FACE_QUERY. Upload the sample as one raw chunk under a fresh transaction ID. After APPLY, check that FACE_STATUS reports 217 installed bytes and payload CRC f26c5e89. Reboot and query again. Then restore the enclosure default and confirm that both fields return to zero.

Install a face

The app sends all six commands on Control with response. The device answers on Status with FACE_STATUS. All commands use flags 0. An install transaction uses a fresh nonzero ID for its lifetime. Bind it to the authenticated device and current epoch. Correlate every response to command kind, ID and sequence before accepting it.

KindSequencePayload and semantics
33 FACE_QUERY0Empty. Report active package byte count and CRC. Zero length and zero CRC mean the enclosure default is active.
34 FACE_BEGIN0, or 1 to ask about compressionu16 total package bytes (12–24,576). Reserve staging without changing active art. Repeat BEGIN with same owner and length idempotently.
35 FACE_CHUNKRaw uncompressed byte offset (high bit set for LZ4)Send up to 512 raw bytes. For negotiated compression prefix an independent raw LZ4 block with u16 decoded length (1–2,048 bytes) (≤512 total wire bytes). Offsets and cumulative ACKs always count decoded bytes.
36 FACE_APPLY0Empty. Verify all bytes, CRC and artwork limits. Commit atomically, activate, then report installed length and CRC.
37 FACE_CANCEL0Empty. Abandon this uncommitted transaction.
38 FACE_RESTORE0Empty. Clear installed art and select the device default and confirm installed length and CRC are zero.
39 FACE_STATUSEcho command sequenceSame transaction ID. u8 request kind, u8 result, u16 received decoded bytes, u16 installed package bytes, u32 installed payload CRC. Optional byte 10 on BEGIN with seq 1: bit 0 advertises LZ4.

Result codes are 0 OK, 1 unsupported, 2 busy, 3 invalid, 4 out of order, 5 storage failure, 6 no matching transfer. A host must use raw chunks unless the current BEGIN response explicitly advertises LZ4. Allow exact duplicate byte ranges after lost responses. Reject gaps, differing duplicates, overflow and a competing transaction. A valid final APPLY can be repeated if its reply was lost. Preserve the last committed art on failure. The reference device drops staging after 15 seconds without a chunk or on session loss. The app sends the next chunk only after confirmation of the previous decoded end offset.

PFAC artwork v1

Use the example package as a decoder fixture. It contains an original two-eye face, a curved mouth and no bitmap assets. PFAC is self-contained data with bounded geometry and embedded pixels. It contains no code, URLs, firmware commands or paths. The app can retain an editable design, conversation and name separately. Only the compiled artwork travels to the device.

Byte offsetTypeValue
04 bytesASCII PFAC (50 46 41 43).
4, 5u8, u8Format 1, reserved zero.
6u16Payload length. Total file length equals this value + 12 and never exceeds 24,576.
8u32CRC-32/IEEE of the payload (reflected polynomial 0xEDB88320, initial/final xor 0xFFFFFFFF).

For an independent parser, consume these packed records in order with no alignment bytes. u16, s16 and u32 are little endian. A flag is a single byte exactly 0 or 1. An optional color is a flag followed by a u16 RGB565 only when present. A glass record is a flag followed, when present, by three u32 RGB888 (rim, trim, center) and three u8 RGB glow values (0–12). Each record and array must fit within the remaining payload.

u8 touch (0 wink, 1 glance), u8 battery (0 pixel, 1 line)
u16 statusInk, warningStatusInk, lowBatteryInk, normalBackdrop, warningBackdrop
glass normalGlass, warningGlass
s16 grid, scaleNumerator, scaleDenominator, pivotX, pivotY,
    gazeXPercent, gazeYPercent, breathHundredths, breathRateTenths, listeningX, listeningY
u8 eyeStyle (0 images, 1 expressive)
s16 leftX, leftY, rightX, rightY, radiusX, radiusY, alertWidth, alertHeight,
    leftTilt, rightTilt, roundness, shadeOffset, irisRadius, irisStretch,
    irisInsetX, irisInsetY, pupilInsetX, pupilInsetY, pupilReductionX, pupilReductionY,
    highlightX, highlightY, highlightRadiusX, highlightRadiusY, gazeXPercent,
    gazeYPercent, lidHoldPercent, happyOpenPercent, closedSpanPercent,
    closedThreshold, closedStart, closedControl, closedEnd, closedThickness
u16 white, outline, irisTop, irisBottom, highlight
flag mirrorRightEye, preserveImageCaps, pixelBlink
s16 openAsset, halfClosedAsset, closedAsset, winkAsset, alertAsset, listeningAsset, irisAsset
repeat 5 parts: s16 x, y, scalePercent; flag hidden; optionalColor ink
u8 markCount, assetCount
repeat markCount:
    u8 part, primitive; u16 stateMask; flag screenSpace, followsBrow
    u16 minimumLevel, maximumLevel, ink; optionalColor warningInk
    s16 a, b, c, d, e, f, g, h, asset
repeat assetCount:
    u8 width, height; u32 RGBA[width * height]

Asset pixels are row-major packed numeric 0xRRGGBBAA with straight alpha. A red opaque pixel 0xFF0000FF is serialized FF 00 00 FF. Artwork inks pack red in bits 15–11, green in 10–5 and blue in 4–0 of a little-endian RGB565 word. Solid red is 0xf800 and travels as 00 f8. Asset index −1 denotes absent. Reject out-of-range indices, trailing bytes and unknown enum values.

Geometry and expression

Use a 448 × 368 logical canvas, x right and y down. Grid 1, 2 or 4 defines the number of logical pixels in a design unit. Other display sizes can letterbox or scale the canvas. Keep mounting rotation in the device. The five parts in order are brows, nose, mouth, cheeks and decorations. Each part can translate, scale (25–200%), hide or recolor its geometry. Render screen-space decorations first, then cheeks, brows, eyes, nose, mouth and foreground decorations. Preserve author order within each pass. Battery/status belongs to the device.

Image eyes use open, half-closed, closed, wink, alert and listening slots. A usable closed bitmap can supply a missing wink. An expressive eye has independent centers/tilts, radii, roundness (0 rectangular to 100 elliptical), independent iris material and optional clipped iris bitmap. Tilt is a vertical displacement in design units across the eye radius. Positive tilt lowers its right side in screen coordinates. An iris radius of zero gives a solid eye. Touch mode can wink or glance independently of eye material. Foreground marks work for both kinds of eyes.

PrimitiveGeometry fields (design units)
0 Rectangleleft, top, width, height
1 Ovalcenter x, center y, radius x, radius y, tilt
2 Arcstart x, start y, control y, end x, end y, thickness. Control x is the midpoint.
3 Bandleft x, right x, top start/control/end y, bottom start/control/end y. Fill between the two quadratic edges.
4 Imageleft, top, width, height. Asset slot selects embedded pixels.

State mask bits are content 1, wink 2, happy/ready 4, surprised 8, listening 16, talking 32, warning idle 64. All poses is 127. Audio poses take precedence, then surprise, happiness, wink, warning idle and content. Each mark draws only within its inclusive audio-level interval (0–65,535). warningInk can override ink during any warning pose. Indicator semantics come from device state and never require reading a face expression.

Validation budget

  • Maximum 128 marks and 16 bitmap slots, each side 1–128 pixels. Across all bitmap widths × heights the sum must be ≤3,072 pixels (12 KiB of decoded RGBA). Check multiplication, cumulative totals and remaining bytes before allocating.
  • Layout scale numerator and denominator each 1–8, ratio ≤2, pivot within 0–448/0–368, gaze gain ±400, breath 0–500, breath rate 0–60, listening offsets ±48. Glass colors fit 24 bits.
  • Eye centers within canvas/grid, radii 1–112/grid, iris radius 0–112/grid. Alert increments 0–16, roundness and happy open 0–100%, lid hold 0–90%, closed span 1–180%, closed threshold 1–20, closed thickness 1–24, eye gaze gain ±1,000. All other signed eye geometry offsets bounded to ±96.
  • Part x/y shifts bounded to ±224/±184. Mark coordinates a–h bounded to ±(512/grid). Each state mask is nonempty with bits only in 0x7F. Minimum level ≤ maximum. Rectangle/image extents and oval radii must be positive. Arc thickness 1–48/grid. Band left < right. Image primitive requires a valid slot. All other marks use −1.
Quill resting with eyes openQuill with both eyes closedQuill listening
The same Quill design in its resting, blinking and listening poses. Use these reference renders to check that a change of expression preserves the character’s proportions.

Preview the idle, listening, talking, wink or glance, surprise and warning poses. Test a repeated chunk, an incorrect CRC, an oversized bitmap, an interrupted upload, restore, reboot persistence and a valid install while audio is busy. A successful install confirms both the length and payload CRC currently installed.