// // Created by rhetenor on 3/6/19. // #ifndef FLIPPR_CODE_OUTPUTREQUESTHANDLER_H #define FLIPPR_CODE_OUTPUTREQUESTHANDLER_H #include #include #include #include #include #include #include "output/OutputDriver.h" namespace flippR_driver { namespace networking { class OutputRequestHandler : public Poco::Net::HTTPRequestHandler { public: OutputRequestHandler(std::shared_ptr output_driver); void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override; private: boost::optional parseRequest(const std::string& item_type, const std::string& item_name, const std::string& action, const std::string& score = 0); boost::optional parseSolenoid(const std::string& item_name, const std::string& action); boost::optional parseLamp(const std::string& item_name, const std::string& action); boost::optional parseSound(const std::string& item_name, const std::string& action); boost::optional parseDisplay(const std::string& item_name, const std::string& action, const std::string& score); std::vector getPathSegments(Poco::URI uri); private: std::shared_ptr output_driver; }; } } #endif //FLIPPR_CODE_OUTPUTREQUESTHANDLER_H