Warning
This project is under active construction. These contracts are pre-1.0 and may change. The firmware and app that consume them are experimental and must not be used on a real vehicle. There is no warranty (see LICENSE). This is an independent project, not affiliated with or endorsed by any vehicle manufacturer.
This repository is the Single Source of Truth for all data communication in the Open Car Controller project. It contains the Protocol Buffer (.proto) definitions that dictate exactly how the vehicle hardware and the mobile companion app talk to each other over BLE and MQTT, plus transport-level metadata (for example MQTT topic templates and BLE GATT UUIDs in opencar/core/v1/transport.toml).
By separating these contracts into their own repository, we ensure that both the firmware and the mobile app are mathematically guaranteed to stay in sync.
This project uses an Envelope Pattern to route messages.
opencar/core/v1/(The Envelope):core.protoandsystem.protohandle routing, timestamps, message IDs, and system health. The envelope carries aplatform_id(the CRC32 of the vehicle platform name, pre-computed in each platform'smeta.toml) to identify the vehicle type, but is otherwise agnostic to the specific commands or states within the opaque payload bytes.opencar/cars/<platform>/v1/*.proto(The Payload): Contains the actual, highly-specific state and commands for a given vehicle. These are compiled into raw bytes and placed inside the core envelope.opencar/core/v1/transport.toml(Transport Bindings): Defines cross-repo transport details that are not protobuf messages themselves but still must stay in sync, such as MQTT topic templates, BLE GATT service/characteristic UUIDs and the BLE message size limit (ble.payload) and chunk framing (ble.fragmentation, seedocs/ble-fragmentation.md).
This allows the core firmware to route messages without needing to understand the contents of the payload, keeping the codebase modular. The platform_id allows the final destination (like the mobile app) to know which schema to use for decoding.
Do not copy-paste these files into your project. This repository is designed to be consumed as a Git Submodule. Refer to the firmware and mobile app to see how to consume these files.
Because these contracts dictate communication between physical hardware and remote apps, breaking changes can result in bricked controllers or malfunctioning apps.
If you are submitting a Pull Request to add a new car feature, you MUST follow the append-only rule:
-
NEVER change a field number. (e.g.,
int32 speed = 1;cannot becomeint32 speed = 2;). -
NEVER change a field's data type.
-
NEVER delete an existing field. If a feature is deprecated, leave the field defined and add the
[deprecated = true]annotation. -
ALWAYS append new fields to the bottom of the message.
-
USE
optionalfor all state fields to support partial, high-frequency updates without sending unnecessary bytes.
Protobuf is inherently forwards and backwards compatible only if you follow these rules. Older apps will safely ignore new fields, and newer apps will safely handle missing fields from older firmware.
We use buf to manage our Protobuf files. It enforces styling, formatting, and prevents breaking changes.
Recommended Setup: This repository includes a Devcontainer configuration. If you open this project in VS Code with the Dev Containers extension (or GitHub Codespaces), the buf CLI will be pre-installed and ready to use.
If you prefer to work locally without the devcontainer, you will need to install the buf CLI manually.
While the dev container is the primary supported environment, you can set up a local Windows environment by installing the necessary tools directly on your host machine.
- Install
bufCLI: We recommend using the Windows Package Manager (winget):winget install bufbuild.buf
- Install
protoc(Protocol Buffers Compiler):winget install Google.Protobuf
(Alternatively, you can download the binaries manually from their respective GitHub release pages and add them to your system PATH.)
Before submitting a PR, ensure your changes pass these checks by running:
- Format your files:
buf format -w - Lint your files:
buf lint - Check for breaking changes:
buf breaking --against '.git#branch=main'
This repository uses a Single Global Version (e.g., v1.2.0).
When a new feature is added to any car, the entire repository's version is bumped.
Contributions are welcome; please read CONTRIBUTING.md first and open an issue before starting anything large. Report security problems privately as described in SECURITY.md.