restored OUtputPinController
This commit is contained in:
48
FlippR-Driver/networking/output/OutputRequestHandler.h
Normal file
48
FlippR-Driver/networking/output/OutputRequestHandler.h
Normal file
@@ -0,0 +1,48 @@
|
||||
//
|
||||
// Created by rhetenor on 3/6/19.
|
||||
//
|
||||
|
||||
#ifndef FLIPPR_CODE_OUTPUTREQUESTHANDLER_H
|
||||
#define FLIPPR_CODE_OUTPUTREQUESTHANDLER_H
|
||||
|
||||
#include <Poco/Net/HTTPRequestHandler.h>
|
||||
#include <Poco/URI.h>
|
||||
#include <Poco/JSON/JSON.h>
|
||||
#include <memory>
|
||||
#include <boost/optional.hpp>
|
||||
#include <Poco/JSON/Object.h>
|
||||
|
||||
#include "output/OutputDriver.h"
|
||||
|
||||
namespace flippR_driver
|
||||
{
|
||||
namespace utility
|
||||
{
|
||||
|
||||
class OutputRequestHandler : public Poco::Net::HTTPRequestHandler
|
||||
{
|
||||
public:
|
||||
OutputRequestHandler(std::shared_ptr<output::OutputDriver> output_driver);
|
||||
|
||||
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override;
|
||||
|
||||
private:
|
||||
boost::optional<Poco::JSON::Object> parseRequest(const std::string& item_type, const std::string& item_name, const std::string& action, const std::string& score = 0);
|
||||
|
||||
boost::optional<Poco::JSON::Object> parseSolenoid(const std::string& item_name, const std::string& action);
|
||||
boost::optional<Poco::JSON::Object> parseLamp(const std::string& item_name, const std::string& action);
|
||||
boost::optional<Poco::JSON::Object> parseSound(const std::string& item_name, const std::string& action);
|
||||
boost::optional<Poco::JSON::Object> parseDisplay(const std::string& item_name, const std::string& action, const std::string& score);
|
||||
|
||||
std::vector<std::string> getPathSegments(Poco::URI uri);
|
||||
|
||||
private:
|
||||
std::shared_ptr<output::OutputDriver> output_driver;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif //FLIPPR_CODE_OUTPUTREQUESTHANDLER_H
|
||||
Reference in New Issue
Block a user