summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins
diff options
context:
space:
mode:
authorStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-06-23 23:38:20 (GMT)
committerStefan Radomski <radomski@tk.informatik.tu-darmstadt.de>2014-06-23 23:38:20 (GMT)
commitfebde41c4c69d8f38967d5c195328d468834d037 (patch)
tree4580a433d410e91a6f8df9203c20693e7a21128d /src/uscxml/plugins
parenteb6e9807cdb43b408de45ae789916cdf3bebe6f0 (diff)
downloaduscxml-febde41c4c69d8f38967d5c195328d468834d037.zip
uscxml-febde41c4c69d8f38967d5c195328d468834d037.tar.gz
uscxml-febde41c4c69d8f38967d5c195328d468834d037.tar.bz2
Updated tests for IRP and work on bindings
Diffstat (limited to 'src/uscxml/plugins')
-rw-r--r--src/uscxml/plugins/datamodel/CMakeLists.txt15
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp8
-rw-r--r--src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp17
-rw-r--r--src/uscxml/plugins/element/respond/RespondElement.cpp4
-rw-r--r--src/uscxml/plugins/invoker/CMakeLists.txt24
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/sample/SampleInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp64
-rw-r--r--src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h59
-rw-r--r--src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp26
10 files changed, 198 insertions, 23 deletions
diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt
index f04cb78..1b2a047 100644
--- a/src/uscxml/plugins/datamodel/CMakeLists.txt
+++ b/src/uscxml/plugins/datamodel/CMakeLists.txt
@@ -69,25 +69,14 @@ if (BUILD_DM_ECMA)
endif()
-# NULL datamodel
+# NULL datamodel (not useful as plugin)
set(USCXML_DATAMODELS "null ${USCXML_DATAMODELS}")
file(GLOB NULL_DATAMODEL
null/*.cpp
null/*.h
)
-if (BUILD_AS_PLUGINS)
- source_group("" FILES ${NULL_DATAMODEL})
- add_library(datamodel_null SHARED ${NULL_DATAMODEL} "../Plugins.cpp")
- target_link_libraries(datamodel_null uscxml)
- set_target_properties(datamodel_null PROPERTIES FOLDER "Plugin DataModel")
- set_target_properties(datamodel_null PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
- set_target_properties(datamodel_null PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
-
-
-else()
- list (APPEND USCXML_FILES ${NULL_DATAMODEL})
-endif()
+list (APPEND USCXML_FILES ${NULL_DATAMODEL})
# XPath datamodel
diff --git a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
index a6909b5..72252e4 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/JSCDataModel.cpp
@@ -212,6 +212,12 @@ void JSCDataModel::setEvent(const Event& event) {
JSValueRef exception = NULL;
+ if (event.raw.size() == 0) {
+ std::stringstream ssRaw;
+ ssRaw << event;
+ privData->nativeObj->raw = ssRaw.str();
+ }
+
if (event.dom) {
JSStringRef propName = JSStringCreateWithUTF8CString("data");
JSObjectSetProperty(_ctx, eventObj, propName, getNodeAsValue(event.dom), 0, &exception);
@@ -555,6 +561,8 @@ void JSCDataModel::assign(const Element<std::string>& assignElem,
throw Event("error.execution", Event::PLATFORM);
if (key.compare("_invokers") == 0)
throw Event("error.execution", Event::PLATFORM);
+ if (key.compare("_event") == 0)
+ throw Event("error.execution", Event::PLATFORM);
if (HAS_ATTR(assignElem, "expr")) {
evalAsValue(key + " = " + ATTR(assignElem, "expr"));
diff --git a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
index 2bdd796..8b222f7 100644
--- a/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
+++ b/src/uscxml/plugins/datamodel/ecmascript/v8/V8DataModel.cpp
@@ -228,6 +228,12 @@ void V8DataModel::setEvent(const Event& event) {
eventObj->SetInternalField(0, V8DOM::toExternal(privData));
eventObj.MakeWeak(0, V8SCXMLEvent::jsDestructor);
+ if (event.raw.size() == 0) {
+ std::stringstream ssRaw;
+ ssRaw << event;
+ privData->nativeObj->raw = ssRaw.str();
+ }
+
if (event.dom) {
eventObj->Set(v8::String::New("data"), getNodeAsValue(event.dom));
} else if (event.content.length() > 0) {
@@ -595,6 +601,17 @@ void V8DataModel::assign(const Element<std::string>& assignElem,
if (key.length() == 0)
throw Event("error.execution", Event::PLATFORM);
+ if (key.compare("_sessionid") == 0) // test 322
+ throw Event("error.execution", Event::PLATFORM);
+ if (key.compare("_name") == 0)
+ throw Event("error.execution", Event::PLATFORM);
+ if (key.compare("_ioprocessors") == 0) // test 326
+ throw Event("error.execution", Event::PLATFORM);
+ if (key.compare("_invokers") == 0)
+ throw Event("error.execution", Event::PLATFORM);
+ if (key.compare("_event") == 0)
+ throw Event("error.execution", Event::PLATFORM);
+
if (HAS_ATTR(assignElem, "expr")) {
evalAsValue(key + " = " + ATTR(assignElem, "expr"));
} else if (node) {
diff --git a/src/uscxml/plugins/element/respond/RespondElement.cpp b/src/uscxml/plugins/element/respond/RespondElement.cpp
index 4fe0d2e..3eb55ed 100644
--- a/src/uscxml/plugins/element/respond/RespondElement.cpp
+++ b/src/uscxml/plugins/element/respond/RespondElement.cpp
@@ -78,7 +78,7 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
httpReply.status = strTo<int>(statusStr);;
// extract the content
- Arabica::XPath::NodeSet<std::string> contents = InterpreterImpl::filterChildElements(_interpreter->getXMLPrefixForNS(getNamespace()) + "content", node);
+ Arabica::XPath::NodeSet<std::string> contents = InterpreterImpl::filterChildElements(_interpreter->getNameSpaceInfo().getXMLPrefixForNS(getNamespace()) + "content", node);
if (contents.size() > 0) {
if (HAS_ATTR(contents[0], "expr")) { // -- content is evaluated string from datamodel ------
if (_interpreter->getDataModel()) {
@@ -141,7 +141,7 @@ void RespondElement::enterElement(const Arabica::DOM::Node<std::string>& node) {
}
// process headers
- Arabica::XPath::NodeSet<std::string> headers = InterpreterImpl::filterChildElements(_interpreter->getXMLPrefixForNS(getNamespace()) + "header", node);
+ Arabica::XPath::NodeSet<std::string> headers = InterpreterImpl::filterChildElements(_interpreter->getNameSpaceInfo().getXMLPrefixForNS(getNamespace()) + "header", node);
for (int i = 0; i < headers.size(); i++) {
std::string name;
if (HAS_ATTR(headers[i], "name")) {
diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt
index f12a7a6..3f63ea3 100644
--- a/src/uscxml/plugins/invoker/CMakeLists.txt
+++ b/src/uscxml/plugins/invoker/CMakeLists.txt
@@ -271,6 +271,30 @@ if (LIBICAL_FOUND)
endif()
+# webrtc invoker
+
+if (LIBJINGLE_FOUND)
+ set(USCXML_INVOKERS "webrtc ${USCXML_INVOKERS}")
+ file(GLOB_RECURSE WEBRTC_INVOKER
+ webrtc/*.cpp
+ webrtc/*.h
+ )
+ if (BUILD_AS_PLUGINS)
+ source_group("" FILES ${WEBRTC_INVOKER})
+ add_library(
+ invoker_webrtc SHARED
+ ${WEBRTC_INVOKER}
+ "../Plugins.cpp")
+ target_link_libraries(invoker_webrtc uscxml ${LIBJINGLE_LIBRARIES})
+ set_target_properties(invoker_webrtc PROPERTIES FOLDER "Plugin Invoker")
+ set_target_properties(invoker_webrtc PROPERTIES COMPILE_FLAGS "-DPLUMA_EXPORTS")
+ set_target_properties(invoker_webrtc PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIR}/lib")
+ else()
+ list (APPEND USCXML_FILES ${WEBRTC_INVOKER})
+ endif()
+endif()
+
+
# location invoker
if (CORELOCATION_LIBRARY AND OFF)
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
index 0777c62..d91b14c 100644
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
+++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp
@@ -1,6 +1,6 @@
/**
* @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
* @copyright Simplified BSD
*
* @cond
diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
index 562ebd6..f7bcb24 100644
--- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h
+++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.h
@@ -1,6 +1,6 @@
/**
* @file
- * @author 2012-2013 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @author 2012-2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
* @copyright Simplified BSD
*
* @cond
diff --git a/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp b/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp
new file mode 100644
index 0000000..2d871c8
--- /dev/null
+++ b/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.cpp
@@ -0,0 +1,64 @@
+/**
+ * @file
+ * @author 2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#include "WebRTCInvoker.h"
+#include <glog/logging.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include <Pluma/Connector.hpp>
+#endif
+
+//#include "talk/app/webrtc/peerconnection.h"
+
+namespace uscxml {
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_CONNECTOR
+bool pluginConnect(pluma::Host& host) {
+ host.add( new WebRTCInvokerProvider() );
+ return true;
+}
+#endif
+
+WebRTCInvoker::WebRTCInvoker() {
+}
+
+WebRTCInvoker::~WebRTCInvoker() {
+};
+
+boost::shared_ptr<InvokerImpl> WebRTCInvoker::create(InterpreterImpl* interpreter) {
+ boost::shared_ptr<WebRTCInvoker> invoker = boost::shared_ptr<WebRTCInvoker>(new WebRTCInvoker());
+ return invoker;
+}
+
+Data WebRTCInvoker::getDataModelVariables() {
+ Data data;
+ return data;
+}
+
+void WebRTCInvoker::send(const SendRequest& req) {
+}
+
+void WebRTCInvoker::cancel(const std::string sendId) {
+}
+
+void WebRTCInvoker::invoke(const InvokeRequest& req) {
+}
+
+} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h b/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h
new file mode 100644
index 0000000..e4d7775
--- /dev/null
+++ b/src/uscxml/plugins/invoker/webrtc/WebRTCInvoker.h
@@ -0,0 +1,59 @@
+/**
+ * @file
+ * @author 2014 Stefan Radomski (stefan.radomski@cs.tu-darmstadt.de)
+ * @copyright Simplified BSD
+ *
+ * @cond
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the FreeBSD license as published by the FreeBSD
+ * project.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * You should have received a copy of the FreeBSD license along with this
+ * program. If not, see <http://www.opensource.org/licenses/bsd-license>.
+ * @endcond
+ */
+
+#ifndef WEBRTCINVOKER_H_1E704623
+#define WEBRTCINVOKER_H_1E704623
+
+#include <uscxml/Interpreter.h>
+
+#ifdef BUILD_AS_PLUGINS
+#include "uscxml/plugins/Plugins.h"
+#endif
+
+namespace uscxml {
+
+class WebRTCInvoker : public InvokerImpl {
+public:
+ WebRTCInvoker();
+ virtual ~WebRTCInvoker();
+ virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
+
+ virtual std::list<std::string> getNames() {
+ std::list<std::string> names;
+ names.push_back("webrtc");
+ names.push_back("http://uscxml.tk.informatik.tu-darmstadt.de/#webrtc");
+ return names;
+ }
+
+ virtual Data getDataModelVariables();
+ virtual void send(const SendRequest& req);
+ virtual void cancel(const std::string sendId);
+ virtual void invoke(const InvokeRequest& req);
+
+protected:
+};
+
+#ifdef BUILD_AS_PLUGINS
+PLUMA_INHERIT_PROVIDER(WebRTCInvoker, InvokerImpl);
+#endif
+
+}
+
+
+#endif /* end of include guard: WEBRTCINVOKER_H_1E704623 */
diff --git a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
index 7d9fcb8..b6dadc9 100644
--- a/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
+++ b/src/uscxml/plugins/ioprocessor/basichttp/BasicHTTPIOProcessor.cpp
@@ -124,13 +124,27 @@ bool BasicHTTPIOProcessor::httpRecvRequest(const HTTPServer::Request& req) {
*/
// this will call the const subscript operator
- if (req.data.at("content").hasKey("_scxmleventname")) {
- reqEvent.name = req.data.at("content").at("_scxmleventname").atom;
- }
- if (req.data.at("content").hasKey("content")) {
- reqEvent.content = req.data.at("content").at("content").atom;
+// if (req.data.at("content").hasKey("_scxmleventname")) {
+// reqEvent.name = req.data.at("content").at("_scxmleventname").atom;
+// }
+// if (req.data.at("content").hasKey("content")) {
+// reqEvent.content = req.data.at("content").at("content").atom;
+// }
+
+ if (req.data.hasKey("content")) {
+ const Data& data = req.data["content"];
+ for(std::map<std::string, Data>::const_iterator compIter = data.compound.begin();
+ compIter!= data.compound.end(); compIter++) {
+ if (compIter->first == "_scxmleventname") {
+ reqEvent.name = compIter->second.atom;
+ } else if (compIter->first == "content") {
+ reqEvent.content = compIter->second.atom;
+ } else {
+ reqEvent.data[compIter->first] = compIter->second;
+ }
+ }
}
-
+
// check whether we can parse it as XML
if (reqEvent.content.length() > 0) {
NameSpacingParser parser = NameSpacingParser::fromXML(reqEvent.content);