Service based on Boost C++ Libraries (https://boost.org/)
- JSON-RPC Server (nlohmann/json, Boost.Beast, C++ 17)
- Logging (Boost.Log)
- platform.io like IoT (https://https://platformio.org//)
sudo apt install libssl-dev libfmt-dev libboost-all-dev nlohmann-json3-dev cmake clang git mc htop xboxdrv zeromq
git submodule init
git submodule update
mkdir build && cd build && cmake ../ && make && make install
/**
* hello params
*/
BEGIN_DECLARE_DTO(HelloParams)
__DECLARE_DTO_FIELDS1(std::string, name)
END_DECLARE_DTO
/**
* hello response
*/
BEGIN_DECLARE_DTO(HelloResult)
__DECLARE_DTO_FIELDS1(std::string, message)
END_DECLARE_DTO
/**
* hello params
*/
BEGIN_DECLARE_DTO(HelloParams)
__DECLARE_DTO_FIELD(std::string, name)
END_DECLARE_DTO
/**
* hello response
*/
BEGIN_DECLARE_DTO(HelloResult)
__DECLARE_DTO_FIELD(std::string, message)
END_DECLARE_DTO
class HelloFunction : public RpcFunction<HelloParams, HelloResult> {
public:
std::string name() const override {
return "hello.function";
}
HelloResult exec(const HelloParams ¶ms) override {
HelloResult result;
result.message = "Hello, " + params.name;
return result;
}
};
class HelloSupplier : public RpcSupplier<HelloResult> {
public:
std::string name() const override {
return "hello.supplier";
}
HelloResult exec() override {
HelloResult result;
result.message = "Hello World!";
return result;
}
};
class HelloConsumer : public RpcConsumer<HelloParams> {
public:
std::string name() const override {
return "hello.consumer";
}
void exec(const HelloParams ¶ms) override {
// TODO: make something
}
};
Program received signal SIGSEGV, Segmentation fault.
0x76fd9822 in ?? () from /lib/ld-linux-armhf.so.3
https://bugs.launchpad.net/gdb/+bug/1576432
https://youtrack.jetbrains.com/issue/CPP-14177
ANSI escape code: link
- bash: warning: setlocale: LC_ALL: cannot change locale (en-US.UTF-8).
sudo apt-get install locale-all
sudo dpkg-reconfigure locales
sudo locale-gen.