Skip to content

BringAuto Fleet Protocol - simple yet reliable communication for internet-connection-unstable environments

License

Notifications You must be signed in to change notification settings

bringauto/fleet-protocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fleet Protocol

Connect any device from anywhere to everywhere!

Fleet Protocol

General

Fleet Protocol is a modular communication technology developed by BringAuto to allow for simple and reliable communication between devices deployed in an internet-connection-unstable environment and cloud infrastructure.

Protocol consists of three parts:

  • Internal Client (Remote) - part of a device which communicates with a Module Gateway
  • Module Gateway (Remote):
    • internal server - communicates with internal clients
    • aggregator - aggregates status messages, gathers and aggragates messages in case of connection outage, ...
    • external client - communicates with an External Server
  • External Server (Cloud) - deployed as part of the cloud infrastructure. It provides status messages and can be used to control devices by command messages.

Communication protocol

ProtoBuf (see Protobuf version) is used to serialize and deserialize messages. The message format specification can be found in the protobuf folder.

Each message must be prefixed with a four bytes long (uint32_t data type) header, which holds information about the size of the Protobuf message.

Check the Fleet Protocol v2 documentation to learn more about the system architecture:

Implementation of each respective component:

All supported modules can be listed by fleet-protocol-module topic.

HTTP Interface

The Fleet Protocol HTTP API represents the protocol in the form of an HTTP API.

A Fleet Protocol Module can use the HTTP API to provide its statuses and retrieve commands through a simple and understandable REST API for easy integration with other services.

Fleet Protocol HTTP API is a standalone project and is not part of the Fleet Protocol v2 core specification.

Protocol messages

Messages are described by ProtoBuf v3.

If a message field is not mandatory, then it's marked as OPTIONAL by "OPTIONAL" as the last comment in documentation for the given field. Optional fields have defaults as described in the ProtoBuf v3 doc.

Repo structure

This repository contains a basic C API and CMake project to easily implement Fleet Protocol Modules.

Examples

Samples of fleet-protocol features usage.

Use CMake option BRINGAUTO_SAMPLES=ON to configure them.

Lib

Header files of interfaces

Protobuf

Compiled and non-compiled protobuf files

Usage

Requirements

Installation

To install the library, first configure the project with the CMake option BRINGAUTO_INSTALL=ON and BRINGAUTO_PACKAGE=ON, and then install it.

mkdir _build && cd _build
cmake -DBRINGAUTO_INSTALL=ON -DBRINGAUTO_PACKAGE=ON ..
make install

Package

To create a package, configure the project with CMake option BRINGAUTO_PACKAGE=ON and then create it using cpack.

mkdir _build && cd _build
cmake -DBRINGAUTO_INSTALL=ON -DBRINGAUTO_PACKAGE=ON ..
cpack

Using library in CMake projects

Once the library is installed, it can be used in other projects by adding the following lines to the CMakeLists.txt file:

FIND_PACKAGE(fleet-protocol-interface REQUIRED)
TARGET_LINK_LIBRARIES(<target> PUBLIC fleet-protocol-interface::fleet-protocol-interface)

This will link all interfaces. If you want to only link a specific interface, chose from the interfaces listed below:

  • fleet-protocol-interface::common-headers-interface
  • fleet-protocol-interface::internal-client-interface
  • fleet-protocol-interface::module-gateway-interface
  • fleet-protocol-interface::module-maintainer-external-server-interface
  • fleet-protocol-interface::module-maintainer-module-gateway-interface
  • fleet-protocol-interface::protobuf-cpp-interface

Note that protobuf-cpp-interface also needs protobuf::libprotobuf to be linked to the target