diff options
Diffstat (limited to 'src/uscxml')
-rw-r--r-- | src/uscxml/CMakeLists.txt | 41 | ||||
-rw-r--r-- | src/uscxml/Factory.cpp | 5 | ||||
-rw-r--r-- | src/uscxml/Message.cpp | 5 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/CMakeLists.txt | 54 | ||||
-rw-r--r-- | src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp | 13 | ||||
-rw-r--r-- | src/uscxml/plugins/element/CMakeLists.txt | 14 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/CMakeLists.txt | 102 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp | 67 | ||||
-rw-r--r-- | src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h | 51 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/CMakeLists.txt | 57 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp | 22 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIComponent.h | 43 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h | 12 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp | 113 | ||||
-rw-r--r-- | src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h | 34 |
15 files changed, 448 insertions, 185 deletions
diff --git a/src/uscxml/CMakeLists.txt b/src/uscxml/CMakeLists.txt index 3167405..d96895e 100644 --- a/src/uscxml/CMakeLists.txt +++ b/src/uscxml/CMakeLists.txt @@ -3,56 +3,59 @@ ############################################################ file(GLOB_RECURSE USCXML_SERVER - src/uscxml/server/*.cpp - src/uscxml/server/*.h + server/*.cpp + server/*.h ) source_group("Interpreter" FILES ${USCXML_SERVER}) list (APPEND USCXML_FILES ${USCXML_SERVER}) file(GLOB_RECURSE USCXML_CONCURRENCY - src/uscxml/concurrency/*.cpp - src/uscxml/concurrency/*.h + concurrency/*.cpp + concurrency/*.h ) source_group("Interpreter" FILES ${USCXML_CONCURRENCY}) list (APPEND USCXML_FILES ${USCXML_CONCURRENCY}) file(GLOB_RECURSE USCXML_DEBUG - src/uscxml/debug/*.cpp - src/uscxml/debug/*.h + debug/*.cpp + debug/*.h ) source_group("Interpreter" FILES ${USCXML_DEBUG}) list (APPEND USCXML_FILES ${USCXML_DEBUG}) file(GLOB_RECURSE USCXML_INTERPRETERS - src/uscxml/interpreter/*.cpp - src/uscxml/interpreter/*.h + interpreter/*.cpp + interpreter/*.h ) source_group("Interpreter" FILES ${USCXML_INTERPRETERS}) list (APPEND USCXML_FILES ${USCXML_INTERPRETERS}) file(GLOB USCXML_CORE ${CMAKE_SOURCE_DIR}/contrib/src/jsmn/jsmn.c - src/uscxml/*.cpp - src/uscxml/*.h + *.cpp + *.h ) source_group("Interpreter" FILES ${USCXML_CORE}) list (APPEND USCXML_FILES ${USCXML_CORE}) if (BUILD_AS_PLUGINS) - list (APPEND USCXML_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/src/uscxml/plugins) + list (APPEND USCXML_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/plugins) file(GLOB PLUMA - src/uscxml/plugins/Pluma/*.cpp - src/uscxml/plugins/Pluma/*.h - src/uscxml/plugins/*.cpp - src/uscxml/plugins/*.h + plugins/Pluma/*.cpp + plugins/Pluma/*.h + plugins/*.cpp + plugins/*.h ) source_group("Interpreter" FILES ${PLUMA}) list (APPEND USCXML_FILES ${PLUMA}) add_definitions("-DBUILD_AS_PLUGINS") endif() -include(src/uscxml/plugins/datamodel/CMakeLists.txt) -include(src/uscxml/plugins/element/CMakeLists.txt) -include(src/uscxml/plugins/invoker/CMakeLists.txt) -include(src/uscxml/plugins/ioprocessor/CMakeLists.txt) +add_subdirectory(plugins/datamodel) +add_subdirectory(plugins/element) +add_subdirectory(plugins/ioprocessor) +add_subdirectory(plugins/invoker) +set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) +set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE) +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) diff --git a/src/uscxml/Factory.cpp b/src/uscxml/Factory.cpp index 5c9b206..9c59259 100644 --- a/src/uscxml/Factory.cpp +++ b/src/uscxml/Factory.cpp @@ -20,6 +20,7 @@ # ifdef UMUNDO_FOUND # include "uscxml/plugins/invoker/umundo/UmundoInvoker.h" +# include "uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h" # endif # ifdef OPENSCENEGRAPH_FOUND @@ -100,6 +101,10 @@ Factory::Factory() { UmundoInvoker* invoker = new UmundoInvoker(); registerInvoker(invoker); } + { + VoiceXMLInvoker* invoker = new VoiceXMLInvoker(); + registerInvoker(invoker); + } #endif #ifdef MILES_FOUND diff --git a/src/uscxml/Message.cpp b/src/uscxml/Message.cpp index 8a65ed2..dbcf976 100644 --- a/src/uscxml/Message.cpp +++ b/src/uscxml/Message.cpp @@ -239,12 +239,12 @@ Data Data::fromJSON(const std::string& jsonString) { free(t); // LOG(INFO) << "Increasing JSON length to token ratio to 1/" << frac; } - t = (jsmntok_t*)malloc(nrTokens * sizeof(jsmntok_t) + 1); + t = (jsmntok_t*)malloc((nrTokens + 1) * sizeof(jsmntok_t)); if (t == NULL) { LOG(ERROR) << "Cannot parse JSON, ran out of memory!"; return data; } - memset(t, 0, nrTokens * sizeof(jsmntok_t) + 1); + memset(t, 0, (nrTokens + 1) * sizeof(jsmntok_t)); rv = jsmn_parse(&p, trimmed.c_str(), t, nrTokens); } while (rv == JSMN_ERROR_NOMEM && frac > 1); @@ -276,6 +276,7 @@ Data Data::fromJSON(const std::string& jsonString) { size_t currTok = 0; do { + jsmntok_t t2 = t[currTok]; switch (t[currTok].type) { case JSMN_STRING: dataStack.back()->type = Data::VERBATIM; diff --git a/src/uscxml/plugins/datamodel/CMakeLists.txt b/src/uscxml/plugins/datamodel/CMakeLists.txt index 0634984..8acbcf7 100644 --- a/src/uscxml/plugins/datamodel/CMakeLists.txt +++ b/src/uscxml/plugins/datamodel/CMakeLists.txt @@ -3,13 +3,13 @@ if (APPLE AND IOS AND OFF) FIND_LIBRARY(JSC_LIBRARY JavaScriptCore) set(JSC_FOUND ON) file(GLOB JSC_DATAMODEL - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/*.cpp - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/*.h + ecmascript/JavaScriptCore/*.cpp + ecmascript/JavaScriptCore/*.h ) source_group("Datamodel\\jsc" FILES ${JSC_DATAMODEL}) file(GLOB_RECURSE JSC_DOM - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/*.cpp - src/uscxml/plugins/datamodel/ecmascript/JavaScriptCore/dom/*.h + ecmascript/JavaScriptCore/dom/*.cpp + ecmascript/JavaScriptCore/dom/*.h ) source_group("Datamodel\\DOM" FILES ${JSC_DOM}) if (BUILD_AS_PLUGINS) @@ -33,8 +33,8 @@ endif() # NULL datamodel file(GLOB NULL_DATAMODEL - src/uscxml/plugins/datamodel/null/*.cpp - src/uscxml/plugins/datamodel/null/*.h + null/*.cpp + null/*.h ) source_group("Datamodel\\null" FILES ${NULL_DATAMODEL}) if (BUILD_AS_PLUGINS) @@ -49,8 +49,8 @@ endif() # XPath datamodel file(GLOB XPATH_DATAMODEL - src/uscxml/plugins/datamodel/xpath/*.cpp - src/uscxml/plugins/datamodel/xpath/*.h + xpath/*.cpp + xpath/*.h ) source_group("Datamodel\\xpath" FILES ${XPATH_DATAMODEL}) if (BUILD_AS_PLUGINS) @@ -66,17 +66,15 @@ endif() #if (NOT APPLE OR IOS) # set(ENV{V8_SRC} ${CMAKE_SOURCE_DIR}/../v8) - find_package(V8) if (V8_FOUND) - list (APPEND USCXML_INCLUDE_DIRS ${V8_INCLUDE_DIR}) file(GLOB V8_DATAMODEL - src/uscxml/plugins/datamodel/ecmascript/v8/*.cpp - src/uscxml/plugins/datamodel/ecmascript/v8/*.h + ecmascript/v8/*.cpp + ecmascript/v8/*.h ) source_group("Datamodel\\v8" FILES ${V8_DATAMODEL}) file(GLOB_RECURSE V8_DOM - src/uscxml/plugins/datamodel/ecmascript/v8/dom/*.cpp - src/uscxml/plugins/datamodel/ecmascript/v8/dom/*.h + ecmascript/v8/dom/*.cpp + ecmascript/v8/dom/*.h ) source_group("Datamodel\\v8\\DOM" FILES ${V8_DOM}) @@ -92,7 +90,6 @@ endif() else() list (APPEND USCXML_FILES ${V8_DATAMODEL}) list (APPEND USCXML_FILES ${V8_DOM}) - list (APPEND USCXML_OPT_LIBS ${V8_LIBRARY}) endif() endif() #endif() @@ -100,19 +97,18 @@ endif() # SWI PROLOG datamodel -#set(SWI_INCLUDE_HINT ${CMAKE_SOURCE_DIR}/../pl-devel/include) -#set(SWI_LIBRARY_HINT ${CMAKE_SOURCE_DIR}/../pl-devel/lib/x86_64-darwin12.2.0) -find_package(SWI) -#find_package(GMP) -#find_package(CURSES) if (SWI_FOUND) - list (APPEND USCXML_INCLUDE_DIRS ${SWI_INCLUDE_DIR}) # message(FATAL_ERROR "SWI_INCLUDE_DIR: ${SWI_INCLUDE_DIR}") -# include_directories(${GMP_INCLUDE_DIR}) -# include_directories(${CURSES_INCLUDE_DIR}) + + # if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + # set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -read_only_relocs suppress") + # set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -read_only_relocs suppress") + # set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -read_only_relocs suppress") + # set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} -read_only_relocs suppress") + # endif() file(GLOB_RECURSE SWI_DATAMODEL - src/uscxml/plugins/datamodel/prolog/swi/*.cpp - src/uscxml/plugins/datamodel/prolog/swi/*.h + prolog/swi/*.cpp + prolog/swi/*.h ) source_group("Datamodel\\swi" FILES ${SWI_DATAMODEL}) if (BUILD_AS_PLUGINS) @@ -121,12 +117,14 @@ if (SWI_FOUND) ${SWI_DATAMODEL}) target_link_libraries(datamodel_swi uscxml -# ${GMP_LIBRARY} -# ${CURSES_LIBRARIES} + ${GMP_LIBRARY} + ${CURSES_LIBRARIES} ${SWI_LIBRARY}) set_target_properties(datamodel_swi PROPERTIES FOLDER "Plugin DataModel") else() list (APPEND USCXML_FILES ${SWI_DATAMODEL}) - list (APPEND USCXML_OPT_LIBS ${SWI_LIBRARY}) # ${GMP_LIBRARY} ${CURSES_LIBRARIES}) endif() endif() + +set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
\ No newline at end of file diff --git a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp index 1af56b5..6b2f039 100644 --- a/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp +++ b/src/uscxml/plugins/datamodel/xpath/XPathDataModel.cpp @@ -338,7 +338,7 @@ std::string XPathDataModel::evalAsString(const std::string& expr) { case STRING: return result.asString(); break; - case BOOL: + case Arabica::XPath::BOOL: // MSVC croaks with ambiguous symbol without qualified name return (result.asBool() ? "true" : "false"); break; case NUMBER: @@ -482,10 +482,11 @@ void XPathDataModel::init(const Element<std::string>& dataElem, case STRING: container.appendChild(_doc.createTextNode(expr.asString())); break; - case NUMBER: + case NUMBER: { container.appendChild(_doc.createTextNode(toStr(expr.asNumber()))); break; - case BOOL: + } + case Arabica::XPath::BOOL: case ANY: throw Event("error.execution", Event::PLATFORM); } @@ -531,7 +532,7 @@ void XPathDataModel::assign(const XPathValue<std::string>& key, case STRING: assign(key.asNodeSet(), value.asString(), assignElem); break; - case BOOL: + case Arabica::XPath::BOOL: assign(key.asNodeSet(), value.asBool(), assignElem); break; case NUMBER: @@ -546,7 +547,7 @@ void XPathDataModel::assign(const XPathValue<std::string>& key, break; } case STRING: - case BOOL: + case Arabica::XPath::BOOL: case NUMBER: case ANY: throw Event("error.execution", Event::PLATFORM); @@ -564,7 +565,7 @@ void XPathDataModel::assign(const XPathValue<std::string>& key, break; } case STRING: - case BOOL: + case Arabica::XPath::BOOL: case NUMBER: case ANY: throw Event("error.execution", Event::PLATFORM); diff --git a/src/uscxml/plugins/element/CMakeLists.txt b/src/uscxml/plugins/element/CMakeLists.txt index fa54fc3..0c9cbda 100644 --- a/src/uscxml/plugins/element/CMakeLists.txt +++ b/src/uscxml/plugins/element/CMakeLists.txt @@ -1,8 +1,8 @@ # Fetch element file(GLOB_RECURSE FETCH_ELEMENT - src/uscxml/plugins/element/fetch/*.cpp - src/uscxml/plugins/element/fetch/*.h + fetch/*.cpp + fetch/*.h ) source_group("Element\\fetch" FILES ${FETCH_ELEMENT}) if (BUILD_AS_PLUGINS) @@ -19,8 +19,8 @@ endif() # Postpone element file(GLOB_RECURSE POSTPONE_ELEMENT - src/uscxml/plugins/element/postpone/*.cpp - src/uscxml/plugins/element/postpone/*.h + postpone/*.cpp + postpone/*.h ) source_group("Element\\postpone" FILES ${POSTPONE_ELEMENT}) if (BUILD_AS_PLUGINS) @@ -37,8 +37,8 @@ endif() # Respond element file(GLOB_RECURSE RESPOND_ELEMENT - src/uscxml/plugins/element/respond/*.cpp - src/uscxml/plugins/element/respond/*.h + respond/*.cpp + respond/*.h ) source_group("Element\\respond" FILES ${RESPOND_ELEMENT}) if (BUILD_AS_PLUGINS) @@ -51,3 +51,5 @@ else() list (APPEND USCXML_FILES ${RESPOND_ELEMENT}) endif() +set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt index 4d38199..3f43acb 100644 --- a/src/uscxml/plugins/invoker/CMakeLists.txt +++ b/src/uscxml/plugins/invoker/CMakeLists.txt @@ -1,7 +1,7 @@ # sample invoker - include to make sure it compiles file(GLOB_RECURSE SAMPLE_INVOKER - src/uscxml/plugins/invoker/sample/*.cpp - src/uscxml/plugins/invoker/sample/*.h + sample/*.cpp + sample/*.h ) source_group("Invoker\\sample" FILES ${SAMPLE_INVOKER}) if (BUILD_AS_PLUGINS) @@ -18,8 +18,8 @@ endif() # DirMon invoker to watch for filesystem changes file(GLOB_RECURSE DIRMON_INVOKER - src/uscxml/plugins/invoker/filesystem/dirmon/*.cpp - src/uscxml/plugins/invoker/filesystem/dirmon/*.h + filesystem/dirmon/*.cpp + filesystem/dirmon/*.h ) source_group("Invoker\\dirmon" FILES ${DIRMON_INVOKER}) if (BUILD_AS_PLUGINS) @@ -36,8 +36,8 @@ endif() # System invoker to open a native command file(GLOB_RECURSE SYSTEM_INVOKER - src/uscxml/plugins/invoker/system/*.cpp - src/uscxml/plugins/invoker/system/*.h + system/*.cpp + system/*.h ) source_group("Invoker\\system" FILES ${SYSTEM_INVOKER}) if (BUILD_AS_PLUGINS) @@ -53,11 +53,10 @@ endif() # SQLite3 SQL Invoker -find_package(Sqlite3) if (SQLITE3_FOUND) file(GLOB_RECURSE SQLITE3_INVOKER - src/uscxml/plugins/invoker/sqlite3/*.cpp - src/uscxml/plugins/invoker/sqlite3/*.h + sqlite3/*.cpp + sqlite3/*.h ) source_group("Invoker\\sqlite" FILES ${SQLITE3_INVOKER}) if (BUILD_AS_PLUGINS) @@ -74,12 +73,10 @@ endif() # ffmpeg invoker -find_package(FFMPEG) if (FFMPEG_FOUND) - list (APPEND USCXML_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIR}) file(GLOB_RECURSE FFMPEG_INVOKER - src/uscxml/plugins/invoker/ffmpeg/*.cpp - src/uscxml/plugins/invoker/ffmpeg/*.h + ffmpeg/*.cpp + ffmpeg/*.h ) source_group("Invoker\\ffmpeg" FILES ${FFMPEG_INVOKER}) if (BUILD_AS_PLUGINS) @@ -96,16 +93,10 @@ endif() # UMUNDO invoker -if (WIN32) - find_package(UMUNDO COMPONENTS convenience) -else() - find_package(UMUNDO COMPONENTS rpc serial core) -endif() if (UMUNDO_FOUND) - list (APPEND USCXML_INCLUDE_DIRS ${UMUNDO_INCLUDE_DIR}) file(GLOB_RECURSE UMUNDO_INVOKER - src/uscxml/plugins/invoker/umundo/*.cpp - src/uscxml/plugins/invoker/umundo/*.h) + umundo/*.cpp + umundo/*.h) source_group("Invoker\\umundo" FILES ${UMUNDO_INVOKER}) if (BUILD_AS_PLUGINS) add_library( @@ -117,17 +108,15 @@ if (UMUNDO_FOUND) set_target_properties(invoker_umundo PROPERTIES FOLDER "Plugin Invoker") else() list (APPEND USCXML_FILES ${UMUNDO_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${UMUNDO_LIBRARIES}) endif() - add_definitions("-DUMUNDO_STATIC") endif() # USCXML invoker file(GLOB_RECURSE USCXML_INVOKER - src/uscxml/plugins/invoker/scxml/*.cpp - src/uscxml/plugins/invoker/scxml/*.h) + scxml/*.cpp + scxml/*.h) source_group("Invoker\\uscxml" FILES ${USCXML_INVOKER}) if (BUILD_AS_PLUGINS) add_library( @@ -144,8 +133,8 @@ endif() # HTTP server invoker file(GLOB_RECURSE HTTPSERVLET_INVOKER - src/uscxml/plugins/invoker/http/*.cpp - src/uscxml/plugins/invoker/http/*.h) + http/*.cpp + http/*.h) source_group("Invoker\\httpservlet" FILES ${HTTPSERVLET_INVOKER}) if (BUILD_AS_PLUGINS) add_library( @@ -162,8 +151,8 @@ endif() # Heartbeat invoker file(GLOB_RECURSE HEARTBEAT_INVOKER - src/uscxml/plugins/invoker/heartbeat/*.cpp - src/uscxml/plugins/invoker/heartbeat/*.h + heartbeat/*.cpp + heartbeat/*.h ) source_group("Invoker\\heartbeat" FILES ${HEARTBEAT_INVOKER}) if (BUILD_AS_PLUGINS) @@ -178,22 +167,10 @@ endif() # OpenSceneGraph invoker -if (UNIX) - set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_ORIG}) # link dynamically! -elseif(WIN32) - if (ENV{OSG_ROOT} STREQUAL "") - set(ENV{OSG_ROOT} "C:/Program Files/OpenSceneGraph-3.0.1") - endif() -endif() -find_package(OpenSceneGraph COMPONENTS osgViewer osgGA osgText osgFX osgManipulator osgDB osgUtil OpenThreads) -find_package(OpenGL) if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) - list (APPEND USCXML_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIRS}) - list (APPEND USCXML_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR}) - file(GLOB OPENSCENEGRAPH_INVOKER - src/uscxml/plugins/invoker/graphics/openscenegraph/*.cpp - src/uscxml/plugins/invoker/graphics/openscenegraph/*.h) + graphics/openscenegraph/*.cpp + graphics/openscenegraph/*.h) source_group("Invoker\\scenegraph" FILES ${OPENSCENEGRAPH_INVOKER}) if (BUILD_AS_PLUGINS) @@ -207,12 +184,11 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) set_target_properties(invoker_openscenegraph PROPERTIES FOLDER "Plugin Invoker") else() list (APPEND USCXML_FILES ${OPENSCENEGRAPH_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES}) endif() file(GLOB OPENSCENEGRAPH_CONVERTER_INVOKER - src/uscxml/plugins/invoker/graphics/openscenegraph/converter/*.cpp - src/uscxml/plugins/invoker/graphics/openscenegraph/converter/*.h) + graphics/openscenegraph/converter/*.cpp + graphics/openscenegraph/converter/*.h) source_group("Invoker\\scenegraph\\convert" FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) if (BUILD_AS_PLUGINS) @@ -226,21 +202,14 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) set_target_properties(invoker_openscenegraph_convert PROPERTIES FOLDER "Plugin Invoker") else() list (APPEND USCXML_FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES}) endif() endif() -if (UNIX) - set(CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) -endif() # MILES modality components -find_package(MILES) if (MILES_FOUND AND OFF) - list (APPEND USCXML_INCLUDE_DIRS ${MILES_INCLUDE_DIR}) - # openal is only needed for miles find_package(OpenAL REQUIRED) # find_package(JPEG REQUIRED) @@ -249,8 +218,8 @@ if (MILES_FOUND AND OFF) list (APPEND USCXML_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR}) file(GLOB_RECURSE MILES_INVOKER - src/uscxml/plugins/invoker/miles/*.cpp - src/uscxml/plugins/invoker/miles/*.h) + miles/*.cpp + miles/*.h) source_group("Invoker\\miles" FILES ${MILES_INVOKER}) # message("MILES_INVOKER ${MILES_INVOKER}") @@ -265,8 +234,27 @@ if (MILES_FOUND AND OFF) set_target_properties(invoker_miles PROPERTIES FOLDER "Plugin Invoker") else() list (APPEND USCXML_FILES ${MILES_INVOKER}) - list (APPEND USCXML_OPT_LIBS ${MILES_LIBRARIES}) - list (APPEND USCXML_OPT_LIBS ${OPENAL_LIBRARY}) endif() endif() +# VoiceXML modality components + +if (UMUNDO_FOUND) + file(GLOB_RECURSE VXML_INVOKER + vxml/*.cpp + vxml/*.h + ) + source_group("Invoker\\voicexml" FILES ${VXML_INVOKER}) + if (BUILD_AS_PLUGINS) + add_library( + invoker_voicexml SHARED + ${VXML_INVOKER}) + target_link_libraries(invoker_voicexml uscxml) + set_target_properties(invoker_voicexml PROPERTIES FOLDER "Plugin Invoker") + else() + list (APPEND USCXML_FILES ${VXML_INVOKER}) + endif() +endif() + +set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE)
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp new file mode 100644 index 0000000..e7d1440 --- /dev/null +++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp @@ -0,0 +1,67 @@ +#include "VoiceXMLInvoker.h" +#include <glog/logging.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 VoiceXMLInvokerProvider() ); + return true; +} +#endif + +VoiceXMLInvoker::VoiceXMLInvoker() { +} + +VoiceXMLInvoker::~VoiceXMLInvoker() { +}; + +boost::shared_ptr<IOProcessorImpl> VoiceXMLInvoker::create(InterpreterImpl* interpreter) { + boost::shared_ptr<VoiceXMLInvoker> invoker = boost::shared_ptr<VoiceXMLInvoker>(new VoiceXMLInvoker()); + invoker->_interpreter = interpreter; + invoker->_pub = umundo::TypedPublisher("mmi:jvoicexml"); + invoker->_sub = umundo::TypedSubscriber("mmi:jvoicexml"); + + invoker->_pub.registerType("LifeCycleEvent", new ::LifeCycleEvent()); + + + invoker->_node.addPublisher(invoker->_pub); + invoker->_node.addSubscriber(invoker->_sub); + + return invoker; +} + +void VoiceXMLInvoker::receive(void* object, umundo::Message* msg) { + std::cout << msg->getMeta("um.s11n.type") << std::endl; +} + +Data VoiceXMLInvoker::getDataModelVariables() { + Data data; + return data; +} + +void VoiceXMLInvoker::send(const SendRequest& req) { + StartRequest start; + std::stringstream domSS; + domSS << req.getFirstDOMElement(); + start.content = domSS.str(); + + start.contentURL.href = "http://localhost/~sradomski/hello.vxml"; + start.requestId = "asdf"; + start.source = "asdf"; + start.target = "umundo://mmi/jvoicexml"; + ::LifeCycleEvent lce = MMIProtoBridge::toProto(start); + _pub.sendObj("LifeCycleEvent", &lce); +} + +void VoiceXMLInvoker::invoke(const InvokeRequest& req) { + _pub.waitForSubscribers(1); + +} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h new file mode 100644 index 0000000..450af5d --- /dev/null +++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h @@ -0,0 +1,51 @@ +#ifndef VOICEXMLINVOKER_H_W09J90F0 +#define VOICEXMLINVOKER_H_W09J90F0 + +#include <uscxml/Interpreter.h> +#include <uscxml/plugins/ioprocessor/modality/MMIComponent.h> +#include <uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h> + +#include <umundo/core.h> +#include <umundo/s11n.h> + +#ifdef BUILD_AS_PLUGINS +#include "uscxml/plugins/Plugins.h" +#endif + +namespace uscxml { + +class VoiceXMLInvoker : public InvokerImpl, public umundo::TypedReceiver { +public: + VoiceXMLInvoker(); + virtual ~VoiceXMLInvoker(); + virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); + + virtual std::set<std::string> getNames() { + std::set<std::string> names; + names.insert("vxml"); + names.insert("voicexml"); + names.insert("http://www.w3.org/TR/voicexml21/"); + return names; + } + + virtual void receive(void* object, umundo::Message* msg); + + virtual Data getDataModelVariables(); + virtual void send(const SendRequest& req); + virtual void invoke(const InvokeRequest& req); + + +protected: + umundo::Node _node; + umundo::TypedPublisher _pub; + umundo::TypedSubscriber _sub; +}; + +#ifdef BUILD_AS_PLUGINS +PLUMA_INHERIT_PROVIDER(VoiceXMLInvoker, InvokerImpl); +#endif + +} + + +#endif /* end of include guard: VOICEXMLINVOKER_H_W09J90F0 */ diff --git a/src/uscxml/plugins/ioprocessor/CMakeLists.txt b/src/uscxml/plugins/ioprocessor/CMakeLists.txt index c5f46e8..0fab6a4 100644 --- a/src/uscxml/plugins/ioprocessor/CMakeLists.txt +++ b/src/uscxml/plugins/ioprocessor/CMakeLists.txt @@ -1,8 +1,8 @@ # LIBEVENT basichttp ioprocessor - this one is already required above file(GLOB_RECURSE BASICHTTP_IOPROCESSOR - src/uscxml/plugins/ioprocessor/basichttp/*.cpp - src/uscxml/plugins/ioprocessor/basichttp/*.h + basichttp/*.cpp + basichttp/*.h ) source_group("IOProcessor\\basichttp" FILES ${BASICHTTP_IOPROCESSOR}) if (BUILD_AS_PLUGINS) @@ -19,8 +19,8 @@ endif() # scxml ioprocessor - this one is already required above file(GLOB_RECURSE SCXML_IOPROCESSOR - src/uscxml/plugins/ioprocessor/scxml/*.cpp - src/uscxml/plugins/ioprocessor/scxml/*.h + scxml/*.cpp + scxml/*.h ) source_group("IOProcessor\\scxml" FILES ${SCXML_IOPROCESSOR}) if (BUILD_AS_PLUGINS) @@ -36,18 +36,41 @@ endif() # mmi ioprocessor -file(GLOB_RECURSE MMI_IOPROCESSOR - src/uscxml/plugins/ioprocessor/modality/*.cpp - src/uscxml/plugins/ioprocessor/modality/*.h -) -source_group("IOProcessor\\modality" FILES ${MMI_IOPROCESSOR}) -if (BUILD_AS_PLUGINS) - add_library( - ioprocessor_mmi SHARED - ${MMI_IOPROCESSOR}) - target_link_libraries(ioprocessor_mmi uscxml) - set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor") -else() - list (APPEND USCXML_FILES ${MMI_IOPROCESSOR}) +if (PROTOBUF_FOUND) + + if (NOT PROTOBUF_PROTOC_EXECUTABLE) + message(FATAL_ERROR "protoc binary required for serialization") + endif() + + file(GLOB_RECURSE MMI_IOPROCESSOR + modality/*.cpp + modality/*.h + ) + + # process .proto files + file(GLOB_RECURSE PROTOBUF_INTERFACES ${PROJECT_SOURCE_DIR}/contrib/proto/*.proto) + list (APPEND USCXML_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}) + + PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS ${PROTOBUF_INTERFACES}) +# set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE) + + # this needs to be here for dependencies on the generated proto files + add_library(mmi_proto STATIC ${PROTO_SRCS}) + set_target_properties(mmi_proto PROPERTIES FOLDER "Generated") + + source_group("IOProcessor\\modality" FILES ${MMI_IOPROCESSOR}) + if (BUILD_AS_PLUGINS) + add_library( + ioprocessor_mmi SHARED + ${MMI_IOPROCESSOR}) + target_link_libraries(ioprocessor_mmi uscxml mmi_proto) + set_target_properties(ioprocessor_mmi PROPERTIES FOLDER "Plugin IOProcessor") + else() + list (APPEND USCXML_FILES ${MMI_IOPROCESSOR}) + list (APPEND USCXML_OPT_LIBS mmi_proto) + endif() endif() +set(USCXML_INCLUDE_DIRS ${USCXML_INCLUDE_DIRS} PARENT_SCOPE) +set(USCXML_OPT_LIBS ${USCXML_OPT_LIBS} PARENT_SCOPE) +set(USCXML_FILES ${USCXML_FILES} PARENT_SCOPE) diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp index a38e275..c1e973b 100644 --- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp +++ b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.cpp @@ -1,30 +1,12 @@ #include "MMIComponent.h" //#include <glog/logging.h> -#ifdef BUILD_AS_PLUGINS -#include <Pluma/Connector.hpp> -#endif - namespace uscxml { -MMIIOProcessor::MMIIOProcessor() { -} - -MMIIOProcessor::~MMIIOProcessor() { -} - -boost::shared_ptr<IOProcessorImpl> MMIIOProcessor::create(InterpreterImpl* interpreter) { - boost::shared_ptr<MMIIOProcessor> invoker = boost::shared_ptr<MMIIOProcessor>(new MMIIOProcessor()); - invoker->_interpreter = interpreter; - return invoker; -} - -Data MMIIOProcessor::getDataModelVariables() { - Data data; - return data; +MMIComponent::MMIComponent() { } -void MMIIOProcessor::send(const SendRequest& req) { +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 index ba3f2c8..990222f 100644 --- a/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h +++ b/src/uscxml/plugins/ioprocessor/modality/MMIComponent.h @@ -1,50 +1,33 @@ #ifndef MMIIOPROCESSOR_H_W09J90F0 #define MMIIOPROCESSOR_H_W09J90F0 -#include <uscxml/Interpreter.h> #include "MMIMessages.h" -#ifdef BUILD_AS_PLUGINS -#include "uscxml/plugins/Plugins.h" -#endif - namespace uscxml { -class MMIIOProcessor : public IOProcessorImpl { +class MMIComponent { public: - MMIIOProcessor(); - virtual ~MMIIOProcessor(); - virtual boost::shared_ptr<IOProcessorImpl> create(InterpreterImpl* interpreter); - - virtual std::set<std::string> getNames() { - return std::set<std::string>(); - }; - - virtual Data getDataModelVariables(); - virtual void send(const SendRequest& req); + MMIComponent(); + virtual ~MMIComponent(); /** Modality component */ - virtual PrepareResponse prepare(const PrepareRequest&); - virtual StartResponse start(const StartRequest&); - virtual CancelResponse cancel(const CancelRequest&); - virtual PauseResponse pause(const PauseRequest&); - virtual ResumeResponse resume(const ResumeRequest&); - virtual ExtensionNotification extension(const ExtensionNotification&); - virtual ClearContextRequest clearContext(const ClearContextRequest&); - virtual StatusResponse status(const StatusRequest&); + 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&); - virtual DoneNotification done(const DoneNotification&); + virtual NewContextResponse newContext(const NewContextRequest&) = 0; + virtual DoneNotification done(const DoneNotification&) = 0; // virtual ExtensionNotification extension(const ExtensionNotification&); }; -#ifdef BUILD_AS_PLUGINS -PLUMA_INHERIT_PROVIDER(MMIIOProcessor, IOProcessorImpl); -#endif - } diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h b/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h new file mode 100644 index 0000000..45e316f --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/modality/MMIInvokerImpl.h @@ -0,0 +1,12 @@ +#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/MMIProtoBridge.cpp b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp new file mode 100644 index 0000000..55ee9fe --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.cpp @@ -0,0 +1,113 @@ +#include "MMIProtoBridge.h" + +#define INIT_PROTO_LIFE_CYCLE_EVENT(type) \ +::LifeCycleEvent lifeCycleEvent; \ +lifeCycleEvent.set_type(type); \ +lifeCycleEvent.set_requestid(mmiEvent.requestId); \ +lifeCycleEvent.set_source(mmiEvent.source); \ +lifeCycleEvent.set_target(mmiEvent.target); + +namespace uscxml { + +::LifeCycleEvent MMIProtoBridge::toProto(const NewContextRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_NEW_CONTEXT_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const NewContextResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_NEW_CONTEXT_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const PrepareRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PREPARE_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const PrepareResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PREPARE_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const StartRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_START_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); + + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const StartResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_START_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const DoneNotification& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_DONE_NOTIFICATION); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const CancelRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CANCEL_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const CancelResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CANCEL_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const PauseRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PAUSE_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const PauseResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_PAUSE_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const ResumeRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_RESUME_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const ResumeResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_RESUME_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const ExtensionNotification& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_EXTENSION_NOTIFICATION); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const ClearContextRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CLEAR_CONTEXT_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const ClearContextResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_CLEAR_CONTEXT_RESPONSE); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const StatusRequest& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_STATUS_REQUEST); + return lifeCycleEvent; +} + +::LifeCycleEvent MMIProtoBridge::toProto(const StatusResponse& mmiEvent) { + INIT_PROTO_LIFE_CYCLE_EVENT(::LifeCycleEvent_LifeCycleEventType_STATUS_RESPONSE); + return lifeCycleEvent; +} + +}
\ No newline at end of file diff --git a/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h new file mode 100644 index 0000000..32a69f6 --- /dev/null +++ b/src/uscxml/plugins/ioprocessor/modality/MMIProtoBridge.h @@ -0,0 +1,34 @@ +#ifndef MMIPROTOBRIDGE_H_T6VXUX69 +#define MMIPROTOBRIDGE_H_T6VXUX69 + +#include "LifeCycleEvents.pb.h" +#include "StringDataExtension.pb.h" +#include "MMIMessages.h" + +namespace uscxml { + +class MMIProtoBridge { +public: + static ::LifeCycleEvent toProto(const NewContextRequest&); + static ::LifeCycleEvent toProto(const NewContextResponse&); + static ::LifeCycleEvent toProto(const PrepareRequest&); + static ::LifeCycleEvent toProto(const PrepareResponse&); + static ::LifeCycleEvent toProto(const StartRequest&); + static ::LifeCycleEvent toProto(const StartResponse&); + static ::LifeCycleEvent toProto(const DoneNotification&); + static ::LifeCycleEvent toProto(const CancelRequest&); + static ::LifeCycleEvent toProto(const CancelResponse&); + static ::LifeCycleEvent toProto(const PauseRequest&); + static ::LifeCycleEvent toProto(const PauseResponse&); + static ::LifeCycleEvent toProto(const ResumeRequest&); + static ::LifeCycleEvent toProto(const ResumeResponse&); + static ::LifeCycleEvent toProto(const ExtensionNotification&); + static ::LifeCycleEvent toProto(const ClearContextRequest&); + static ::LifeCycleEvent toProto(const ClearContextResponse&); + static ::LifeCycleEvent toProto(const StatusRequest&); + static ::LifeCycleEvent toProto(const StatusResponse&); +}; + +} + +#endif /* end of include guard: MMIPROTOBRIDGE_H_T6VXUX69 */ |