65 lines
1.4 KiB
C++
65 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_set_input_port(const std::string &name, const std::string &port);
|
|
void handle_set_output_port(const std::string &name, const std::string &port);
|
|
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 parse_server_config_file();
|
|
|
|
Poco::Net::HTTPServer* build_output_server();
|
|
|
|
|
|
private:
|
|
int input_port;
|
|
int output_port;
|
|
|
|
bool help_requested;
|
|
|
|
std::string input_config;
|
|
std::string matrix_config;
|
|
std::string output_pin_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
|