many changes

This commit is contained in:
Jonas Zeunert
2019-05-22 00:00:16 +02:00
parent c32ce18841
commit d6cead914f
8 changed files with 90 additions and 5 deletions

View File

@@ -1,11 +1,12 @@
cmake_minimum_required(VERSION 3.6.2) cmake_minimum_required(VERSION 3.6.2)
project(flippR_driver_networking) project(flippR_driver_networking)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/${OUTPUT_PATH}/cli) set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/${OUTPUT_PATH}/networking)
set(SOURCES set(SOURCES
input/SocketHandler.cpp input/SocketHandler.cpp
output/OutputRequestHandler.cpp output/OutputRequestHandler.cpp
output/OutputRequestHandlerFactory.cpp output/OutputRequestHandlerFactory.cpp
FlippRServer.cpp
) )
add_executable(${PROJECT_NAME} ${SOURCES}) add_executable(${PROJECT_NAME} ${SOURCES})

View File

@@ -0,0 +1,51 @@
//
// Created by rhetenor on 5/21/19.
//
#include "FlippRServer.h"
#include "output/OutputRequestHandlerFactory.h"
#include <DriverFactory.h>
#include <output/OutputDriver.h>
#include <input/InputDriver.h>
#include <Poco/Net/SocketAddress.h>
#include <Poco/Net/ServerSocket.h>
#include <Poco/Net/HTTPServer.h>
int main(int argc, char** argv)
{
flippR_driver::networking::FlippRServer app;
return app.run(argc, argv);
}
namespace flippR_driver
{
namespace networking
{
using namespace Poco::Net;
int FlippRServer::main(const std::vector<std::string>& args)
{
if (!_helpRequested)
{
unsigned short port = (unsigned short)
config().getInt("HTTPTimeServer.port", 9980);
// todo XDG_RUNTIME_DIR
SocketAddress address("/tmp/flippR_driver/S.flippR_driver");
ServerSocket svs(address);
HTTPServer srv(new OutputRequestHandlerFactory(),
svs, new HTTPServerParams);
srv.start();
waitForTerminationRequest();
srv.stop();
}
return Application::EXIT_OK;
}
}
}

View File

@@ -0,0 +1,23 @@
//
// Created by rhetenor on 5/21/19.
//
#ifndef FLIPPR_DRIVER_FLIPPRSERVER_H
#define FLIPPR_DRIVER_FLIPPRSERVER_H
#include <Poco/Util/ServerApplication.h>
namespace flippR_driver
{
namespace networking
{
class FlippRServer : public Poco::Util::ServerApplication
{
};
};
}
#endif //FLIPPR_DRIVER_FLIPPRSERVER_H

View File

@@ -0,0 +1,9 @@
//
// Created by rhetenor on 5/21/19.
//
int main(int argc, const char* argv[])
{
}

View File

@@ -13,8 +13,9 @@
namespace flippR_driver namespace flippR_driver
{ {
namespace utility namespace networking
{ {
using namespace Poco; using namespace Poco;
using namespace Poco::Net; using namespace Poco::Net;

View File

@@ -16,7 +16,7 @@
namespace flippR_driver namespace flippR_driver
{ {
namespace utility namespace networking
{ {
class OutputRequestHandler : public Poco::Net::HTTPRequestHandler class OutputRequestHandler : public Poco::Net::HTTPRequestHandler

View File

@@ -7,7 +7,7 @@
namespace flippR_driver namespace flippR_driver
{ {
namespace utility namespace networking
{ {
using namespace Poco::Net; using namespace Poco::Net;

View File

@@ -12,7 +12,7 @@
namespace flippR_driver namespace flippR_driver
{ {
namespace utility namespace networking
{ {
class OutputRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory class OutputRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory