added get item functionality to http server

This commit is contained in:
Jonas Zeunert
2019-04-30 13:12:53 +02:00
parent 97f4e0fb7f
commit 2ae71c2f53
3 changed files with 165 additions and 93 deletions

View File

@@ -7,8 +7,10 @@
#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"
@@ -25,12 +27,12 @@ public:
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override;
private:
void 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> parseRequest(const std::string& item_type, const std::string& item_name, const std::string& action, const std::string& score = 0);
void parseSolenoid(const std::string& item_name, const std::string& action);
void parseLamp(const std::string& item_name, const std::string& action);
void parseSound(const std::string& item_name, const std::string& action);
void parseDisplay(const std::string& item_name, const std::string& action, const std::string& score);
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);