TransponderDevice contractv1

Session and wire format

Use this reference when wiring your transport or debugging a packet capture. The first exchange establishes three things your firmware can rely on: who the paired peer is, which conversation is active, and which operations both sides can perform.

On this page

BLE transport

The device is the BLE peripheral. Transponder is the central. Advertise service UUID 7E7A1000-7D45-4D70-AC91-6B4B9CBBE001. Each characteristic below replaces the first eight hex digits of that UUID. Use the advertised service for discovery and the authenticated identity for device identity. The Bluetooth name is a user-facing label.

UUID prefixEndpointTraffic
7E7A1001Control (required)Protected identity read and app → device writes with response. All app messages except speaker frames, image rows/chunks and firmware chunks.
7E7A1002Status (required)Device → app notifications for all messages except microphone audio. Include a CCCD.
7E7A1003MicrophoneDevice → app microphone-frame notifications. Include a CCCD when present.
7E7A1004MediaApp → device writes without response for speaker frames, image rows/chunks and firmware chunks. Application-level grants or cumulative ACKs limit the sender.

Protect the identity, writes, subscriptions and notifications with authenticated LE Secure Connections, a 16-byte key and bonding. The reference device offers numeric comparison in a two-minute user-initiated pairing window. A headless design needs a way to complete the secure association. Do not treat a public device ID, context or displayed name as authorization. Clear bond-specific session data when the owner forgets a device. Never expose provider credentials or raw agent tool execution through this transport.

The application messages can also travel over an in-process transport. Bluetooth is the external transport implemented by the current companion. A new USB or Wi-Fi transport requires a companion adapter.

Versions and capabilities

The wire envelope, negotiated contract, artwork format and firmware release have separate version numbers. This document defines envelope 1 and contract 1. A firmware release such as v27 does not identify a contract version.

The protected identity is exactly 16 bytes. Keep the physical device ID stable across boots. Generate a fresh nonzero boot nonce after restart so buffered traffic can be attributed to the correct boot.

OffsetTypeMeaning
0u8Envelope version, currently 1.
1u8Compatibility bits: 0x01 gallery, 0x02 JPEG (with gallery), 0x04 correlated voice progress, 0x08 firmware update service. 0x10 declares the extended contract handshake. Set legacy bits only for implemented features.
2, 3u8, u8With 0x10 set: lowest and highest supported contract versions, inclusive. Both 1 today. Without 0x10 these bytes are reserved.
4u32Boot nonce. WELCOME also returns this in its object ID.
88 octetsOpaque stable device ID. Preserve octet order.

The host reads identity, checks the contract range and channel availability, subscribes, and starts a fresh nonzero epoch. In extended HELLO the host offers its range and feature set. WELCOME echoes the selected context, returns the highest common version twice and returns the intersection of supported features. Apply dependencies after intersection. Never add capabilities that the host did not offer. Ignore unknown offer bits when intersecting. Reject a WELCOME that adds an unoffered bit, lacks a dependency, changes the context or selects a version outside the common range. If ranges do not overlap or the response is malformed, leave the session unready and show an incompatibility on the host. Never reinterpret an incompatible explicit declaration as legacy.

BitFeatureWhat implementing it enables
0PresentationReceive state snapshots including working and pending/unread message indicators. A display is optional.
1TextShow message bodies, request pages and mark a message read. Requires presentation.
2ChoicesAnswer a current multiple-choice question. Requires presentation.
3Voice inputAnnounce capture and send microphone frames on 1003. Correlated voice control and progress are part of voice.
4Voice outputReceive speaker frames on 1004 and report credits. Independently selectable from input.
5ImagesReceive RGB565/RLE images over 1004 and acknowledge validated transfers.
6GalleryAddress individual images within a message. Requires images.
7JPEGReceive baseline JPEGs, including cache-only prefetch. Requires gallery and images.
8Power historyReport batches of measurements. No application-level polling required.
9Signed firmware updateInstall the supported signed package profile over 1004. Update trust and target limits.
10FacesReceive, validate, persist and render the independent PFAC v1 profile. Only devices with confirmed support are eligible for face selection.
11Present messageAccept an explicit request to show a previously synchronized message and report the result. Requires presentation.
12Relay stateReceive the app’s observed upstream conversation availability independently of voice, presentation and the Bluetooth link.
13Message historyRequest one bounded window of an older or newer message. Requires text and a current SNAPSHOT header advertisement. History paging.

Negotiate only what the device can deliver. As examples, 0x00000001 is an activity light, 0x00000803 is a message display with paging and explicit presentation, and 0x00000018 is a two-way audio accessory. A face-capable device can negotiate 0x00000400 independently of those features.

Establish a session

KindDirectionID and sequencePayload in byte order
1 HELLOApp → device, Control0 / 0u32 selected context, u8 minimum contract, u8 maximum contract, u32 offered capabilities
2 WELCOMEDevice → app, Statusboot nonce / 0u32 same context, u8 chosen contract, u8 same chosen contract, u32 negotiated capabilities
An activity light accepts an offer
HELLO payload    78 56 34 12 | 01 01 | 01 00 00 00
WELCOME payload  78 56 34 12 | 01 01 | 01 00 00 00
                  context      range   capability mask
Start both packets with the same epoch. For this exchange the header ID changes from zero to 0x11223344, the boot nonce in the protected identity. The packet fixture includes both complete headers. Download the bytes.

Context is an opaque app-selected conversation token. Zero means no selected conversation. The device never derives it from an account ID. Keep session state per connection. A duplicate HELLO for the same epoch and binding may be answered again without clearing indicators or starting another operation. Reject a change of binding under an existing epoch. The host rebinds with a fresh epoch when its active conversation changes. Invalidate old view state and reject stale tokens. A capture belongs to its original context, boot and utterance.

For an identity without bit 0x10, current hosts can use the original four-byte HELLO and WELCOME (context only), the four legacy characteristics and both notification subscriptions. On a device that also implements that legacy profile, reply to a four-byte HELLO with a four-byte WELCOME for compatibility with old hosts. A minimal device must reject a legacy HELLO if it cannot deliver the old baseline of presentation, text, choices, duplex voice and images. This legacy negotiation is frozen. New designs use the extended handshake. See migration and recovery for the choices available to owners of shipped devices. The original identity does not declare face support. A successful correlated FACE_QUERY can confirm support on an older device. A firmware build number, a BLE name or a timeout cannot confirm it. Older hosts generally expect the four legacy characteristics even if the user has no use for audio.

Retain assigned bit numbers, kind numbers, encodings and meanings for contract 1. Allocate a new capability and new kind for an optional extension. Advertise it only after implementing it. Use a new contract version for an incompatible change and keep encoding older versions for as long as you advertise support. The negotiation itself stays readable using envelope 1. Future versions are supported only when both peers actually implement them.

Frame a message

All integers are little endian and unsigned unless marked otherwise. No native-structure padding is allowed. Each GATT value carries a 20-byte header followed by zero or more payload bytes. A payload may span multiple GATT values. Negotiate an ATT MTU above 23 (or a maximum write/notification value length above 20). A normal ATT write/notification can carry at most MTU minus 3 bytes including the header.

OffsetTypeHeader field
0, 1, 2, 3Four u8Envelope version 1, message kind, flags, reserved zero.
4, 8, 12Three u32Epoch, object ID and sequence. ID and sequence semantics depend on kind.
16, 18Two u16Byte offset of this fragment and total logical payload length (0–1,024).

Keep an assembler per characteristic and connection. An offset of zero starts or replaces a partial message. Subsequent fragments must match the original version/kind/flags/epoch/ID/sequence/length and start exactly where the previous fragment ended. Reject missing bytes, overruns and empty fragments of nonempty messages. An empty logical payload is one header with zero offset/length. Validate the entire message before side effects. Unknown kinds must never execute an action. Keep queues bounded, honor transport backpressure and clear partials, capabilities and credit windows on disconnect or epoch replacement.

Test the second connection

Use two conversations in your test harness. Bind to A, then bind to B under a fresh epoch. Replay a complete packet captured from A. B’s indicators, pending answer and audio credits must stay unchanged. Next, repeat the HELLO for B. The same welcome is safe to return and already committed state must survive.

For revisioned state, compare unsigned 32-bit serials within one binding. Accept a new revision when its forward distance modulo 2³² is greater than zero and less than 2³¹. For example, 1 is newer than 0xffffffff. A request ID, byte offset or sample count has a different meaning. Follow the profile’s correlation rule for those fields.