summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/ioprocessor
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-06-10 22:47:14 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2013-06-10 22:47:14 (GMT)
commit6f56474450b7c54f2c95b5dea6a7a42623141649 (patch)
tree420c52085d8cf778360c09baf9722b21d01259da /src/uscxml/plugins/ioprocessor
parenta154682fc1b25581742d38dd5fe9aa06ede167b7 (diff)
downloaduscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.zip
uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.tar.gz
uscxml-6f56474450b7c54f2c95b5dea6a7a42623141649.tar.bz2
W3C MMI Architecture framework
Diffstat (limited to 'src/uscxml/plugins/ioprocessor')
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp12
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIComponent.h34
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp188
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h53
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h12
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp196
-rw-r--r--src/uscxml/plugins/ioprocessor/modality/MMIMessages.h327
7 files changed, 648 insertions, 174 deletions
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp
deleted file mode 100644
index c1e973b..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "MMIComponent.h"
-//#include <glog/logging.h>
-
-namespace uscxml {
-
-MMIComponent::MMIComponent() {
-}
-
-MMIComponent::~MMIComponent() {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h
deleted file mode 100644
index 990222f..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef MMIIOPROCESSOR_H_W09J90F0
-#define MMIIOPROCESSOR_H_W09J90F0
-
-#include "MMIMessages.h"
-
-namespace uscxml {
-
-class MMIComponent {
-public:
- MMIComponent();
- virtual ~MMIComponent();
-
- /** Modality component */
- virtual PrepareResponse prepare(const PrepareRequest&) = 0;
- virtual StartResponse start(const StartRequest&) = 0;
- virtual CancelResponse cancel(const CancelRequest&) = 0;
- virtual PauseResponse pause(const PauseRequest&) = 0;
- virtual ResumeResponse resume(const ResumeRequest&) = 0;
- virtual ExtensionNotification extension(const ExtensionNotification&) = 0;
- virtual ClearContextRequest clearContext(const ClearContextRequest&) = 0;
- virtual StatusResponse status(const StatusRequest&) = 0;
-
- /** Interaction Manager */
- virtual NewContextResponse newContext(const NewContextRequest&) = 0;
- virtual DoneNotification done(const DoneNotification&) = 0;
-// virtual ExtensionNotification extension(const ExtensionNotification&);
-
-
-};
-
-}
-
-
-#endif /* end of include guard: MMIIOPROCESSOR_H_W09J90F0 */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
new file mode 100644
index 0000000..4734ff5
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.cpp
@@ -0,0 +1,188 @@
+#include "uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h"
+#include "uscxml/Message.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 MMIHTTPIOProcessorProvider() );
+ return true;
+}
+#endif
+
+MMIHTTPIOProcessor::MMIHTTPIOProcessor() {
+}
+
+MMIHTTPIOProcessor::~MMIHTTPIOProcessor() {
+}
+
+boost::shared_ptr<IOProcessorImpl> MMIHTTPIOProcessor::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<MMIHTTPIOProcessor> io = boost::shared_ptr<MMIHTTPIOProcessor>(new MMIHTTPIOProcessor());
+ io->_interpreter = interpreter;
+
+ // register at http server
+ std::string path = interpreter->getName();
+ int i = 2;
+ while (!HTTPServer::registerServlet(path + "/mmihttp", io.get())) {
+ std::stringstream ss;
+ ss << interpreter->getName() << i++;
+ path = ss.str();
+ }
+
+ return io;
+}
+
+void MMIHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
+ Event reqEvent = req;
+ reqEvent.type = Event::EXTERNAL;
+ bool scxmlStructFound = false;
+
+ if (reqEvent.data.compound["header"].compound.find("Content-Type") != reqEvent.data.compound["header"].compound.end() &&
+ boost::iequals(reqEvent.data.compound["header"].compound["Content-Type"].atom, "application/x-www-form-urlencoded")) {
+ std::stringstream ss(reqEvent.data.compound["content"].atom);
+ std::string term;
+ while(std::getline(ss, term, '&')) {
+ size_t split = term.find_first_of("=");
+ if (split != std::string::npos) {
+ std::string key = evhttp_decode_uri(term.substr(0, split).c_str());
+ std::string value = evhttp_decode_uri(term.substr(split + 1).c_str());
+ if (boost::iequals(key, "_scxmleventname")) {
+ reqEvent.name = value;
+ } else if (boost::iequals(key, "content")) {
+ reqEvent.initContent(value);
+ } else {
+ reqEvent.data.compound[key] = value;
+ reqEvent.params.insert(std::make_pair(key, value));
+ }
+ } else {
+ // this is most likely wrong
+ reqEvent.content = evhttp_decode_uri(term.c_str());
+ }
+ }
+ } else {
+ if (reqEvent.data.compound["header"].compound.find("_scxmleventstruct") != reqEvent.data.compound["header"].compound.end()) {
+ // TODO: this looses all other information
+ reqEvent = Event::fromXML(evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventstruct"].atom.c_str()));
+ scxmlStructFound = true;
+ }
+ if (reqEvent.data.compound["header"].compound.find("_scxmleventname") != reqEvent.data.compound["header"].compound.end()) {
+ reqEvent.name = evhttp_decode_uri(reqEvent.data.compound["header"].compound["_scxmleventname"].atom.c_str());
+ }
+ }
+ std::map<std::string, Data>::iterator headerIter = reqEvent.data.compound["header"].compound.begin();
+ while(headerIter != reqEvent.data.compound["header"].compound.end()) {
+ reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.atom.c_str()), Data::VERBATIM);
+ headerIter++;
+ }
+
+#if 0
+ std::map<std::string, std::string>::const_iterator headerIter = req.headers.begin();
+ while(headerIter != req.headers.end()) {
+ if (boost::iequals("_scxmleventstruct", headerIter->first)) {
+ reqEvent = Event::fromXML(evhttp_decode_uri(headerIter->second.c_str()));
+ scxmlStructFound = true;
+ break;
+ } else if (boost::iequals("_scxmleventname", headerIter->first)) {
+ reqEvent.name = evhttp_decode_uri(headerIter->second.c_str());
+ } else {
+ reqEvent.data.compound[headerIter->first] = Data(evhttp_decode_uri(headerIter->second.c_str()), Data::VERBATIM);
+ }
+ headerIter++;
+ }
+#endif
+
+ /// test532
+ if (reqEvent.name.length() == 0)
+ reqEvent.name = "http." + req.data.compound.at("type").atom;
+
+ if (!scxmlStructFound) {
+ // get content into event
+ reqEvent.data.compound["content"] = Data(req.content, Data::VERBATIM);
+ }
+
+ returnEvent(reqEvent);
+ evhttp_send_reply(req.curlReq, 200, "OK", NULL);
+}
+
+void MMIHTTPIOProcessor::send(const SendRequest& req) {
+
+ if (req.target.length() == 0) {
+ _interpreter->receiveInternal(Event("error.communication", Event::PLATFORM));
+ return;
+ }
+
+ bool isLocal = false;
+ std::string target;
+ if (!boost::equals(req.target, _url)) {
+ target = req.target;
+ } else {
+ isLocal = true;
+ target = _url;
+ }
+ URL targetURL(target);
+ std::stringstream kvps;
+ std::string kvpSeperator;
+
+ // event name
+ if (req.name.size() > 0) {
+ kvps << kvpSeperator << evhttp_encode_uri("_scxmleventname") << "=" << evhttp_encode_uri(req.name.c_str());
+ kvpSeperator = "&";
+// targetURL.addOutHeader("_scxmleventname", evhttp_encode_uri(req.name.c_str()));
+ }
+
+ // event namelist
+ if (req.namelist.size() > 0) {
+ std::map<std::string, std::string>::const_iterator namelistIter = req.namelist.begin();
+ while (namelistIter != req.namelist.end()) {
+ kvps << kvpSeperator << evhttp_encode_uri(namelistIter->first.c_str()) << "=" << evhttp_encode_uri(namelistIter->second.c_str());
+ kvpSeperator = "&";
+// targetURL.addOutHeader(namelistIter->first, namelistIter->second);
+ namelistIter++;
+ }
+ }
+
+ // event params
+ if (req.params.size() > 0) {
+ std::multimap<std::string, std::string>::const_iterator paramIter = req.params.begin();
+ while (paramIter != req.params.end()) {
+ kvps << kvpSeperator << evhttp_encode_uri(paramIter->first.c_str()) << "=" << evhttp_encode_uri(paramIter->second.c_str());
+ kvpSeperator = "&";
+// targetURL.addOutHeader(paramIter->first, paramIter->second);
+ paramIter++;
+ }
+ }
+
+ // content
+
+ if (req.content.size() > 0) {
+ kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(req.content.c_str());
+ kvpSeperator = "&";
+ }
+ if (req.dom) {
+ std::stringstream xmlStream;
+ xmlStream << req.dom;
+ kvps << kvpSeperator << evhttp_encode_uri("content") << "=" << evhttp_encode_uri(xmlStream.str().c_str());
+ kvpSeperator = "&";
+ }
+ targetURL.setOutContent(kvps.str());
+
+ targetURL.setRequestType("post");
+ targetURL.addMonitor(this);
+
+ _sendRequests[req.sendid] = std::make_pair(targetURL, req);
+ if (isLocal) {
+ // test201 use a blocking request with local communication
+ targetURL.download(true);
+ } else {
+ URLFetcher::fetchURL(targetURL);
+ }
+}
+
+
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
new file mode 100644
index 0000000..2dbd595
--- /dev/null
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIHTTPIOProcessor.h
@@ -0,0 +1,53 @@
+#ifndef MMIHTTPIOPROCESSOR_H_P1FN0YPL
+#define MMIHTTPIOPROCESSOR_H_P1FN0YPL
+
+#include "uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.h"
+#include "uscxml/Interpreter.h"
+#include "uscxml/Factory.h"
+#ifndef _WIN32
+#include <sys/time.h>
+#endif
+
+#include <event2/http.h>
+#include <event2/http_struct.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#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
+
+}
+
+#endif /* end of include guard: MMIHTTPIOPROCESSOR_H_P1FN0YPL */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h b/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h
deleted file mode 100644
index 45e316f..0000000
--- a/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef MMIINVOKER_H_612CXWUU
-#define MMIINVOKER_H_612CXWUU
-
-#include "MMIComponent.h"
-
-namespace uscxml {
-
-class MMIInvokerImpl : public virtual InvokerImpl, public MMIIOProcessor {
-};
-
-}
-#endif /* end of include guard: MMIINVOKER_H_612CXWUU */
diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
index 717e174..bf32b9d 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.cpp
@@ -5,15 +5,86 @@
#include <DOM/SAX2DOM/SAX2DOM.hpp>
#include <SAX/helpers/InputSourceResolver.hpp>
+#include <uscxml/NameSpacingParser.h>
+
#include <boost/algorithm/string.hpp>
+#define STRING_ATTR_OR_EXPR(element, name)\
+(element.hasAttributeNS(nameSpace, "name##Expr") && interpreter ? \
+ interpreter->getDataModel().evalAsString(element.getAttributeNS(nameSpace, "name##Expr")) : \
+ (element.hasAttributeNS(nameSpace, #name) ? element.getAttributeNS(nameSpace, #name) : "") \
+)
+
+
namespace uscxml {
using namespace Arabica::DOM;
-std::string MMIMessage::nameSpace = "http://www.w3.org/2008/04/mmi-arch";
+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;
+ return INVALID;
+ }
+
+ 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) {
+ 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;
+ }
-Arabica::DOM::Document<std::string> MMIMessage::toXML() {
+
+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);
Element<std::string> mmiElem = doc.createElementNS(nameSpace, "mmi");
@@ -23,7 +94,7 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() {
msgElem.setAttributeNS(nameSpace, "RequestID", requestId);
if (data.size() > 0) {
- Element<std::string> dataElem = doc.createElementNS(nameSpace, "data");
+ Element<std::string> dataElem = doc.createElementNS(nameSpace, "Data");
// try to parse content
std::stringstream* ss = new std::stringstream();
@@ -32,7 +103,7 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() {
Arabica::SAX::InputSource<std::string> inputSource;
inputSource.setByteStream(ssPtr);
- Arabica::SAX2DOM::Parser<std::string> parser;
+ NameSpacingParser parser;
if(parser.parse(inputSource)) {
Node<std::string> importedNode = doc.importNode(parser.getDocument().getDocumentElement(), true);
dataElem.appendChild(importedNode);
@@ -45,18 +116,17 @@ Arabica::DOM::Document<std::string> MMIMessage::toXML() {
mmiElem.appendChild(msgElem);
doc.appendChild(mmiElem);
- std::cout << doc;
return doc;
}
-Arabica::DOM::Document<std::string> ContextualizedRequest::toXML() {
- Document<std::string> doc = MMIMessage::toXML();
+Arabica::DOM::Document<std::string> ContextualizedRequest::toXML() const {
+ Document<std::string> doc = MMIEvent::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
msgElem.setAttributeNS(nameSpace, "Context", context);
return doc;
}
-Arabica::DOM::Document<std::string> ContentRequest::toXML() {
+Arabica::DOM::Document<std::string> ContentRequest::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
@@ -92,14 +162,14 @@ Arabica::DOM::Document<std::string> ContentRequest::toXML() {
return doc;
}
-Arabica::DOM::Document<std::string> ExtensionNotification::toXML() {
+Arabica::DOM::Document<std::string> ExtensionNotification::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
msgElem.setAttributeNS(nameSpace, "Name", name);
return doc;
}
-Arabica::DOM::Document<std::string> StatusResponse::toXML() {
+Arabica::DOM::Document<std::string> StatusResponse::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
if (status == ALIVE) {
@@ -114,7 +184,7 @@ Arabica::DOM::Document<std::string> StatusResponse::toXML() {
return doc;
}
-Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() {
+Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() const {
Document<std::string> doc = StatusResponse::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
@@ -126,7 +196,7 @@ Arabica::DOM::Document<std::string> StatusInfoResponse::toXML() {
return doc;
}
-Arabica::DOM::Document<std::string> StatusRequest::toXML() {
+Arabica::DOM::Document<std::string> StatusRequest::toXML() const {
Document<std::string> doc = ContextualizedRequest::toXML();
Element<std::string> msgElem = Element<std::string>(doc.getDocumentElement().getFirstChild());
@@ -139,19 +209,18 @@ Arabica::DOM::Document<std::string> StatusRequest::toXML() {
return doc;
}
-MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- MMIMessage msg;
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+MMIEvent MMIEvent::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ MMIEvent msg;
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- msg.source = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Source");
- msg.target = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Target");
-// msg.data = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Data");
- msg.requestId = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestID");
+ msg.source = STRING_ATTR_OR_EXPR(msgElem, Source);
+ msg.target = STRING_ATTR_OR_EXPR(msgElem, Target);
+// msg.data = STRING_ATTR_OR_EXPR(msgElem, Data);
+ msg.requestId = STRING_ATTR_OR_EXPR(msgElem, RequestID);
msg.tagName = msgElem.getLocalName();
Element<std::string> dataElem;
@@ -167,35 +236,47 @@ MMIMessage MMIMessage::fromXML(const Arabica::DOM::Document<std::string>& doc) {
if (dataElem && boost::iequals(dataElem.getLocalName(), "data")) {
std::stringstream ss;
node = dataElem.getFirstChild();
- while (node) {
- if (node.getNodeType() == Node_base::ELEMENT_NODE) {
- ss << node;
- break;
- }
- node = node.getNextSibling();
- }
+ if (node)
+ ss << node;
msg.data = ss.str();
}
return msg;
}
-ContextualizedRequest ContextualizedRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- ContextualizedRequest msg(NewContextRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+MMIEvent::operator Event() const {
+ Event ev;
+ ev.setOriginType("mmi.event");
+ ev.setOrigin(source);
+ ev.setRaw(data);
+ ev.setSendId(requestId);
+ if (data.length() > 0) {
+ ev.initContent(data);
+ }
+ return ev;
+}
+
+ContextualizedRequest ContextualizedRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ ContextualizedRequest msg(MMIEvent::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- msg.context = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context");
+ msg.context = STRING_ATTR_OR_EXPR(msgElem, Context);
return msg;
}
-ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- ContentRequest msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ContextualizedRequest::operator Event() const {
+ Event ev = MMIEvent::operator Event();
+ // 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) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
@@ -228,39 +309,48 @@ ContentRequest ContentRequest::fromXML(const Arabica::DOM::Document<std::string>
}
msg.content = ss.str();
} else if(boost::iequals(contentElem.getLocalName(), "contentURL")) {
- msg.contentURL.href = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "href");
- msg.contentURL.maxAge = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "max-age");
- msg.contentURL.fetchTimeout = contentElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "fetchtimeout");
+ msg.contentURL.href = STRING_ATTR_OR_EXPR(contentElem, href);
+ msg.contentURL.maxAge = STRING_ATTR_OR_EXPR(contentElem, max-age);
+ msg.contentURL.fetchTimeout = STRING_ATTR_OR_EXPR(contentElem, fetchtimeout);
}
}
- //msg.content = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Context");
+ //msg.content = msgElem.getAttributeNS(nameSpace, "Context");
return msg;
}
-ExtensionNotification ExtensionNotification::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- ExtensionNotification msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ExtensionNotification ExtensionNotification::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ ExtensionNotification msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- msg.name = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Name");
+ msg.name = STRING_ATTR_OR_EXPR(msgElem, Name);
+ msg.type = EXTENSIONNOTIFICATION;
return msg;
}
-StatusResponse StatusResponse::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- StatusResponse msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+ExtensionNotification::operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ if (name.length() > 0) {
+ ev.setName("mmi.extensionnotification." + name);
+ } else {
+ ev.setName("mmi.extensionnotification");
+ }
+ return ev;
+}
+
+StatusResponse StatusResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ StatusResponse msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- std::string status = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "Status");
+ std::string status = STRING_ATTR_OR_EXPR(msgElem, Status);
if (boost::iequals(status, "ALIVE")) {
msg.status = ALIVE;
@@ -271,12 +361,12 @@ StatusResponse StatusResponse::fromXML(const Arabica::DOM::Document<std::string>
} else if(boost::iequals(status, "SUCCESS")) {
msg.status = SUCCESS;
}
+ msg.type = STATUSRESPONSE;
return msg;
}
-StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- StatusInfoResponse msg(StatusResponse::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+StatusInfoResponse StatusInfoResponse::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ StatusInfoResponse msg(StatusResponse::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
@@ -305,21 +395,19 @@ StatusInfoResponse StatusInfoResponse::fromXML(const Arabica::DOM::Document<std:
node = node.getNextSibling();
}
}
-
return msg;
}
-StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>& doc) {
- StatusRequest msg(ContextualizedRequest::fromXML(doc));
- Node<std::string> node = doc.getDocumentElement().getFirstChild();
+StatusRequest StatusRequest::fromXML(Arabica::DOM::Node<std::string> node, InterpreterImpl* interpreter) {
+ StatusRequest msg(ContextualizedRequest::fromXML(node, interpreter));
while (node) {
if (node.getNodeType() == Node_base::ELEMENT_NODE)
break;
node = node.getNextSibling();
}
Element<std::string> msgElem(node);
- std::string autoUpdate = msgElem.getAttributeNS("http://www.w3.org/2008/04/mmi-arch", "RequestAutomaticUpdate");
+ std::string autoUpdate = STRING_ATTR_OR_EXPR(msgElem, RequestAutomaticUpdate);
if (boost::iequals(autoUpdate, "true")) {
msg.automaticUpdate = true;
@@ -332,7 +420,9 @@ StatusRequest StatusRequest::fromXML(const Arabica::DOM::Document<std::string>&
} else {
msg.automaticUpdate = false;
}
+ msg.type = STATUSREQUEST;
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 a5328ac..b7d017f 100644
--- a/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
+++ b/src/uscxml/plugins/ioprocessor/modality/MMIMessages.h
@@ -1,69 +1,142 @@
-#ifndef MMIMESSAGES_H_OS0SE7H5
-#define MMIMESSAGES_H_OS0SE7H5
+#ifndef MMIEVENT_H_OS0SE7H5
+#define MMIEVENT_H_OS0SE7H5
#include <DOM/Node.hpp>
#include <DOM/Document.hpp>
+#include <uscxml/Interpreter.h>
namespace uscxml {
-class MMIMessage {
+class MMIEvent {
public:
- virtual Arabica::DOM::Document<std::string> toXML();
- static MMIMessage fromXML(const Arabica::DOM::Document<std::string>& doc);
-
+ enum Type {
+ 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);
+
+ // 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:
- MMIMessage() {}
+ MMIEvent() {}
};
-class NewContextRequest : public MMIMessage {
+class MMIEventReceiver {
public:
- NewContextRequest() {
- tagName = "NewContextRequest";
- }
- NewContextRequest(const MMIMessage& father) : MMIMessage(father) {}
- static NewContextRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return MMIMessage::fromXML(doc);
- }
+ virtual void received(const MMIEvent& mmiEvent) = 0;
+};
+class MMIEventSender {
+public:
+ virtual void send(const MMIEvent& mmiEvent) = 0;
};
-class ContextualizedRequest : public NewContextRequest {
+class NewContextRequest : public MMIEvent {
public:
- virtual Arabica::DOM::Document<std::string> toXML();
- static ContextualizedRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+ NewContextRequest() {
+ tagName = "NewContextRequest";
+ type = NEWCONTEXTREQUEST;
+ }
+ NewContextRequest(const MMIEvent& father) : MMIEvent(father) {}
+ static NewContextRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ MMIEvent event = MMIEvent::fromXML(node, interpreter);
+ event.type = NEWCONTEXTREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = MMIEvent::operator Event();
+ ev.setName("mmi.newcontextrequest");
+ ev.setDOM(toXML());
+ return ev;
+ }
+ std::string token; ///< special token for server-less modality components
+};
+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);
+ operator Event() const;
std::string context;
protected:
ContextualizedRequest() {}
- ContextualizedRequest(const NewContextRequest& father) : NewContextRequest(father) {}
+ ContextualizedRequest(const MMIEvent& father) : MMIEvent(father) {}
};
class PauseRequest : public ContextualizedRequest {
public:
PauseRequest() {
tagName = "PauseRequest";
+ type = PAUSEREQUEST;
}
PauseRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static PauseRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static PauseRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PauseRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = PAUSEREQUEST;
+ return event;
}
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setName("mmi.pauserequest");
+ ev.setDOM(toXML());
+ return ev;
+ }
+
};
class ResumeRequest : public ContextualizedRequest {
public:
ResumeRequest() {
tagName = "ResumeRequest";
+ type = RESUMEREQUEST;
}
ResumeRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static ResumeRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static ResumeRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ResumeRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = RESUMEREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setDOM(toXML());
+ ev.setName("mmi.resumerequest");
+ return ev;
}
};
@@ -71,10 +144,20 @@ class CancelRequest : public ContextualizedRequest {
public:
CancelRequest() {
tagName = "CancelRequest";
+ type = CANCELREQUEST;
}
CancelRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static CancelRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static CancelRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ CancelRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = CANCELREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setName("mmi.cancelrequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -82,10 +165,20 @@ class ClearContextRequest : public ContextualizedRequest {
public:
ClearContextRequest() {
tagName = "ClearContextRequest";
+ type = CLEARCONTEXTREQUEST;
}
ClearContextRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
- static ClearContextRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContextualizedRequest::fromXML(doc);
+ static ClearContextRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ClearContextRequest event = ContextualizedRequest::fromXML(node, interpreter);
+ event.type = CLEARCONTEXTREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContextualizedRequest::operator Event();
+ ev.setName("mmi.clearcontextrequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -93,10 +186,12 @@ class StatusRequest : public ContextualizedRequest {
public:
StatusRequest() {
tagName = "StatusRequest";
+ type = STARTREQUEST;
}
- virtual Arabica::DOM::Document<std::string> toXML();
- static StatusRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
-
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static StatusRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
bool automaticUpdate;
protected:
StatusRequest(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
@@ -110,8 +205,10 @@ public:
std::string fetchTimeout;
};
- virtual Arabica::DOM::Document<std::string> toXML();
- static ContentRequest fromXML(const Arabica::DOM::Document<std::string>& doc);
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static ContentRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
std::string content;
ContentURL contentURL;
protected:
@@ -123,10 +220,20 @@ class PrepareRequest : public ContentRequest {
public:
PrepareRequest() {
tagName = "PrepareRequest";
+ type = PREPAREREQUEST;
}
PrepareRequest(const ContentRequest& father) : ContentRequest(father) {}
- static PrepareRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContentRequest::fromXML(doc);
+ static PrepareRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PrepareRequest event = ContentRequest::fromXML(node, interpreter);
+ event.type = PREPAREREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContentRequest::operator Event();
+ ev.setName("mmi.preparerequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -134,10 +241,20 @@ class StartRequest : public ContentRequest {
public:
StartRequest() {
tagName = "StartRequest";
+ type = STARTREQUEST;
}
StartRequest(const ContentRequest& father) : ContentRequest(father) {}
- static StartRequest fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return ContentRequest::fromXML(doc);
+ static StartRequest fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ StartRequest event = ContentRequest::fromXML(node, interpreter);
+ event.type = STARTREQUEST;
+ return event;
+ }
+ operator Event() const {
+ Event ev = ContentRequest::operator Event();
+ ev.setName("mmi.startrequest");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -146,10 +263,12 @@ class ExtensionNotification : public ContextualizedRequest {
public:
ExtensionNotification() {
tagName = "ExtensionNotification";
+ type = EXTENSIONNOTIFICATION;
}
- virtual Arabica::DOM::Document<std::string> toXML();
- static ExtensionNotification fromXML(const Arabica::DOM::Document<std::string>& doc);
-
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static ExtensionNotification fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
+ operator Event() const;
std::string name;
protected:
ExtensionNotification(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
@@ -167,33 +286,45 @@ public:
StatusResponse() {
tagName = "StatusResponse";
+ type = STATUSRESPONSE;
}
- virtual Arabica::DOM::Document<std::string> toXML();
- static StatusResponse fromXML(const Arabica::DOM::Document<std::string>& doc);
+ virtual Arabica::DOM::Document<std::string> toXML() const;
+ static StatusResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL);
Status status;
protected:
StatusResponse(const ContextualizedRequest& father) : ContextualizedRequest(father) {}
-
};
class StatusInfoResponse : public StatusResponse {
public:
- virtual Arabica::DOM::Document<std::string> toXML();
- static StatusInfoResponse fromXML(const Arabica::DOM::Document<std::string>& doc);
+ 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);
std::string statusInfo;
protected:
StatusInfoResponse() {}
- StatusInfoResponse(const StatusResponse& father) : StatusResponse(father) {}
};
class PrepareResponse : public StatusInfoResponse {
public:
PrepareResponse() {
tagName = "PrepareResponse";
+ type = PREPARERESPONSE;
}
PrepareResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static PrepareResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static PrepareResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PrepareResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = PREPARERESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.prepareresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -201,10 +332,20 @@ class StartResponse : public StatusInfoResponse {
public:
StartResponse() {
tagName = "StartResponse";
+ type = STARTRESPONSE;
}
StartResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static StartResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static StartResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ StartResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = STARTRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.startresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -212,10 +353,20 @@ class CancelResponse : public StatusInfoResponse {
public:
CancelResponse() {
tagName = "CancelResponse";
+ type = CANCELRESPONSE;
}
CancelResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static CancelResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static CancelResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ CancelResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = CANCELRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.cancelresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -223,10 +374,20 @@ class PauseResponse : public StatusInfoResponse {
public:
PauseResponse() {
tagName = "PauseResponse";
+ type = PAUSERESPONSE;
}
PauseResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static PauseResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static PauseResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ PauseResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = PAUSERESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.pauseresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -234,10 +395,20 @@ class ResumeResponse : public StatusInfoResponse {
public:
ResumeResponse() {
tagName = "ResumeResponse";
+ type = RESUMERESPONSE;
}
ResumeResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static ResumeResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static ResumeResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ResumeResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = RESUMERESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.resumeresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -245,10 +416,20 @@ class ClearContextResponse : public StatusInfoResponse {
public:
ClearContextResponse() {
tagName = "ClearContextResponse";
+ type = CLEARCONTEXTRESPONSE;
}
ClearContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static ClearContextResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static ClearContextResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ ClearContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = CLEARCONTEXTRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.clearcontextresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -256,10 +437,20 @@ class NewContextResponse : public StatusInfoResponse {
public:
NewContextResponse() {
tagName = "NewContextResponse";
+ type = NEWCONTEXTRESPONSE;
}
NewContextResponse(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static NewContextResponse fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static NewContextResponse fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ NewContextResponse event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = NEWCONTEXTRESPONSE;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.newcontextresponse");
+ ev.setDOM(toXML());
+ return ev;
}
};
@@ -268,13 +459,23 @@ class DoneNotification : public StatusInfoResponse {
public:
DoneNotification() {
tagName = "DoneNotification";
+ type = DONENOTIFICATION;
}
DoneNotification(const StatusInfoResponse& father) : StatusInfoResponse(father) {}
- static DoneNotification fromXML(const Arabica::DOM::Document<std::string>& doc) {
- return StatusInfoResponse::fromXML(doc);
+ static DoneNotification fromXML(Arabica::DOM::Node<std::string> node,
+ InterpreterImpl* interpreter = NULL) {
+ DoneNotification event = StatusInfoResponse::fromXML(node, interpreter);
+ event.type = DONENOTIFICATION;
+ return event;
+ }
+ operator Event() const {
+ Event ev = StatusInfoResponse::operator Event();
+ ev.setName("mmi.donenotification");
+ ev.setDOM(toXML());
+ return ev;
}
};
}
-#endif /* end of include guard: MMIMESSAGES_H_OS0SE7H5 */
+#endif /* end of include guard: MMIEVENT_H_OS0SE7H5 */