config/airpass_config library

Airpass Protocol — Configuration Constants

All tunable protocol parameters are centralized here. Modify these values to adjust scanning behavior, mesh topology, message lifetimes, and endpoint encoding budgets.

Constants

kAirpassDefaultMaxHops → const int
────────────────────────────────────────────────────────────────────────────── MESSAGE LIFECYCLE ────────────────────────────────────────────────────────────────────────────── Maximum number of hops a message can traverse before it is dropped. Each relay decrements the TTL by 1. When TTL reaches 0, the message is marked as MessageStatus.expired and will not be forwarded further.
kAirpassMessageTtlHours → const int
Time-based TTL in hours. Messages older than this are pruned from the local database regardless of hop count.
kAirpassProtocolVersion → const int
Current protocol version. Encoded into the endpoint name so peers can reject incompatible versions.
kAirpassServiceId → const String
────────────────────────────────────────────────────────────────────────────── NETWORK IDENTITY ────────────────────────────────────────────────────────────────────────────── The Nearby Connections service identifier. Must match across all devices participating in the mesh. Change this to your own reverse-domain string.
kAirpassStrategy → const Strategy
The Nearby Connections strategy. P2P_CLUSTER allows many-to-many discovery — required for mesh topology.
kAutoDownloadMaxBytes → const int
File size threshold (bytes) for auto-downloading media. Images/files under this size are fetched automatically during Phase 3 sync. Larger files require the user to tap "download".
kBackoffMultiplier → const double
Multiplier applied to the scan interval after each idle cycle. interval = min(interval * multiplier, kMaxScanIntervalMs)
kBloomFilterFalsePositiveRate → const double
────────────────────────────────────────────────────────────────────────────── BLOOM FILTER (Pre-Sync Dedup) ────────────────────────────────────────────────────────────────────────────── Target false positive rate for the pre-sync Bloom filter.
kBloomFilterTimeoutMs → const int
Maximum time (milliseconds) to wait for the peer's Bloom filter before falling back to an unfiltered sync.
kEndpointDelimiter → const String
Delimiter used to separate fields in the encoded endpoint name.
kEndpointMagic → const String
Magic prefix to identify Airpass protocol endpoints. Peers without this prefix are ignored during discovery.
kEndpointNameMaxBytes → const int
────────────────────────────────────────────────────────────────────────────── ENDPOINT NAME ENCODING ────────────────────────────────────────────────────────────────────────────── Maximum byte length for the Nearby Connections endpoint name. The Android API silently truncates names exceeding this limit.
kInitialScanIntervalMs → const int
────────────────────────────────────────────────────────────────────────────── SCANNING / BACKOFF ────────────────────────────────────────────────────────────────────────────── Initial scan interval when the app enters the background (milliseconds). The scanner will advertise + discover for one cycle, then sleep this long.
kIsolateParsingThresholdBytes → const int
────────────────────────────────────────────────────────────────────────────── SYNC ENGINE ────────────────────────────────────────────────────────────────────────────── Payload size threshold (bytes) above which JSON parsing is offloaded to a background isolate via Isolate.run.
kMaxMediaFileSizeBytes → const int
────────────────────────────────────────────────────────────────────────────── MULTIMEDIA ────────────────────────────────────────────────────────────────────────────── Maximum file size allowed for multimedia messages (bytes). Files larger than this are rejected at the client level.
kMaxMediaSyncsPerConnection → const int
Maximum number of media file transfers per sync connection. Prevents a single sync from being monopolized by large files. Text messages always sync first (Phase 2); media is Phase 3.
kMaxScanIntervalMs → const int
Maximum scan interval after repeated backoff (milliseconds). Caps the exponential growth to preserve battery.
kMaxThumbnailSizeBytes → const int
Maximum thumbnail size embedded in the message payload (bytes). Thumbnails exceeding this are re-compressed to fit.
kMediaDefaultMaxHops → const int
TTL (hop count) for media messages. Lower than text to limit epidemic amplification of large payloads across the mesh.
kMediaMessageTtlHours → const int
Time-based TTL for media messages (hours). Shorter than text (72 hours) to conserve on-device storage.
kMediaRequestMagic → const List<int>
Magic bytes prefix for media request payloads. Used to distinguish media requests from Bloom filters and sync payloads in NearbyConnectionManager._onPayloadReceived.
kMediaResponseMagic → const List<int>
Magic bytes prefix for media response payloads. Sent before a FILE payload to tell the receiver which message ID the incoming file corresponds to.
kMediaStorageDir → const String
Directory name for storing media files within the app's data directory. Structure: {appDir}/airpass_media/{messageId}/{fileName}
kMicroMessageMaxBytes → const int
Maximum raw payload size (bytes) that can be broadcast connectionlessly via the BLE endpoint name. Payloads under this threshold will be base64-encoded and appended to the endpoint name string. Payloads above this are sent via the Wi-Fi Direct sync cycle.
kScanWindowDurationMs → const int
Duration of each active scan window (milliseconds). During this window, both advertising and discovery are active.
kStaleNodeThreshold → const Duration
────────────────────────────────────────────────────────────────────────────── NODE PRUNING ────────────────────────────────────────────────────────────────────────────── Nodes not seen within this duration are pruned from the routing table.
kThumbnailMaxDimension → const int
Thumbnail dimensions (pixels) for image/video previews. Both width and height are capped at this value (aspect ratio preserved).