summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/ioprocessor
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-06-20 19:53:21 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-06-20 19:53:21 (GMT)
commit794575f01ce5a6bf7e377eb815f3def5aded74f5 (patch)
tree9c59df64ee290f68b7b6c8698bfac4169684485e /src/uscxml/plugins/ioprocessor
parentd304f85417e3175c5f2ca159dd303309c24e7b81 (diff)
downloaduscxml-794575f01ce5a6bf7e377eb815f3def5aded74f5.zip
uscxml-794575f01ce5a6bf7e377eb815f3def5aded74f5.tar.gz
uscxml-794575f01ce5a6bf7e377eb815f3def5aded74f5.tar.bz2
New version with XHTML invoker
Diffstat (limited to 'src/uscxml/plugins/ioprocessor')
-rw-r--r--src/uscxml/plugins/ioprocessor/CMakeLists.txt31
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp5
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h2
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp94
-rw-r--r--src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h53
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp5
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h62
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp123
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.h90
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp8
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h2
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp41
-rw-r--r--src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h39
13 files changed, 409 insertions, 146 deletions
diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
index 0fab6a4..9fda5f8 100644
--- a/src/uscxml/plugins/ioprocessor/CMakeLists.txt
+++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt
@@ -1,3 +1,34 @@
+file(GLOB_RECURSE SAMPLE_IOPROCESSOR
+ sample/*.cpp
+ sample/*.h
+)
+source_group("IOProcessor\\sample" FILES ${SAMPLE_IOPROCESSOR})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ ioprocessor_sample SHARED
+ ${SAMPLE_IOPROCESSOR})
+ target_link_libraries(ioprocessor_sample uscxml)
+ set_target_properties(ioprocessor_sample PROPERTIES FOLDER "Plugin IOProcessor")
+else()
+ list (APPEND USCXML_FILES ${SAMPLE_IOPROCESSOR})
+endif()
+
+file(GLOB_RECURSE COMET_IOPROCESSOR
+ comet/*.cpp
+ comet/*.h
+)
+source_group("IOProcessor\\comet" FILES ${COMET_IOPROCESSOR})
+if (BUILD_AS_PLUGINS)
+ add_library(
+ ioprocessor_comet SHARED
+ ${COMET_IOPROCESSOR})
+ target_link_libraries(ioprocessor_comet uscxml)
+ set_target_properties(ioprocessor_comet PROPERTIES FOLDER "Plugin IOProcessor")
+else()
+ list (APPEND USCXML_FILES ${COMET_IOPROCESSOR})
+endif()
+
+
# LIBEVENT basichttp ioprocessor - this one is already required above
file(GLOB_RECURSE BASICHTTP_IOPROCESSOR
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 6ddb83c..b2a6824 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -68,7 +68,7 @@ Data BasicHTTPIOProcessor::getDataModelVariables() {
return data;
}
-void BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
Event reqEvent = req;
reqEvent.type = Event::EXTERNAL;
bool scxmlStructFound = false;
@@ -138,6 +138,7 @@ void BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
returnEvent(reqEvent);
evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+ return true;
}
void BasicHTTPIOProcessor::send(const SendRequest& req) {
@@ -189,7 +190,7 @@ void BasicHTTPIOProcessor::send(const SendRequest& req) {
}
// content
-
+
if (req.content.size() > 0) {
kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
kvpSeperator = "&";
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
index 1848e5e..c0fddc1 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h
@@ -36,7 +36,7 @@ public:
Data getDataModelVariables();
/// HTTPServlet
- void httpRecvRequest(const HTTPServer::Request& req);
+ bool httpRecvRequest(const HTTPServer::Request& req);
void setURL(const std::string& url) {
_url = url;
}
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp
new file mode 100644
index 0000000..8fd1172
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.cpp
@@ -0,0 +1,94 @@
+#include <uscxml/Common.h>
+#include "uscxml/plugins/ioprocessor/comet/CometIOProcessor.h"
+#include "uscxml/Message.h"
+#include <iostream>
+
+#include <string.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool connect(pluma::Host& host) {
+ host.add( new CometIOProcessorProvider() );
+ return true;
+}
+#endif
+
+CometIOProcessor::CometIOProcessor() {
+}
+
+CometIOProcessor::~CometIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> CometIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<CometIOProcessor> io = boost::shared_ptr<CometIOProcessor>(new CometIOProcessor());
+ io->_interpreter = interpreter;
+
+ // register at http server
+ std::string path = interpreter->getName();
+ int i = 2;
+ while (!HTTPServer::registerServlet(path + "/comet", io.get())) {
+ std::stringstream ss;
+ ss << interpreter->getName() << i++;
+ path = ss.str();
+ }
+
+ return io;
+}
+
+Data CometIOProcessor::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void CometIOProcessor::send(const SendRequest& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ if (!_longPollingReq) {
+ _outQueue.push_back(req);
+ return;
+ }
+ reply(req, _longPollingReq);
+}
+
+void CometIOProcessor::reply(const SendRequest& req, const HTTPServer::Request& longPoll) {
+ HTTPServer::Reply reply(longPoll);
+
+ if (req.dom) {
+ std::stringstream ss;
+ ss << req.dom;
+ reply.content = ss.str();
+ reply.headers["Content-Type"] = "application/xml";
+ } else if (req.data) {
+ reply.content = Data::toJSON(req.data);
+ reply.headers["Content-Type"] = "application/json";
+ } else if (req.content.length() > 0) {
+ reply.content = req.content;
+ reply.headers["Content-Type"] = "text/plain";
+ }
+
+ if (req.params.find("Content-Type") != req.params.end())
+ reply.headers["Content-Type"] = req.params.find("Content-Type")->first;
+
+ HTTPServer::reply(reply);
+}
+
+bool CometIOProcessor::httpRecvRequest(const HTTPServer::Request& request) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ if (_longPollingReq)
+ // send 204 to last request and remember new one
+ evhttp_send_error(_longPollingReq.curlReq, 204, NULL);
+ _longPollingReq = request;
+ if (!_outQueue.empty()) {
+ send(_outQueue.front());
+ _outQueue.pop_front();
+ }
+ return true;
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
new file mode 100644
index 0000000..05a3798
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/comet/CometIOProcessor.h
@@ -0,0 +1,53 @@
+#ifndef COMETIOPROCESSOR_H_2CUY93KU
+#define COMETIOPROCESSOR_H_2CUY93KU
+
+#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h"
+#include "uscxml/server/HTTPServer.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class CometIOProcessor : public IOProcessorImpl, public HTTPServlet {
+public:
+ CometIOProcessor();
+ virtual ~CometIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("comet");
+ names.insert("http://www.w3.org/TR/scxml/#CometEventProcessor");
+ return names;
+ }
+
+ /// This method can be overridden for specific replies
+ virtual void reply(const SendRequest& req, const HTTPServer::Request& longPoll);
+
+ virtual void send(const SendRequest& req);
+ Data getDataModelVariables();
+
+ virtual bool httpRecvRequest(const HTTPServer::Request& request);
+ virtual void setURL(const std::string& url) {
+ _url = url;
+ }
+
+protected:
+ tthread::recursive_mutex _mutex;
+ std::string _url;
+ std::deque<SendRequest> _outQueue;
+ HTTPServer::Request _longPollingReq;
+
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(CometIOProcessor, IOProcessorImpl);
+#endif
+
+}
+
+#endif /* end of include guard: COMETIOPROCESSOR_H_2CUY93KU */ \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
index 4734ff5..25e0f8c 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
@@ -37,7 +37,7 @@ boost::shared_ptr<IOProcessorImpl> MMIHTTPIOProcessor::create(InterpreterImpl* i
return io;
}
-void MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+bool MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
Event reqEvent = req;
reqEvent.type = Event::EXTERNAL;
bool scxmlStructFound = false;
@@ -107,6 +107,7 @@ void MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
returnEvent(reqEvent);
evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+ return true;
}
void MMIHTTPIOProcessor::send(const SendRequest& req) {
@@ -158,7 +159,7 @@ void MMIHTTPIOProcessor::send(const SendRequest& req) {
}
// content
-
+
if (req.content.size() > 0) {
kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
kvpSeperator = "&";
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
index 2dbd595..3c0a9a9 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
@@ -16,37 +16,37 @@
#endif
namespace uscxml {
-
- class MMIHTTPIOProcessor : public BasicHTTPIOProcessor {
- public:
- MMIHTTPIOProcessor();
- virtual ~MMIHTTPIOProcessor();
- virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
-
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("mmihttp");
- names.insert("http://www.w3.org/TR/mmi-arch/#HTTPTransport");
- return names;
- }
-
- virtual void send(const SendRequest& req);
-
- /// HTTPServlet
- void httpRecvRequest(const HTTPServer::Request& req);
-
- bool canAdaptPath() {
- return false;
- }
-
- protected:
- std::string _url;
- std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
- };
-
- #ifdef BUILD_AS_PLUGINS
- PLUMA_INHERIT_PROVIDER(MMIHTTPIOProcessor, IOProcessorImpl);
- #endif
+
+class MMIHTTPIOProcessor : public BasicHTTPIOProcessor {
+public:
+ MMIHTTPIOProcessor();
+ virtual ~MMIHTTPIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("mmihttp");
+ names.insert("http://www.w3.org/TR/mmi-arch/#HTTPTransport");
+ return names;
+ }
+
+ virtual void send(const SendRequest& req);
+
+ /// HTTPServlet
+ bool httpRecvRequest(const HTTPServer::Request& req);
+
+ bool canAdaptPath() {
+ return false;
+ }
+
+protected:
+ std::string _url;
+ std::map<std::string, std::pair<URL, SendRequest> > _sendRequests;
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(MMIHTTPIOProcessor, IOProcessorImpl);
+#endif
}
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
index bf32b9d..006b9e0 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
@@ -22,68 +22,71 @@ using namespace Arabica::DOM;
std::string MMIEvent::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
- MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) {
- if (!node)
- return INVALID;
-
- if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST"))
- return NEWCONTEXTREQUEST;
- if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE"))
- return NEWCONTEXTRESPONSE;
- if (boost::iequals(node.getLocalName(), "PREPAREREQUEST"))
- return PREPAREREQUEST;
- if (boost::iequals(node.getLocalName(), "PREPARERESPONSE"))
- return PREPARERESPONSE;
- if (boost::iequals(node.getLocalName(), "STARTREQUEST"))
- return STARTREQUEST;
- if (boost::iequals(node.getLocalName(), "STARTRESPONSE"))
- return STARTRESPONSE;
- if (boost::iequals(node.getLocalName(), "DONENOTIFICATION"))
- return DONENOTIFICATION;
- if (boost::iequals(node.getLocalName(), "CANCELREQUEST"))
- return CANCELREQUEST;
- if (boost::iequals(node.getLocalName(), "CANCELRESPONSE"))
- return CANCELRESPONSE;
- if (boost::iequals(node.getLocalName(), "PAUSEREQUEST"))
- return PAUSEREQUEST;
- if (boost::iequals(node.getLocalName(), "PAUSERESPONSE"))
- return PAUSERESPONSE;
- if (boost::iequals(node.getLocalName(), "RESUMEREQUEST"))
- return RESUMEREQUEST;
- if (boost::iequals(node.getLocalName(), "RESUMERESPONSE"))
- return RESUMERESPONSE;
- if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION"))
- return EXTENSIONNOTIFICATION;
- if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST"))
- return CLEARCONTEXTREQUEST;
- if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE"))
- return CLEARCONTEXTRESPONSE;
- if (boost::iequals(node.getLocalName(), "STATUSREQUEST"))
- return STATUSREQUEST;
- if (boost::iequals(node.getLocalName(), "STATUSRESPONSE"))
- return STATUSRESPONSE;
+MMIEvent::Type MMIEvent::getType(Arabica::DOM::Node<std::string> node) {
+ if (!node)
return INVALID;
+
+ if (boost::iequals(node.getLocalName(), "NEWCONTEXTREQUEST"))
+ return NEWCONTEXTREQUEST;
+ if (boost::iequals(node.getLocalName(), "NEWCONTEXTRESPONSE"))
+ return NEWCONTEXTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "PREPAREREQUEST"))
+ return PREPAREREQUEST;
+ if (boost::iequals(node.getLocalName(), "PREPARERESPONSE"))
+ return PREPARERESPONSE;
+ if (boost::iequals(node.getLocalName(), "STARTREQUEST"))
+ return STARTREQUEST;
+ if (boost::iequals(node.getLocalName(), "STARTRESPONSE"))
+ return STARTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "DONENOTIFICATION"))
+ return DONENOTIFICATION;
+ if (boost::iequals(node.getLocalName(), "CANCELREQUEST"))
+ return CANCELREQUEST;
+ if (boost::iequals(node.getLocalName(), "CANCELRESPONSE"))
+ return CANCELRESPONSE;
+ if (boost::iequals(node.getLocalName(), "PAUSEREQUEST"))
+ return PAUSEREQUEST;
+ if (boost::iequals(node.getLocalName(), "PAUSERESPONSE"))
+ return PAUSERESPONSE;
+ if (boost::iequals(node.getLocalName(), "RESUMEREQUEST"))
+ return RESUMEREQUEST;
+ if (boost::iequals(node.getLocalName(), "RESUMERESPONSE"))
+ return RESUMERESPONSE;
+ if (boost::iequals(node.getLocalName(), "EXTENSIONNOTIFICATION"))
+ return EXTENSIONNOTIFICATION;
+ if (boost::iequals(node.getLocalName(), "CLEARCONTEXTREQUEST"))
+ return CLEARCONTEXTREQUEST;
+ if (boost::iequals(node.getLocalName(), "CLEARCONTEXTRESPONSE"))
+ return CLEARCONTEXTRESPONSE;
+ if (boost::iequals(node.getLocalName(), "STATUSREQUEST"))
+ return STATUSREQUEST;
+ if (boost::iequals(node.getLocalName(), "STATUSRESPONSE"))
+ return STATUSRESPONSE;
+ return INVALID;
+}
+
+Arabica::DOM::Node<std::string> MMIEvent::getEventNode(Arabica::DOM::Node<std::string> node) {
+ if (!node)
+ return node;
+
+ if (node.getNodeType() == Node_base::DOCUMENT_NODE)
+ node = Arabica::DOM::Document<std::string>(node).getDocumentElement();
+
+ // get the first element
+ while (node && node.getNodeType() != Node_base::ELEMENT_NODE) {
+ node = node.getNextSibling();
}
-
- Arabica::DOM::Node<std::string> MMIEvent::getEventNode(Arabica::DOM::Node<std::string> node) {
- if (node.getNodeType() == Node_base::DOCUMENT_NODE)
- node = Arabica::DOM::Document<std::string>(node).getDocumentElement();
-
- // get the first element
- while (node && node.getNodeType() != Node_base::ELEMENT_NODE) {
+ // get the contained message
+ if (node && getType(node) == INVALID) {
+ node = node.getFirstChild();
+ while (node && node.getNodeType() != Node_base::ELEMENT_NODE && getType(node) == INVALID) {
node = node.getNextSibling();
}
- // get the contained message
- if (node && getType(node) == INVALID) {
- node = node.getFirstChild();
- while (node && node.getNodeType() != Node_base::ELEMENT_NODE && getType(node) == INVALID) {
- node = node.getNextSibling();
- }
- }
- return node;
}
+ return node;
+}
+
-
Arabica::DOM::Document<std::string> MMIEvent::toXML() const {
Arabica::DOM::DOMImplementation<std::string> domFactory = Arabica::SimpleDOM::DOMImplementation<std::string>::getDOMImplementation();
Document<std::string> doc = domFactory.createDocument(nameSpace, "", 0);
@@ -255,7 +258,7 @@ MMIEvent::operator Event() const {
}
return ev;
}
-
+
ContextualizedRequest ContextualizedRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
ContextualizedRequest msg(MMIEvent::fromXML(node, interpreter));
while (node) {
@@ -273,8 +276,8 @@ ContextualizedRequest::operator Event() const {
// do we want to represent the context? It's the interpreters name already
return ev;
}
-
-
+
+
ContentRequest ContentRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
ContentRequest msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
@@ -424,5 +427,5 @@ StatusRequest StatusRequest::fromXML(Arabica::DOM::Node<std::string> node, Inter
return msg;
}
-
+
} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
index b7d017f..aedd88c 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
@@ -10,44 +10,44 @@ namespace uscxml {
class MMIEvent {
public:
enum Type {
- NEWCONTEXTREQUEST,
- NEWCONTEXTRESPONSE,
- PREPAREREQUEST,
- PREPARERESPONSE,
- STARTREQUEST,
- STARTRESPONSE,
- DONENOTIFICATION,
- CANCELREQUEST,
- CANCELRESPONSE,
- PAUSEREQUEST,
- PAUSERESPONSE,
- RESUMEREQUEST,
- RESUMERESPONSE,
- EXTENSIONNOTIFICATION,
- CLEARCONTEXTREQUEST,
- CLEARCONTEXTRESPONSE,
- STATUSREQUEST,
- STATUSRESPONSE,
- INVALID
+ NEWCONTEXTREQUEST,
+ NEWCONTEXTRESPONSE,
+ PREPAREREQUEST,
+ PREPARERESPONSE,
+ STARTREQUEST,
+ STARTRESPONSE,
+ DONENOTIFICATION,
+ CANCELREQUEST,
+ CANCELRESPONSE,
+ PAUSEREQUEST,
+ PAUSERESPONSE,
+ RESUMEREQUEST,
+ RESUMERESPONSE,
+ EXTENSIONNOTIFICATION,
+ CLEARCONTEXTREQUEST,
+ CLEARCONTEXTRESPONSE,
+ STATUSREQUEST,
+ STATUSRESPONSE,
+ INVALID
};
-
+
static Type getType(Arabica::DOM::Node<std::string> node);
static Arabica::DOM::Node<std::string> getEventNode(Arabica::DOM::Node<std::string> node);
-
+
virtual Arabica::DOM::Document<std::string> toXML() const;
static MMIEvent fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
// conversion operator
operator Event() const;
-
+
std::string source;
std::string target;
std::string data;
std::string requestId;
std::string tagName;
Type type;
-
+
static std::string nameSpace;
protected:
@@ -72,7 +72,7 @@ public:
}
NewContextRequest(const MMIEvent& father) : MMIEvent(father) {}
static NewContextRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
MMIEvent event = MMIEvent::fromXML(node, interpreter);
event.type = NEWCONTEXTREQUEST;
return event;
@@ -90,7 +90,7 @@ class ContextualizedRequest : public MMIEvent {
public:
virtual Arabica::DOM::Document<std::string> toXML() const;
static ContextualizedRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
std::string context;
protected:
@@ -106,7 +106,7 @@ public:
}
PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static PauseRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PauseRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = PAUSEREQUEST;
return event;
@@ -127,7 +127,7 @@ public:
}
ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static ResumeRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ResumeRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = RESUMEREQUEST;
return event;
@@ -148,7 +148,7 @@ public:
}
CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static CancelRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
CancelRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = CANCELREQUEST;
return event;
@@ -169,7 +169,7 @@ public:
}
ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
static ClearContextRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ClearContextRequest event = ContextualizedRequest::fromXML(node, interpreter);
event.type = CLEARCONTEXTREQUEST;
return event;
@@ -190,7 +190,7 @@ public:
}
virtual Arabica::DOM::Document<std::string> toXML() const;
static StatusRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
bool automaticUpdate;
protected:
@@ -207,7 +207,7 @@ public:
virtual Arabica::DOM::Document<std::string> toXML() const;
static ContentRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
std::string content;
ContentURL contentURL;
@@ -224,7 +224,7 @@ public:
}
PrepareRequest(const ContentRequest& father) : ContentRequest(father) {}
static PrepareRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PrepareRequest event = ContentRequest::fromXML(node, interpreter);
event.type = PREPAREREQUEST;
return event;
@@ -245,7 +245,7 @@ public:
}
StartRequest(const ContentRequest& father) : ContentRequest(father) {}
static StartRequest fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
StartRequest event = ContentRequest::fromXML(node, interpreter);
event.type = STARTREQUEST;
return event;
@@ -267,7 +267,7 @@ public:
}
virtual Arabica::DOM::Document<std::string> toXML() const;
static ExtensionNotification fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
operator Event() const;
std::string name;
protected:
@@ -290,7 +290,7 @@ public:
}
virtual Arabica::DOM::Document<std::string> toXML() const;
static StatusResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
Status status;
protected:
StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
@@ -301,7 +301,7 @@ public:
virtual Arabica::DOM::Document<std::string> toXML() const;
StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
static StatusInfoResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL);
+ InterpreterImpl* interpreter = NULL);
std::string statusInfo;
protected:
StatusInfoResponse() {}
@@ -315,7 +315,7 @@ public:
}
PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static PrepareResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PrepareResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = PREPARERESPONSE;
return event;
@@ -336,7 +336,7 @@ public:
}
StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static StartResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
StartResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = STARTRESPONSE;
return event;
@@ -357,7 +357,7 @@ public:
}
CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static CancelResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
CancelResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = CANCELRESPONSE;
return event;
@@ -378,7 +378,7 @@ public:
}
PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static PauseResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
PauseResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = PAUSERESPONSE;
return event;
@@ -399,7 +399,7 @@ public:
}
ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static ResumeResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ResumeResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = RESUMERESPONSE;
return event;
@@ -420,7 +420,7 @@ public:
}
ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static ClearContextResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
ClearContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = CLEARCONTEXTRESPONSE;
return event;
@@ -441,7 +441,7 @@ public:
}
NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static NewContextResponse fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
NewContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
event.type = NEWCONTEXTRESPONSE;
return event;
@@ -463,7 +463,7 @@ public:
}
DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
static DoneNotification fromXML(Arabica::DOM::Node<std::string> node,
- InterpreterImpl* interpreter = NULL) {
+ InterpreterImpl* interpreter = NULL) {
DoneNotification event = StatusInfoResponse::fromXML(node, interpreter);
event.type = DONENOTIFICATION;
return event;
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
index 55ee9fe..9e8b5c2 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp
@@ -11,7 +11,7 @@ namespace uscxml {
::LifeCycleEvent MMIProtoBridge::toProto(const NewContextRequest& mmiEvent) {
INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_NEW_CONTEXT_REQUEST);
- return lifeCycleEvent;
+ return lifeCycleEvent;
}
::LifeCycleEvent MMIProtoBridge::toProto(const NewContextResponse& mmiEvent) {
@@ -32,13 +32,13 @@ namespace uscxml {
::LifeCycleEvent MMIProtoBridge::toProto(const StartRequest& mmiEvent) {
INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_START_REQUEST);
- ::LifeCycleRequest* lifeCycleRequest = lifeCycleEvent.MutableExtension(::LifeCycleRequest::Request);
+ ::LifeCycleRequest* lifeCycleRequest = lifeCycleEvent.MutableExtension(::LifeCycleRequest::Request);
lifeCycleRequest->set_context(mmiEvent.context);
-
+
::StartRequest* startRequest = lifeCycleRequest->MutableExtension(::StartRequest::Request);
startRequest->set_content(mmiEvent.content);
startRequest->set_contenturl(mmiEvent.contentURL.href);
-
+
::StartRequestData* startRequestData = startRequest->MutableExtension(::StartRequestData::Request);
startRequestData->set_data(mmiEvent.data);
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
index 32a69f6..af6c720 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h
@@ -6,7 +6,7 @@
#include "MMIMessages.h"
namespace uscxml {
-
+
class MMIProtoBridge {
public:
static ::LifeCycleEvent toProto(const NewContextRequest&);
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp
new file mode 100644
index 0000000..da36a17
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.cpp
@@ -0,0 +1,41 @@
+#include <uscxml/Common.h>
+#include "uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h"
+#include "uscxml/Message.h"
+#include <iostream>
+
+#include <string.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool connect(pluma::Host& host) {
+ host.add( new SampleIOProcessorProvider() );
+ return true;
+}
+#endif
+
+SampleIOProcessor::SampleIOProcessor() {
+}
+
+SampleIOProcessor::~SampleIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> SampleIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<SampleIOProcessor> io = boost::shared_ptr<SampleIOProcessor>(new SampleIOProcessor());
+ return io;
+}
+
+Data SampleIOProcessor::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void SampleIOProcessor::send(const SendRequest& req) {
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
new file mode 100644
index 0000000..3a58c13
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/sample/SampleIOProcessor.h
@@ -0,0 +1,39 @@
+#ifndef SAMPLEIOPROCESSOR_H_2CUY93KU
+#define SAMPLEIOPROCESSOR_H_2CUY93KU
+
+#include "uscxml/concurrency/eventqueue/DelayedEventQueue.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class SampleIOProcessor : public IOProcessorImpl {
+public:
+ SampleIOProcessor();
+ virtual ~SampleIOProcessor();
+ virtual boost::shared_ptr<IOProcessorImpl> create(uscxml::InterpreterImpl* interpreter);
+
+ virtual std::set<std::string> getNames() {
+ std::set<std::string> names;
+ names.insert("sample");
+ names.insert("http://www.w3.org/TR/scxml/#SampleEventProcessor");
+ return names;
+ }
+
+ virtual void send(const SendRequest& req);
+ Data getDataModelVariables();
+
+protected:
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(SampleIOProcessor, IOProcessorImpl);
+#endif
+
+}
+
+#endif /* end of include guard: SAMPLEIOPROCESSOR_H_2CUY93KU */ \ No newline at end of file