At work there is a discussion going on about which...
# random
n
At work there is a discussion going on about which protocol to use for communication between embedded devices, and clients. Below are the protocols (all binary based) that are being looked at (as a replacement for the current protocol that is being used): • MQTT ( http://mqtt.org/ ) • Modbus ( https://en.wikipedia.org/wiki/Modbus ) • AMQP ( https://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol ) Whatever protocol is selected would need to meet the following criteria: • Is a open protocol • Protocol is binary based • Embedded systems (including uCs) can use the protocol • Wide range of libraries available to use the protocol with multiple programming languages (including C and Kotlin), and platforms
m
Not really kotlin-specific, but we use protobufs combined with either sockets, or some socket level protocol (e.g. ZMQ). We use it in both C, C++, and Java. We’ve seen other RT systems also using protos. The one thing I don’t like about proto is sometimes the generated parsers can use more memory than I would like, and the parsing can be non-deterministic Ideally something more deterministic in parsing speed and memory usage would be used for real-time systems.
n
The big issues with Protocol Buffers is that the standard isn't widely used on the embedded side, there is a lot of boilerplate involved with defining the models (code generation), can't structure the models to be schemaless, and official language support is limited compared to the other protocols mentioned, even though there are unofficial libraries available for C ( https://github.com/protobuf-c/protobuf-c ) and Embedded C ( https://github.com/nanopb/nanopb ).
Also with Kotlin Native the generated code is in C (using the unofficial C library - https://github.com/protobuf-c/protobuf-c ) which would need to be converted. This adds unnecessary work that impedes productivity.
Modbus is the defacto protocol in the embedded space. MQTT is the defacto protocol in the IoT space.