Ble Constants
BLE Constants for AC Device Communication.
These UUIDs and constants match the AC firmware protocol exactly.
Properties
Connect timeout (milliseconds)
Timeout for data ACK (milliseconds)
Known AC device name patterns for scanning
Fragmentation header size: segCount:2B BEmtu:2B BE = 5 bytes
Timeout for header ACK (milliseconds)
Header marker byte (0x63 = 'c') - indicates a fragmentation header
IDCP header size for AC → Mobile chunks: "mpc"(3) + seq(2) = 5 bytes
Layer 1 header size (plaintext): magic(3) + encrypt(1) + msgType(2) + size(4) + sessionId(8) + startTime(4) = 22 bytes
Layer 1 magic bytes: "?##"
Maximum retry count for header ACK
Timeout for receiving complete message (milliseconds)
Scan timeout (milliseconds)
Segment size for data fragmentation (488 bytes per segment)
Main UART service UUID for AC device communication
Functions
Build fragmentation header: segCount:2B BEmtu:2B BE
Calculate the optimal segment size based on the negotiated MTU.
Check if response is a data NACK ("no\0" without IDCP prefix).
Check if a BLE notification is a final confirmation ("yes" or "no"). Format: "mpc"(3) + seq(2) + "yes\0"(4) or "no\0"(3)
Check if a final confirmation is "yes" (ACK) vs "no" (NACK).
Check if a BLE notification is a header ACK. Format: "mpc"(3) + seq(2) + "headrcv\0"(8) = 13 bytes
Check if a packet contains Layer 1 data (has IDCP header + "?##" magic).
Parse fragmentation header from received data.
Parse sequence number from an IDCP-prefixed notification ("mpc" + seq:2B BE + ...).