added get item functionality to http server
This commit is contained in:
164
.idea/workspace.xml
generated
164
.idea/workspace.xml
generated
@@ -13,6 +13,7 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e02dc5d7-dead-448e-976e-72d458e813a0" name="Default Changelist" comment="">
|
<list default="true" id="e02dc5d7-dead-448e-976e-72d458e813a0" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h" beforeDir="false" afterPath="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
<ignored path="$PROJECT_DIR$/cmake-build-debug/" />
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
@@ -24,6 +25,15 @@
|
|||||||
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
<component name="ExecutionTargetManager" SELECTED_TARGET="CMakeBuildProfile:Debug" />
|
||||||
<component name="FileEditorManager">
|
<component name="FileEditorManager">
|
||||||
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.cpp">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="742">
|
||||||
|
<caret line="55" selection-start-line="55" selection-end-line="55" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputHTTPServer.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputHTTPServer.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
@@ -41,23 +51,26 @@
|
|||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="true">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/Event.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="537">
|
<state relative-caret-position="283">
|
||||||
<caret line="166" column="7" selection-start-line="166" selection-start-column="7" selection-end-line="166" selection-end-column="7" />
|
<caret line="26" column="30" selection-start-line="26" selection-start-column="30" selection-end-line="26" selection-end-column="30" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#42#82#0" expanded="true" />
|
<element signature="e#118#142#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="true">
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/output/OutputPinController.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="528">
|
<state relative-caret-position="506">
|
||||||
<caret line="24" column="1" selection-start-line="24" selection-start-column="1" selection-end-line="24" selection-end-column="1" />
|
<caret line="195" column="58" selection-start-line="195" selection-start-column="58" selection-end-line="195" selection-end-column="58" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#42#82#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
@@ -71,24 +84,6 @@
|
|||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputSocketHandler.cpp">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="110">
|
|
||||||
<caret line="5" selection-start-line="5" selection-end-line="5" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputSocketHandler.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="154">
|
|
||||||
<caret line="7" column="18" selection-start-line="7" selection-start-column="18" selection-end-line="7" selection-end-column="18" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
</file>
|
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
@@ -100,11 +95,23 @@
|
|||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="549">
|
||||||
|
<caret line="29" column="36" selection-start-line="29" selection-start-column="2" selection-end-line="29" selection-end-column="37" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#128#168#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
</file>
|
||||||
|
<file pinned="false" current-in-tab="false">
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/EventNotifier.h">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
<file pinned="false" current-in-tab="false">
|
<file pinned="false" current-in-tab="false">
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/output/TestOutputDriver.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/DistributingEvent.h">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
</file>
|
</file>
|
||||||
@@ -125,7 +132,6 @@
|
|||||||
<component name="IdeDocumentHistory">
|
<component name="IdeDocumentHistory">
|
||||||
<option name="CHANGED_PATHS">
|
<option name="CHANGED_PATHS">
|
||||||
<list>
|
<list>
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/InputSocketHandler.h" />
|
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/SolenoidRequestHandler.h" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/SolenoidRequestHandler.h" />
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/LampRequestHandler.h" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/LampRequestHandler.h" />
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/ItemRequestHandler.h" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/ItemRequestHandler.h" />
|
||||||
@@ -175,6 +181,7 @@
|
|||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.h" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.h" />
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.cpp" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.cpp" />
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/output/OutputPinController.cpp" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/output/OutputPinController.cpp" />
|
||||||
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h" />
|
||||||
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp" />
|
<option value="$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp" />
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
@@ -387,12 +394,12 @@
|
|||||||
<workItem from="1556187501636" duration="4257000" />
|
<workItem from="1556187501636" duration="4257000" />
|
||||||
<workItem from="1556211614557" duration="1716000" />
|
<workItem from="1556211614557" duration="1716000" />
|
||||||
<workItem from="1556213821558" duration="6519000" />
|
<workItem from="1556213821558" duration="6519000" />
|
||||||
<workItem from="1556619506370" duration="1078000" />
|
<workItem from="1556619506370" duration="3165000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TimeTrackingManager">
|
<component name="TimeTrackingManager">
|
||||||
<option name="totallyTimeSpent" value="59858000" />
|
<option name="totallyTimeSpent" value="61945000" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TodoView">
|
<component name="TodoView">
|
||||||
<todo-panel id="selected-file">
|
<todo-panel id="selected-file">
|
||||||
@@ -487,9 +494,6 @@
|
|||||||
<state relative-caret-position="-215" />
|
<state relative-caret-position="-215" />
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/EventNotifier.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/input/TestEventNotifier.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/input/TestEventNotifier.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="135">
|
<state relative-caret-position="135">
|
||||||
@@ -1063,9 +1067,6 @@
|
|||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/DistributingEvent.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/DistributingEvent.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/DistributingEvent.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/detail/InputDriver.h">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/detail/InputDriver.h">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="135">
|
<state relative-caret-position="135">
|
||||||
@@ -1157,23 +1158,6 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.cpp">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="961">
|
|
||||||
<caret line="55" selection-start-line="55" selection-end-line="55" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/Event.cpp">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="373">
|
|
||||||
<caret line="28" column="20" selection-start-line="28" selection-start-column="20" selection-end-line="28" selection-end-column="20" />
|
|
||||||
<folding>
|
|
||||||
<element signature="e#118#142#0" expanded="true" />
|
|
||||||
</folding>
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/output/TestDisplay.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/output/TestDisplay.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="-444">
|
<state relative-caret-position="-444">
|
||||||
@@ -1197,20 +1181,6 @@
|
|||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/output/TestOutputDriver.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/tests/output/TestOutputDriver.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.cpp">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="110">
|
|
||||||
<caret line="5" column="24" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="24" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
|
||||||
<state relative-caret-position="308">
|
|
||||||
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
|
|
||||||
</state>
|
|
||||||
</provider>
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputSocketHandler.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputSocketHandler.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="110">
|
<state relative-caret-position="110">
|
||||||
@@ -1225,9 +1195,6 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h">
|
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
|
||||||
</entry>
|
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/output/OutputPinController.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/output/OutputPinController.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="528">
|
<state relative-caret-position="528">
|
||||||
@@ -1235,8 +1202,12 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputHTTPServer.h">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor" />
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="110">
|
||||||
|
<caret line="5" column="24" selection-start-line="5" selection-start-column="24" selection-end-line="5" selection-end-column="24" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputHTTPServer.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputHTTPServer.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
@@ -1248,10 +1219,53 @@
|
|||||||
</state>
|
</state>
|
||||||
</provider>
|
</provider>
|
||||||
</entry>
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputHTTPServer.h">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/EventNotifier.h">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/DistributingEvent.h">
|
||||||
|
<provider selected="true" editor-type-id="text-editor" />
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.h">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="549">
|
||||||
|
<caret line="29" column="36" selection-start-line="29" selection-start-column="2" selection-end-line="29" selection-end-column="37" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#128#168#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/input/SocketHandler.cpp">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="742">
|
||||||
|
<caret line="55" selection-start-line="55" selection-end-line="55" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/input/Event.cpp">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="283">
|
||||||
|
<caret line="26" column="30" selection-start-line="26" selection-start-column="30" selection-end-line="26" selection-end-column="30" />
|
||||||
|
<folding>
|
||||||
|
<element signature="e#118#142#0" expanded="true" />
|
||||||
|
</folding>
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandlerFactory.h">
|
||||||
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
|
<state relative-caret-position="308">
|
||||||
|
<caret line="17" column="35" selection-start-line="17" selection-start-column="35" selection-end-line="17" selection-end-column="35" />
|
||||||
|
</state>
|
||||||
|
</provider>
|
||||||
|
</entry>
|
||||||
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp">
|
<entry file="file://$PROJECT_DIR$/FlippR-Driver/src/utility/networking/output/OutputRequestHandler.cpp">
|
||||||
<provider selected="true" editor-type-id="text-editor">
|
<provider selected="true" editor-type-id="text-editor">
|
||||||
<state relative-caret-position="537">
|
<state relative-caret-position="506">
|
||||||
<caret line="166" column="7" selection-start-line="166" selection-start-column="7" selection-end-line="166" selection-end-column="7" />
|
<caret line="195" column="58" selection-start-line="195" selection-start-column="58" selection-end-line="195" selection-end-column="58" />
|
||||||
<folding>
|
<folding>
|
||||||
<element signature="e#42#82#0" expanded="true" />
|
<element signature="e#42#82#0" expanded="true" />
|
||||||
</folding>
|
</folding>
|
||||||
|
|||||||
@@ -22,11 +22,28 @@ OutputRequestHandler::OutputRequestHandler(std::shared_ptr<output::OutputDriver>
|
|||||||
output_driver(output_driver)
|
output_driver(output_driver)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles a REST request with a URI form of:
|
||||||
|
*
|
||||||
|
* address/{item_type}/[item_name]/[action]/[score]
|
||||||
|
*
|
||||||
|
* Where
|
||||||
|
* {item_type} is either solenoids, lamps, sounds, displays
|
||||||
|
* [item_name] is the string name of an item (optional if you want to get the list of all available items)
|
||||||
|
* [action] is the particular action for the item:
|
||||||
|
* Solenoids: trigger
|
||||||
|
* lamps: activate, deactivate, status
|
||||||
|
* sounds: play
|
||||||
|
* displays: write_score (for this is the additional optional attribute [score]
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @param response
|
||||||
|
*/
|
||||||
void OutputRequestHandler::handleRequest(HTTPServerRequest &request,
|
void OutputRequestHandler::handleRequest(HTTPServerRequest &request,
|
||||||
HTTPServerResponse &response)
|
HTTPServerResponse &response)
|
||||||
{
|
{
|
||||||
auto path_segments = getPathSegments(URI(request.getURI()));
|
auto path_segments = getPathSegments(URI(request.getURI()));
|
||||||
|
// ToDo catch exception
|
||||||
std::string item_type = path_segments.at(0);
|
std::string item_type = path_segments.at(0);
|
||||||
std::string item_name = path_segments.at(1);
|
std::string item_name = path_segments.at(1);
|
||||||
std::string action = path_segments.at(2);
|
std::string action = path_segments.at(2);
|
||||||
@@ -42,7 +59,12 @@ void OutputRequestHandler::handleRequest(HTTPServerRequest &request,
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
parseRequest(item_type, item_name, action, score);
|
boost::optional<Poco::JSON::Object> json_response = parseRequest(item_type, item_name, action, score);
|
||||||
|
if(json_response)
|
||||||
|
{
|
||||||
|
std::ostream& ostr = response.send();
|
||||||
|
json_response->stringify(ostr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch(const NotFoundException &e)
|
catch(const NotFoundException &e)
|
||||||
{
|
{
|
||||||
@@ -54,23 +76,23 @@ void OutputRequestHandler::handleRequest(HTTPServerRequest &request,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRequestHandler::parseRequest(const std::string& item_type, const std::string& item_name, const std::string& action, const std::string& score)
|
boost::optional<Poco::JSON::Object> OutputRequestHandler::parseRequest(const std::string& item_type, const std::string& item_name, const std::string& action, const std::string& score)
|
||||||
{
|
{
|
||||||
if(item_type == "solenoids")
|
if(item_type == "solenoids")
|
||||||
{
|
{
|
||||||
parseSolenoid(item_name, action);
|
return parseSolenoid(item_name, action);
|
||||||
}
|
}
|
||||||
else if(item_type == "lamps")
|
else if(item_type == "lamps")
|
||||||
{
|
{
|
||||||
parseLamp(item_name, action);
|
return parseLamp(item_name, action);
|
||||||
}
|
}
|
||||||
else if(item_type == "sounds")
|
else if(item_type == "sounds")
|
||||||
{
|
{
|
||||||
parseSound(item_name, action);
|
return parseSound(item_name, action);
|
||||||
}
|
}
|
||||||
else if(item_type == "displays")
|
else if(item_type == "displays")
|
||||||
{
|
{
|
||||||
parseDisplay(item_name, action, score);
|
return parseDisplay(item_name, action, score);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -78,8 +100,15 @@ void OutputRequestHandler::parseRequest(const std::string& item_type, const std:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRequestHandler::parseSolenoid(const std::string& item_name, const std::string& action)
|
boost::optional<Poco::JSON::Object> OutputRequestHandler::parseSolenoid(const std::string& item_name, const std::string& action)
|
||||||
{
|
{
|
||||||
|
if(item_name == "")
|
||||||
|
{
|
||||||
|
Poco::JSON::Object response;
|
||||||
|
response.set("solenoids", output_driver->get_solenoids());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
auto opt_solenoid = this->output_driver->get_solenoid(item_name);
|
auto opt_solenoid = this->output_driver->get_solenoid(item_name);
|
||||||
|
|
||||||
if(!opt_solenoid)
|
if(!opt_solenoid)
|
||||||
@@ -97,10 +126,19 @@ void OutputRequestHandler::parseSolenoid(const std::string& item_name, const std
|
|||||||
{
|
{
|
||||||
throw new Poco::NotFoundException("No action with name \"" + action + "\" on solenoids!");
|
throw new Poco::NotFoundException("No action with name \"" + action + "\" on solenoids!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRequestHandler::parseLamp(const std::string& item_name, const std::string& action)
|
boost::optional<Poco::JSON::Object> OutputRequestHandler::parseLamp(const std::string& item_name, const std::string& action)
|
||||||
{
|
{
|
||||||
|
if(item_name == "")
|
||||||
|
{
|
||||||
|
Poco::JSON::Object response;
|
||||||
|
response.set("lamps", output_driver->get_lamps());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
auto opt_lamp = this->output_driver->get_lamp(item_name);
|
auto opt_lamp = this->output_driver->get_lamp(item_name);
|
||||||
|
|
||||||
if(!opt_lamp)
|
if(!opt_lamp)
|
||||||
@@ -122,10 +160,19 @@ void OutputRequestHandler::parseLamp(const std::string& item_name, const std::st
|
|||||||
{
|
{
|
||||||
throw new Poco::NotFoundException("No action with name \"" + action + "\" on lamps!");
|
throw new Poco::NotFoundException("No action with name \"" + action + "\" on lamps!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRequestHandler::parseSound(const std::string& item_name, const std::string& action)
|
boost::optional<Poco::JSON::Object> OutputRequestHandler::parseSound(const std::string& item_name, const std::string& action)
|
||||||
{
|
{
|
||||||
|
if(item_name == "")
|
||||||
|
{
|
||||||
|
Poco::JSON::Object response;
|
||||||
|
response.set("sounds", output_driver->get_lamps());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
auto opt_sound = this->output_driver->get_sound(item_name);
|
auto opt_sound = this->output_driver->get_sound(item_name);
|
||||||
|
|
||||||
if(!opt_sound)
|
if(!opt_sound)
|
||||||
@@ -143,10 +190,18 @@ void OutputRequestHandler::parseSound(const std::string& item_name, const std::s
|
|||||||
{
|
{
|
||||||
throw new Poco::NotFoundException("No action with name \"" + action + "\" on sounds!");
|
throw new Poco::NotFoundException("No action with name \"" + action + "\" on sounds!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutputRequestHandler::parseDisplay(const std::string& item_name, const std::string& action, const std::string& score)
|
boost::optional<Poco::JSON::Object> OutputRequestHandler::parseDisplay(const std::string& item_name, const std::string& action, const std::string& score)
|
||||||
{
|
{
|
||||||
|
if(item_name == "")
|
||||||
|
{
|
||||||
|
Poco::JSON::Object response;
|
||||||
|
response.set("displays", output_driver->get_displays());
|
||||||
|
return response;
|
||||||
|
}
|
||||||
uint8_t display_number = std::stoi(item_name);
|
uint8_t display_number = std::stoi(item_name);
|
||||||
auto opt_display = this->output_driver->get_display(display_number);
|
auto opt_display = this->output_driver->get_display(display_number);
|
||||||
|
|
||||||
@@ -162,7 +217,6 @@ void OutputRequestHandler::parseDisplay(const std::string& item_name, const std:
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//TODO not compiling
|
|
||||||
unsigned int numerical_score = std::stoi(score);
|
unsigned int numerical_score = std::stoi(score);
|
||||||
display->write_score(numerical_score);
|
display->write_score(numerical_score);
|
||||||
}
|
}
|
||||||
@@ -175,6 +229,8 @@ void OutputRequestHandler::parseDisplay(const std::string& item_name, const std:
|
|||||||
{
|
{
|
||||||
throw new Poco::NotFoundException("No Action with name \"" + action + "\" on sounds!");
|
throw new Poco::NotFoundException("No Action with name \"" + action + "\" on sounds!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> OutputRequestHandler::getPathSegments(Poco::URI uri)
|
std::vector<std::string> OutputRequestHandler::getPathSegments(Poco::URI uri)
|
||||||
|
|||||||
@@ -7,8 +7,10 @@
|
|||||||
|
|
||||||
#include <Poco/Net/HTTPRequestHandler.h>
|
#include <Poco/Net/HTTPRequestHandler.h>
|
||||||
#include <Poco/URI.h>
|
#include <Poco/URI.h>
|
||||||
|
#include <Poco/JSON/JSON.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <boost/optional.hpp>
|
||||||
|
#include <Poco/JSON/Object.h>
|
||||||
|
|
||||||
#include "output/OutputDriver.h"
|
#include "output/OutputDriver.h"
|
||||||
|
|
||||||
@@ -25,12 +27,12 @@ public:
|
|||||||
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override;
|
void handleRequest(Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override;
|
||||||
|
|
||||||
private:
|
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);
|
boost::optional<Poco::JSON::Object> parseSolenoid(const std::string& item_name, const std::string& action);
|
||||||
void parseLamp(const std::string& item_name, const std::string& action);
|
boost::optional<Poco::JSON::Object> parseLamp(const std::string& item_name, const std::string& action);
|
||||||
void parseSound(const std::string& item_name, const std::string& action);
|
boost::optional<Poco::JSON::Object> 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> parseDisplay(const std::string& item_name, const std::string& action, const std::string& score);
|
||||||
|
|
||||||
std::vector<std::string> getPathSegments(Poco::URI uri);
|
std::vector<std::string> getPathSegments(Poco::URI uri);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user