This library currently does Output Plugs only, i.e. it can publish messages but cannot subscribe/consume!
- Demo: Basic MQTT publish working
- Demo: basic MessagePack serialisation
- Demo: Get basic MessagePack serialised message into MQTT body
- Build actual library that can be included from other CPP projects, rather than sitting inside
examples
folder - using CMake again - Merge this project into the monorepo
- Test out using CMake to import (and/or install?) this library automatically, and document the steps needed for developers to do the same
- Get receiving (subscribing) working!
- MQTT: https://github.com/eclipse/paho.mqtt.cpp
- which depends on https://github.com/eclipse/paho.mqtt.c.git
- MessagePack: https://github.com/msgpack/msgpack-c/tree/cpp_master
- which depends on Boost
Useful guides for CMake structure
Be sure to do
git submodule update --init --recursive
so that all submodules are on the correct branch, etc.
Then from base_agent/cpp
:
mkdir build
cd build
cmake ..
cmake --build .
- Full example using Tether Agent instance:
build/examples/tether_agent_example
- Example of MsgPack + MQTT publish only:
build/examples/msgpack_publish_example
- Example of MQTT (string message) publish only:
build/examples/publish_example
An example CMakeLists.txt that includes this library and dependent libraries:
cmake_minimum_required(VERSION 3.19)
project(My_TetherAgent)
add_executable(My_TetherAgent src/My_TetherAgent.cpp)
set_property(TARGET My_TetherAgent PROPERTY CXX_STANDARD 11)
add_subdirectory(./libs/tether/base_agent/cpp)
add_subdirectory(./libs/psn-cpp)
target_include_directories(My_TetherAgent PUBLIC ./libs/tether/base_agent/cpp/src)
target_link_libraries(My_TetherAgent PUBLIC TetherAgent msgpackc-cxx)