Unix Domain Socket Protocol
This project uses Unix domain sockets to connect C++ hardware services with other processes. The protocol is designed to be simple, cross-language, and capable of carrying large binary data blocks.
Message Envelope
Each message is a complete frame:
uint32little-endian: JSON header length;uint64little-endian: binary payload length;- UTF-8 JSON header bytes;
- Optional binary payload bytes.
+----------------------+-----------------------+----------------+------------------+
| header_len: uint32le | payload_len: uint64le | JSON header | binary payload |
+----------------------+-----------------------+----------------+------------------+
JSON header describes the request or response; large binary data (such as raw HDMI frame, PCM chunk) goes in the payload to avoid base64 encoding overhead.
C++ Implementation
| File | Description |
|---|---|
src/uds_message.* | Envelope read/write |
src/uds_client.* | Single request/response client |
src/uds_server.* | bind/listen/accept/thread lifecycle and dispatch to service handler |
src/frame_ipc.* | Frame service compatibility wrapper |
ble_service implements the same envelope in Go at
/run/ble_service/ble_service.sock. Its status, wake, pairing_start,
disconnect, pairing_forget, events_since, and Android
notification_publish operations are documented in
BLE Service.
Cross-Language Clients
Go or other languages don't need C++ ABI / cgo, just:
- Connect to service socket;
- Write 12-byte envelope prefix;
- Write JSON header and optional payload;
- Read response in the same format.
Large Integer Handling
Some fields may exceed JavaScript safe integer range. Cross-language clients should remain consistent with existing services: encode large integers as JSON strings when necessary.
Status Values
Services share AidenServiceStatus, common values include:
OKNO_NEW_FRAMEFRAME_NOT_FOUNDSESSION_NOT_FOUNDSERVICE_RECOVERINGTIMEOUTTRANSPORT_ERRORINTERNAL_ERROR
See individual service protocols for specific business semantics.