Skip to main content

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

NameUUIDPurpose
TX Characteristic0e140001-0af1-4582-a242-773e63054c68Send commands to device
RX Characteristic0e140002-0af1-4582-a242-773e63054c68Receive command responses
Async Characteristic0e140003-0af1-4582-a242-773e63054c68Receive 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

  1. Construct command with header and payload
  2. COBS encode the entire message
  3. Append zero byte terminator
  4. 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:

  1. Divide the Data: Split data into blocks without zero bytes
  2. Insert Code Bytes: Each block is prefixed with a code byte indicating non-zero byte count
  3. Append Trailing Zero: Add a zero byte to signal the end of the frame

Connection Process

  1. Device Discovery

    • Scan for devices advertising the Nano service UUID
    • Select the first matching device or allow user selection
  2. Connection Setup

    • Establish connection to the device address
    • Subscribe to notifications on both RX and Async characteristics
  3. Notification Setup

    • Configure notification handlers for RX and Async characteristics
    • Implement buffering for notification data chunks

Message Handling

Command Transmission (TX)

  1. Construct command bytes: [Domain][MessageType][Payload]
  2. COBS encode the entire command
  3. Append zero byte terminator (0x00)
  4. Split into 20-byte chunks (or according to MTU)
  5. Write chunks sequentially to TX characteristic

Response Processing (RX)

  1. Collect notification chunks from RX characteristic
  2. Aggregate until a complete message is received (chunk < 20 bytes or ends with 0x00)
  3. Remove terminating zero byte
  4. COBS decode the message
  5. Extract domain, message type, and payload
  6. Process the payload using the appropriate Protocol Buffer message type

Async Notifications

  1. Collect notification chunks from Async characteristic
  2. Follow the same process as RX for decoding
  3. 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.