Skip to Content
Hands-On Embedded Programming with C++17
book

Hands-On Embedded Programming with C++17

by Maya Posch
January 2019
Intermediate to advanced
458 pages
10h 35m
English
Packt Publishing
Content preview from Hands-On Embedded Programming with C++17

The server

We will first look at the server for this integration test. Its role is to run the RPC server and to maintain the state of each of the sensor and actuator devices, as well as the rooms.

The main file, simulation.cpp, sets up the RPC configuration as well as the main loop, as shown in the following code:

#include "config.h"#include "building.h"#include "nodes.h"#include <nymph/nymph.h>#include <thread>#include <condition_variable>#include <mutex>std::condition_variable gCon;std::mutex gMutex;bool gPredicate = false;void signal_handler(int signal) {    gPredicate = true;    gCon.notify_one();}void logFunction(int level, string logStr) {    std::cout << level << " - " << logStr << endl;}

The includes at the top shows us the basic structure ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hands-On RTOS with Microcontrollers

Hands-On RTOS with Microcontrollers

Brian Amos

Publisher Resources

ISBN: 9781788629300Supplemental Content