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 ...