services/endpoint_codec library
Airpass Protocol — Endpoint Name Codec
Encodes and decodes node metadata into the Nearby Connections endpoint name string. This string is broadcast during advertising and received during discovery — BEFORE any connection is established.
This enables "connectionless filtering": a discovering node can inspect the encoded metadata and decide whether to initiate a handshake without wasting a connection attempt.
Wire Format (v2 — Multi-Group + Micro-Message)
AP|<version>|<role_code>|<groups_csv>|<node_id_prefix>[|<micro_msg>]
AP— magic prefix identifying Airpass protocol endpointsversion— protocol version integerrole_code— single char: 'G' (Global) or 'R' (Group)groups_csv— comma-separated group IDs, or '*' if ungrouped e.g.,GroupA,GroupB,GroupCnode_id_prefix— first 8 chars of the node UUIDmicro_msg— (OPTIONAL) a tiny base64 payload for connectionless broadcasting. Only present when a pending message fits within the remaining byte budget.
Total length MUST NOT exceed kEndpointNameMaxBytes (131 bytes).
Classes
- EndpointCodec
- Encodes and decodes Airpass metadata for use in the Nearby Connections endpoint name field.
- EndpointMetadata
- Decoded metadata extracted from an endpoint name string.
Constants
- kGroupSeparator → const String
- Separator for multiple group IDs within the groups field.
Exceptions / Errors
- EndpointNameTooLongException
- Thrown when the encoded endpoint name exceeds the 131-byte limit.