Our standard message types are stored here. A Github action compiles the protobuf files in the
src folder and pushes the changes to the build branch. This can then be installed/included
directly into dependent code.
Contributors: Cristian & Adam
Add this repo as a submodule and checkout the build branch. Then use as:
set(MECSEM_PROTOBUF_BUILD_CXX ON)
set(MECSEM_PROTOBUF_BUILD_C OFF)
add_subdirectory(mecsem_protobuf)
target_link_libraries(my_app PRIVATE mecsem_protobuf_cpp)protobuf requires thread for some thread-safety stuff which cannot be disabled, so we have to use
nanopb (C) instead. The firmware is still written in C++ though.
set(MECSEM_PROTOBUF_BUILD_CXX OFF)
set(MECSEM_PROTOBUF_BUILD_C ON)
add_subdirectory(mecsem_protobuf)
target_link_libraries(my_app PRIVATE mecsem_protobuf_c)pip install git+ssh://git@github.com/MECSEM/mecsem_protobuf@build
Then use as:
from mecsem_protobuf import parcel_pb2
The message IDs can also be accessed as:
from mecsem_protobuf import MessageID
print(MessageID.LogMessage.value) # 1All transmitted messages on the network are of the type Parcel. The parcel contains the message
type ID and the corresponding message. The message types are defined in the src folder and tabulated
below for reference.
Note that the ID of the message type is important and should not be changed once assigned. Otherwise, this will break existing code.