#include #include #include "DixonBrain.h" #include "Version.h" // The generated header void signal_handler(int signal) { if (signal == SIGINT || signal == SIGTERM) { std::cout << "\nShutdown signal received (" << signal << ")." << std::endl; // Use your atomic flag to tell the brain to stop looping DixonNodeState::instance().setNodeStatus(NodeStatus::Stopping); } } int main() { // The "Splash Screen" std::cout << "Starting Dixon v" << DIXON_VERSION << "...\n"; std::signal(SIGINT, signal_handler); std::signal(SIGTERM, signal_handler); // Create the brain controller DixonBrain brain; // Start the brain's control loop brain.start(); std::cout << "Dixon is alive...\n"; auto count = 1; while (DixonNodeState::instance().getNodeStatus() == NodeStatus::Running) { count++; if (count>10) { count = 0; std::cout << "Dixon state is " << static_cast( DixonNodeState::instance().getNodeStatus()) << "\n"; } std::this_thread::sleep_for(std::chrono::milliseconds(100)); } // Stop the brain cleanly brain.stop(); std::cout << "Dixon has left the building...\n"; return 0; }