BLE Communication Protocol
Service & Characteristic UUIDs
The Anova Precision® Cooker Nano uses the following specific UUIDs:
Primary Service UUID
0e140000-0af1-4582-a242-773e63054c68
Characteristic UUIDs
Name | UUID | Purpose |
---|---|---|
TX Characteristic | 0e140001-0af1-4582-a242-773e63054c68 | Send commands to device |
RX Characteristic | 0e140002-0af1-4582-a242-773e63054c68 | Receive command responses |
Async Characteristic | 0e140003-0af1-4582-a242-773e63054c68 | Receive asynchronous notifications |
Message Format
Command Structure
[Domain Byte][Message Type Byte][Protobuf Payload]
│ │ └─ Optional serialized data
│ └─ Command identifier within domain
└─ Function category (e.g., CONFIG, COOK)
Message Framing
- Construct command with header and payload
- COBS encode the entire message
- Append zero byte terminator
- Split into 20-byte chunks for BLE transmission
Example flow:
[Domain + MessageType + Payload] → COBS encode → Append 0x00 → Split into chunks
COBS Encoding Overview
COBS (Consistent Overhead Byte Stuffing) encoding removes all zero bytes from the payload, since zero is used as a frame delimiter:
- Divide the Data: Split data into blocks without zero bytes
- Insert Code Bytes: Each block is prefixed with a code byte indicating non-zero byte count
- Append Trailing Zero: Add a zero byte to signal the end of the frame
Connection Process
-
Device Discovery
- Scan for devices advertising the Nano service UUID
- Select the first matching device or allow user selection
-
Connection Setup
- Establish connection to the device address
- Subscribe to notifications on both RX and Async characteristics
-
Notification Setup
- Configure notification handlers for RX and Async characteristics
- Implement buffering for notification data chunks
Message Handling
Command Transmission (TX)
- Construct command bytes:
[Domain][MessageType][Payload]
- COBS encode the entire command
- Append zero byte terminator (0x00)
- Split into 20-byte chunks (or according to MTU)
- Write chunks sequentially to TX characteristic
Response Processing (RX)
- Collect notification chunks from RX characteristic
- Aggregate until a complete message is received (chunk < 20 bytes or ends with 0x00)
- Remove terminating zero byte
- COBS decode the message
- Extract domain, message type, and payload
- Process the payload using the appropriate Protocol Buffer message type
Async Notifications
- Collect notification chunks from Async characteristic
- Follow the same process as RX for decoding
- Handle the asynchronous status updates
Best Practices
Error Handling
- Implement timeout for response collection
- Validate message length and structure
- Handle COBS decode failures gracefully
- Prepare for BLE disconnections with reconnection logic
Message Validation
Ensure each decoded message has:
- At least 2 bytes (domain and message type)
- Valid domain value
- Valid message type for the specified domain
Connection Management
- Implement automatic reconnection
- Handle notification setup failures
- Clean up on disconnect
BLE MTU Limitations
Commands must be split into 20-byte chunks (or according to negotiated MTU) when writing to the TX characteristic.
Frame Delimiter
Always append a zero byte (0x00) to mark the end of a COBS-encoded command frame.