many changes
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.6.2)
|
||||
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
|
||||
input/SocketHandler.cpp
|
||||
output/OutputRequestHandler.cpp
|
||||
output/OutputRequestHandlerFactory.cpp
|
||||
FlippRServer.cpp
|
||||
)
|
||||
|
||||
add_executable(${PROJECT_NAME} ${SOURCES})
|
||||
|
||||
51
FlippR-Driver/networking/FlippRServer.cpp
Normal file
51
FlippR-Driver/networking/FlippRServer.cpp
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
23
FlippR-Driver/networking/FlippRServer.h
Normal file
23
FlippR-Driver/networking/FlippRServer.h
Normal 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
|
||||
9
FlippR-Driver/networking/main.cpp
Normal file
9
FlippR-Driver/networking/main.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
//
|
||||
// Created by rhetenor on 5/21/19.
|
||||
//
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -13,8 +13,9 @@
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace utility
|
||||
namespace networking
|
||||
{
|
||||
|
||||
using namespace Poco;
|
||||
using namespace Poco::Net;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace utility
|
||||
namespace networking
|
||||
{
|
||||
|
||||
class OutputRequestHandler : public Poco::Net::HTTPRequestHandler
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace utility
|
||||
namespace networking
|
||||
{
|
||||
using namespace Poco::Net;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace utility
|
||||
namespace networking
|
||||
{
|
||||
|
||||
class OutputRequestHandlerFactory : public Poco::Net::HTTPRequestHandlerFactory
|
||||
|
||||
Reference in New Issue
Block a user