Files
flippr-code/FlippR-Driver/networking/FlippRServer.h
Johannes Wendel 5fe28d46d9 fuuuuuuuu
2019-07-16 22:12:46 +02:00

66 lines
1.4 KiB
C++

//
// Created by rhetenor on 5/21/19.
//
#ifndef FLIPPR_DRIVER_FLIPPRSERVER_H
#define FLIPPR_DRIVER_FLIPPRSERVER_H
#include "output/OutputDriver.h"
#include "input/InputDriver.h"
#include <Poco/Util/ServerApplication.h>
#include <Poco/Net/HTTPServer.h>
namespace flippR_driver
{
namespace networking
{
class FlippRServer : public Poco::Util::ServerApplication
{
public:
FlippRServer();
int main(const std::vector<std::string>& args);
void initialize(Poco::Util::Application& self);
void defineOptions(Poco::Util::OptionSet& options);
void handle_help(const std::string &name, const std::string &port);
void handle_config_file(const std::string &name, const std::string &value);
private:
void initialize_output_driver();
void initialize_input_driver();
void parse_server_config_file();
std::string get_runtime_dir();
Poco::Net::HTTPServer* build_output_server();
Poco::Net::TCPServer* build_input_server();
private:
const std::string DEFAULT_RUNTIME_DIR = "/tmp/flippR_driver-runtime/";
const std::string SOCKET_NAME = "S.flippR_driver";
int input_port;
int output_port;
bool help_requested;
std::string input_config;
std::string matrix_config;
std::string lamp_config;
std::string solenoid_config;
std::string sound_config;
std::string display_config;
std::shared_ptr<input::InputDriver> input_driver;
std::shared_ptr<output::OutputDriver> output_driver;
};
};
}
#endif //FLIPPR_DRIVER_FLIPPRSERVER_H