diff options
Diffstat (limited to 'src/uscxml/plugins/invoker')
46 files changed, 1344 insertions, 465 deletions
diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt index 43dd683..6dd78ec 100644 --- a/src/uscxml/plugins/invoker/CMakeLists.txt +++ b/src/uscxml/plugins/invoker/CMakeLists.txt @@ -9,7 +9,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${SAMPLE_INVOKER}) add_library( invoker_sample SHARED - ${SAMPLE_INVOKER}) + ${SAMPLE_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_sample uscxml) set_target_properties(invoker_sample PROPERTIES FOLDER "Plugin Invoker") else() @@ -27,7 +28,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${DIRMON_INVOKER}) add_library( invoker_dirmon SHARED - ${DIRMON_INVOKER}) + ${DIRMON_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_dirmon uscxml) set_target_properties(invoker_dirmon PROPERTIES FOLDER "Plugin Invoker") else() @@ -45,7 +47,8 @@ endif() # source_group("" FILES ${LOCATION_INVOKER}) # add_library( # invoker_location SHARED -# ${LOCATION_INVOKER}) +# ${LOCATION_INVOKER} +# "../Plugins.cpp") # target_link_libraries(invoker_location uscxml) # set_target_properties(invoker_location PROPERTIES FOLDER "Plugin Invoker") # else() @@ -64,7 +67,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${XHTML_INVOKER}) add_library( invoker_xhtml SHARED - ${XHTML_INVOKER}) + ${XHTML_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_xhtml uscxml) set_target_properties(invoker_xhtml PROPERTIES FOLDER "Plugin Invoker") else() @@ -82,7 +86,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${SYSTEM_INVOKER}) add_library( invoker_system SHARED - ${SYSTEM_INVOKER}) + ${SYSTEM_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_system uscxml) set_target_properties(invoker_system PROPERTIES FOLDER "Plugin Invoker") else() @@ -101,7 +106,8 @@ if (SQLITE3_FOUND) source_group("" FILES ${SQLITE3_INVOKER}) add_library( invoker_sqlite3 SHARED - ${SQLITE3_INVOKER}) + ${SQLITE3_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_sqlite3 uscxml) set_target_properties(invoker_sqlite3 PROPERTIES FOLDER "Plugin Invoker") else() @@ -122,7 +128,8 @@ if (FFMPEG_FOUND) source_group("" FILES ${FFMPEG_INVOKER}) add_library( invoker_ffmpeg SHARED - ${FFMPEG_INVOKER}) + ${FFMPEG_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_ffmpeg uscxml ${FFMPEG_LIBRARIES}) set_target_properties(invoker_ffmpeg PROPERTIES FOLDER "Plugin Invoker") else() @@ -143,7 +150,8 @@ if (LIBPURPLE_FOUND) source_group("" FILES ${LIBPURPLE_INVOKER}) add_library( invoker_im SHARED - ${LIBPURPLE_INVOKER}) + ${LIBPURPLE_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_im uscxml ${LIBPURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${ICONV_LIBRARIES}) set_target_properties(invoker_im PROPERTIES FOLDER "Plugin Invoker") else() @@ -164,7 +172,8 @@ if (LIBICAL_FOUND) source_group("" FILES ${CALENDAR_INVOKER}) add_library( invoker_calendar SHARED - ${CALENDAR_INVOKER}) + ${CALENDAR_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_calendar uscxml ${LIBICAL_LIBRARIES}) set_target_properties(invoker_calendar PROPERTIES FOLDER "Plugin Invoker") else() @@ -186,7 +195,8 @@ if (CORELOCATION_LIBRARY AND OFF) source_group("" FILES ${LOCATION_INVOKER}) add_library( invoker_location SHARED - ${LOCATION_INVOKER}) + ${LOCATION_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_location uscxml) set_target_properties(invoker_location PROPERTIES FOLDER "Plugin Invoker") else() @@ -208,7 +218,8 @@ if (UMUNDO_FOUND) # message(FATAL_ERROR "UMUNDO_LIBRARIES: ${UMUNDO_LIBRARIES}") add_library( invoker_umundo SHARED - ${UMUNDO_INVOKER}) + ${UMUNDO_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_umundo uscxml optimized ${PROTOBUF_LIBRARY} debug ${PROTOBUF_LIBRARY_DEBUG} @@ -230,7 +241,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${USCXML_INVOKER}) add_library( invoker_uscxml SHARED - ${USCXML_INVOKER}) + ${USCXML_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_uscxml uscxml) set_target_properties(invoker_uscxml PROPERTIES FOLDER "Plugin Invoker") @@ -249,7 +261,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${HTTPSERVLET_INVOKER}) add_library( invoker_httpserver SHARED - ${HTTPSERVLET_INVOKER}) + ${HTTPSERVLET_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_httpserver uscxml) set_target_properties(invoker_httpserver PROPERTIES FOLDER "Plugin Invoker") @@ -269,7 +282,8 @@ if (BUILD_AS_PLUGINS) source_group("" FILES ${HEARTBEAT_INVOKER}) add_library( invoker_heartbeat SHARED - ${HEARTBEAT_INVOKER}) + ${HEARTBEAT_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_heartbeat uscxml) set_target_properties(invoker_heartbeat PROPERTIES FOLDER "Plugin Invoker") else() @@ -288,7 +302,8 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) source_group("" FILES ${OPENSCENEGRAPH_INVOKER}) add_library( invoker_openscenegraph SHARED - ${OPENSCENEGRAPH_INVOKER}) + ${OPENSCENEGRAPH_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_openscenegraph ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES} @@ -307,7 +322,8 @@ if (OPENSCENEGRAPH_FOUND AND OPENGL_FOUND) source_group("" FILES ${OPENSCENEGRAPH_CONVERTER_INVOKER}) add_library( invoker_openscenegraph_convert SHARED - ${OPENSCENEGRAPH_CONVERTER_INVOKER}) + ${OPENSCENEGRAPH_CONVERTER_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_openscenegraph_convert ${OPENSCENEGRAPH_LIBRARIES} ${OPENGL_LIBRARIES} @@ -343,7 +359,8 @@ if (OPENAL_FOUND AND (LIBSNDFILE_FOUND OR AUDIOTOOLBOX_FOUND)) source_group("" FILES ${OPENAL_INVOKER}) add_library( invoker_openal SHARED - ${OPENAL_INVOKER}) + ${OPENAL_INVOKER} + "../Plugins.cpp") if (LIBSNDFILE_FOUND) target_link_libraries(invoker_openal ${OPENAL_LIBRARY} @@ -375,7 +392,8 @@ if (MILES_FOUND) source_group("" FILES ${MILES_INVOKER}) add_library( invoker_miles SHARED - ${MILES_INVOKER}) + ${MILES_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_miles ${MILES_LIBRARIES} ${OPENAL_LIBRARY} @@ -401,7 +419,8 @@ if (UMUNDO_FOUND AND OFF) source_group("" FILES ${VXML_INVOKER}) add_library( invoker_voicexml SHARED - ${VXML_INVOKER}) + ${VXML_INVOKER} + "../Plugins.cpp") target_link_libraries(invoker_voicexml uscxml) set_target_properties(invoker_voicexml PROPERTIES FOLDER "Plugin Invoker") else() diff --git a/src/uscxml/plugins/invoker/audio/AudioToolbox.h b/src/uscxml/plugins/invoker/audio/AudioToolbox.h index 6ad7390..5834f34 100644 --- a/src/uscxml/plugins/invoker/audio/AudioToolbox.h +++ b/src/uscxml/plugins/invoker/audio/AudioToolbox.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 AUDIOTOOLBOX_H_GX4SW17C #define AUDIOTOOLBOX_H_GX4SW17C diff --git a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm index 58e0224..ef99063 100644 --- a/src/uscxml/plugins/invoker/audio/AudioToolbox.mm +++ b/src/uscxml/plugins/invoker/audio/AudioToolbox.mm @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "AudioToolbox.h" #include <glog/logging.h> diff --git a/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp b/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp index 26d3328..b881e41 100644 --- a/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp +++ b/src/uscxml/plugins/invoker/audio/LibSoundFile.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "LibSoundFile.h" namespace uscxml { diff --git a/src/uscxml/plugins/invoker/audio/LibSoundFile.h b/src/uscxml/plugins/invoker/audio/LibSoundFile.h index 0d740f6..0e0b304 100644 --- a/src/uscxml/plugins/invoker/audio/LibSoundFile.h +++ b/src/uscxml/plugins/invoker/audio/LibSoundFile.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 LIBSOUNDFILE_H_Q97OEKGG #define LIBSOUNDFILE_H_Q97OEKGG diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp index 73f44ea..ed04ebd 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp +++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 + */ + // see http://stackoverflow.com/questions/6563810/m-pi-works-with-math-h-but-not-with-cmath-in-visual-studio #define _USE_MATH_DEFINES #include <cmath> @@ -15,7 +34,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new OpenALInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h index 81ced9b..9771f6b 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALInvoker.h +++ b/src/uscxml/plugins/invoker/audio/OpenALInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 OPENALINVOKER_H_W09J90F0 #define OPENALINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp index 64fa70a..5833e2b 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp +++ b/src/uscxml/plugins/invoker/audio/OpenALPlayer.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "OpenALPlayer.h" #include <assert.h> #include <stdexcept> diff --git a/src/uscxml/plugins/invoker/audio/OpenALPlayer.h b/src/uscxml/plugins/invoker/audio/OpenALPlayer.h index 7ea069d..db883a0 100644 --- a/src/uscxml/plugins/invoker/audio/OpenALPlayer.h +++ b/src/uscxml/plugins/invoker/audio/OpenALPlayer.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 OPENALPLAYER_H_3PORVJDU #define OPENALPLAYER_H_3PORVJDU diff --git a/src/uscxml/plugins/invoker/audio/PCMConverter.h b/src/uscxml/plugins/invoker/audio/PCMConverter.h index df367f8..1984600 100644 --- a/src/uscxml/plugins/invoker/audio/PCMConverter.h +++ b/src/uscxml/plugins/invoker/audio/PCMConverter.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 PCMCONVERTER_H_97Z8U7PA #define PCMCONVERTER_H_97Z8U7PA diff --git a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp index 25cfafd..e129cd4 100644 --- a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp +++ b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "CalendarInvoker.h" #include <glog/logging.h> @@ -9,7 +28,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new CalendarInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h index 4766907..c9daaab 100644 --- a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h +++ b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 CALENDARINVOKER_H_W09J90F0 #define CALENDARINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp index 36fcc1b..374c287 100644 --- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp +++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "FFMPEGInvoker.h" #include <glog/logging.h> @@ -16,7 +35,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new FFMPEGInvokerProvider() ); return true; } @@ -43,43 +62,43 @@ Data FFMPEGInvoker::getDataModelVariables() { AVCodec* codecInst = avcodec_find_encoder(codec->id); if (!codecInst) continue; - + switch (codec->type) { - case AVMEDIA_TYPE_VIDEO: { - Data codecData; - codecData.compound["name"] = Data(codec->name, Data::VERBATIM); - codecData.compound["longName"] = Data(codec->long_name, Data::VERBATIM); - data.compound["video"].compound[codec->name] = codecData; - break; - } - case AVMEDIA_TYPE_AUDIO: { - Data codecData; - codecData.compound["name"] = Data(codec->name, Data::VERBATIM); - codecData.compound["longName"] = Data(codec->long_name, Data::VERBATIM); - data.compound["audio"].compound[codec->name] = codecData; - break; - } - default: - break; + case AVMEDIA_TYPE_VIDEO: { + Data codecData; + codecData.compound["name"] = Data(codec->name, Data::VERBATIM); + codecData.compound["longName"] = Data(codec->long_name, Data::VERBATIM); + data.compound["video"].compound[codec->name] = codecData; + break; + } + case AVMEDIA_TYPE_AUDIO: { + Data codecData; + codecData.compound["name"] = Data(codec->name, Data::VERBATIM); + codecData.compound["longName"] = Data(codec->long_name, Data::VERBATIM); + data.compound["audio"].compound[codec->name] = codecData; + break; + } + default: + break; } } - + return data; } void FFMPEGInvoker::invoke(const InvokeRequest& req) { int nrThreads = 1; Event::getParam(req.params, "threads", nrThreads); - + _isRunning = true; for (int i = 0; i < nrThreads; i++) { _threads.insert(new tthread::thread(FFMPEGInvoker::run, this)); } } - + void FFMPEGInvoker::send(const SendRequest& req) { SendRequest reqCopy = req; - + if (boost::iequals(req.name, "render.start")) { // create a new encoding context int ret; @@ -97,52 +116,52 @@ void FFMPEGInvoker::send(const SendRequest& req) { if (!ctx->width || !ctx->height) return; - + ctx->filename = URL::getTmpFilename(); - - /* allocate the output media context */ - avformat_alloc_output_context2(&ctx->formatCtx, NULL, ctx->extension.c_str(), ctx->filename.c_str()); - if (!ctx->formatCtx) { + + /* allocate the output media context */ + avformat_alloc_output_context2(&ctx->formatCtx, NULL, ctx->extension.c_str(), ctx->filename.c_str()); + if (!ctx->formatCtx) { printf("Could not deduce output format from file extension: using MPEG.\n"); avformat_alloc_output_context2(&ctx->formatCtx, NULL, "mpeg", ctx->filename.c_str()); - } - if (!ctx->formatCtx) { + } + if (!ctx->formatCtx) { return; - } - ctx->format = ctx->formatCtx->oformat; - - /* Add the audio and video streams using the default format codecs - * and initialize the codecs. */ - ctx->videoStream = NULL; - - if (ctx->format->video_codec != AV_CODEC_ID_NONE) { + } + ctx->format = ctx->formatCtx->oformat; + + /* Add the audio and video streams using the default format codecs + * and initialize the codecs. */ + ctx->videoStream = NULL; + + if (ctx->format->video_codec != AV_CODEC_ID_NONE) { ctx->videoStream = addStream(ctx, ctx->formatCtx, &ctx->videoCodec, ctx->format->video_codec); - } - - /* Now that all the parameters are set, we can open the audio and - * video codecs and allocate the necessary encode buffers. */ - if (ctx->videoStream) + } + + /* Now that all the parameters are set, we can open the audio and + * video codecs and allocate the necessary encode buffers. */ + if (ctx->videoStream) openVideo(ctx, ctx->formatCtx, ctx->videoCodec, ctx->videoStream); - - /* open the output file, if needed */ - if (!(ctx->format->flags & AVFMT_NOFILE)) { + + /* open the output file, if needed */ + if (!(ctx->format->flags & AVFMT_NOFILE)) { ret = avio_open(&ctx->formatCtx->pb, ctx->filename.c_str(), AVIO_FLAG_WRITE); if (ret < 0) { - // fprintf(stderr, "Could not open '%s': %s\n", ctx->filename.c_str(), - // av_err2str(ret)); + // fprintf(stderr, "Could not open '%s': %s\n", ctx->filename.c_str(), + // av_err2str(ret)); return; } - } - - /* Write the stream header, if any. */ - ret = avformat_write_header(ctx->formatCtx, NULL); - if (ret < 0) { - // fprintf(stderr, "Error occurred when opening output file: %s\n", - // av_err2str(ret)); + } + + /* Write the stream header, if any. */ + ret = avformat_write_header(ctx->formatCtx, NULL); + if (ret < 0) { + // fprintf(stderr, "Error occurred when opening output file: %s\n", + // av_err2str(ret)); return; - } - - if (ctx->frame) + } + + if (ctx->frame) ctx->frame->pts = 0; _encoders[context] = ctx; @@ -170,33 +189,33 @@ void FFMPEGInvoker::run(void* instance) { void FFMPEGInvoker::finish(EncodingContext* ctx, const SendRequest& req) { av_write_trailer(ctx->formatCtx); - + /* Close each codec. */ if (ctx->videoStream) closeVideo(ctx, ctx->formatCtx, ctx->videoStream); - + if (!(ctx->formatCtx->oformat->flags & AVFMT_NOFILE)) - /* Close the output file. */ + /* Close the output file. */ avio_close(ctx->formatCtx->pb); - + /* free the stream */ avformat_free_context(ctx->formatCtx); - + // read file std::ifstream movieFile(ctx->filename.c_str()); movieFile.seekg(0, std::ios::end); size_t length = movieFile.tellg(); movieFile.seekg(0, std::ios::beg); - + char* movieBuffer = (char*)malloc(length); movieFile.read(movieBuffer, length); - + // move to desktop for checking // int err = rename(ctx->filename.c_str(), "/Users/sradomski/Desktop/foo.mpg"); // if (err) { // printf("%s", strerror(errno)); // } - + std::string context; Event::getParam(req.params, "context", context); @@ -206,7 +225,7 @@ void FFMPEGInvoker::finish(EncodingContext* ctx, const SendRequest& req) { event.data.compound["movie"] = Data(movieBuffer, length, true); event.data.compound["mimetype"] = Data("video/mpeg", Data::VERBATIM); event.data.compound["filename"] = Data(std::string("movie.") + ctx->extension, Data::VERBATIM); - + returnEvent(event); } @@ -217,7 +236,7 @@ void FFMPEGInvoker::process(const SendRequest& req) { if (_encoders.find(context) == _encoders.end()) { return; } - + EncodingContext* ctx = _encoders[context]; tthread::lock_guard<tthread::recursive_mutex> lock(ctx->mutex); @@ -227,7 +246,7 @@ void FFMPEGInvoker::process(const SendRequest& req) { delete _encoders[context]; _encoders.erase(context); } - + Data image; Event::getParam(req.params, "frame", image); if (!image) { @@ -236,25 +255,25 @@ void FFMPEGInvoker::process(const SendRequest& req) { std::string format = "bmp"; Event::getParam(req.params, "format", format); - + writeVideoFrame(ctx, ctx->formatCtx, ctx->videoStream, image.binary); ctx->frame->pts += av_rescale_q(1, ctx->videoStream->codec->time_base, ctx->videoStream->time_base); } - + AVStream* FFMPEGInvoker::addStream(EncodingContext* ctx, AVFormatContext *oc, AVCodec **codec, - enum AVCodecID codec_id) { + enum AVCodecID codec_id) { AVCodecContext *c; AVStream *st; - + /* find the encoder */ *codec = avcodec_find_encoder(codec_id); if (!(*codec)) { fprintf(stderr, "Could not find encoder for '%s'\n", - avcodec_get_name(codec_id)); + avcodec_get_name(codec_id)); return NULL; } - + st = avformat_new_stream(oc, *codec); ctx->videoPixFmt = (*codec)->pix_fmts[0]; if (!st) { @@ -263,50 +282,50 @@ AVStream* FFMPEGInvoker::addStream(EncodingContext* ctx, AVFormatContext *oc, AV } st->id = oc->nb_streams-1; c = st->codec; - + switch ((*codec)->type) { - case AVMEDIA_TYPE_AUDIO: - c->sample_fmt = AV_SAMPLE_FMT_FLTP; - c->bit_rate = 64000; - c->sample_rate = 44100; - c->channels = 2; - break; - - case AVMEDIA_TYPE_VIDEO: - c->codec_id = codec_id; - - c->bit_rate = 800000; - /* Resolution must be a multiple of two. */ - c->width = ctx->width; - c->height = ctx->height; - /* timebase: This is the fundamental unit of time (in seconds) in terms - * of which frame timestamps are represented. For fixed-fps content, - * timebase should be 1/framerate and timestamp increments should be - * identical to 1. */ - c->time_base.den = STREAM_FRAME_RATE; - c->time_base.num = 1; - c->gop_size = 12; /* emit one intra frame every twelve frames at most */ - c->pix_fmt = ctx->videoPixFmt; - if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) { - /* just for testing, we also add B frames */ - c->max_b_frames = 2; - } - if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) { - /* Needed to avoid using macroblocks in which some coeffs overflow. - * This does not happen with normal video, it just happens here as - * the motion of the chroma plane does not match the luma plane. */ - c->mb_decision = 2; - } - break; - - default: - break; + case AVMEDIA_TYPE_AUDIO: + c->sample_fmt = AV_SAMPLE_FMT_FLTP; + c->bit_rate = 64000; + c->sample_rate = 44100; + c->channels = 2; + break; + + case AVMEDIA_TYPE_VIDEO: + c->codec_id = codec_id; + + c->bit_rate = 800000; + /* Resolution must be a multiple of two. */ + c->width = ctx->width; + c->height = ctx->height; + /* timebase: This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identical to 1. */ + c->time_base.den = STREAM_FRAME_RATE; + c->time_base.num = 1; + c->gop_size = 12; /* emit one intra frame every twelve frames at most */ + c->pix_fmt = ctx->videoPixFmt; + if (c->codec_id == AV_CODEC_ID_MPEG2VIDEO) { + /* just for testing, we also add B frames */ + c->max_b_frames = 2; + } + if (c->codec_id == AV_CODEC_ID_MPEG1VIDEO) { + /* Needed to avoid using macroblocks in which some coeffs overflow. + * This does not happen with normal video, it just happens here as + * the motion of the chroma plane does not match the luma plane. */ + c->mb_decision = 2; + } + break; + + default: + break; } - + /* Some formats want stream headers to be separate. */ if (oc->oformat->flags & AVFMT_GLOBALHEADER) c->flags |= CODEC_FLAG_GLOBAL_HEADER; - + return st; } @@ -317,7 +336,7 @@ void FFMPEGInvoker::openVideo(EncodingContext* ctx, AVFormatContext *oc, AVCodec /* open the codec */ ret = avcodec_open2(c, codec, NULL); if (ret < 0) { - // fprintf(stderr, "Could not open video codec: %s\n", av_err2str(ret)); + // fprintf(stderr, "Could not open video codec: %s\n", av_err2str(ret)); return; } @@ -341,8 +360,8 @@ void FFMPEGInvoker::openVideo(EncodingContext* ctx, AVFormatContext *oc, AVCodec if (c->pix_fmt != BMP_FORMAT) { ret = avpicture_alloc(&ctx->src_picture, BMP_FORMAT, c->width, c->height); if (ret < 0) { - // fprintf(stderr, "Could not allocate temporary picture: %s\n", - // av_err2str(ret)); + // fprintf(stderr, "Could not allocate temporary picture: %s\n", + // av_err2str(ret)); return; } } @@ -350,7 +369,7 @@ void FFMPEGInvoker::openVideo(EncodingContext* ctx, AVFormatContext *oc, AVCodec /* copy data and linesize picture pointers to frame */ *((AVPicture *)ctx->frame) = ctx->dst_picture; } - + void FFMPEGInvoker::writeVideoFrame(EncodingContext* ctx, AVFormatContext *oc, AVStream *st, boost::shared_ptr<Blob> image) { int ret; AVCodecContext *c = st->codec; @@ -360,11 +379,11 @@ void FFMPEGInvoker::writeVideoFrame(EncodingContext* ctx, AVFormatContext *oc, A * to the codec pixel format if needed */ if (!ctx->sws_ctx) { ctx->sws_ctx = sws_getContext(c->width, c->height, BMP_FORMAT, - c->width, c->height, c->pix_fmt, - ctx->sws_flags, NULL, NULL, NULL); + c->width, c->height, c->pix_fmt, + ctx->sws_flags, NULL, NULL, NULL); if (!ctx->sws_ctx) { fprintf(stderr, - "Could not initialize the conversion context\n"); + "Could not initialize the conversion context\n"); return; } } @@ -376,15 +395,15 @@ void FFMPEGInvoker::writeVideoFrame(EncodingContext* ctx, AVFormatContext *oc, A headerOffset += image->data[13] << 24; // std::cout << headerOffset + (c->width * c->height) << " / " << image->_size << std::endl; - + ret = avpicture_fill(&ctx->src_picture, (uint8_t*)(image->data + headerOffset), BMP_FORMAT, c->width, c->height); if (ret < 0) { fprintf(stderr, - "Could not fill image from given bitmap\n"); + "Could not fill image from given bitmap\n"); } sws_scale(ctx->sws_ctx, - (const uint8_t * const *)ctx->src_picture.data, ctx->src_picture.linesize, - 0, c->height, ctx->dst_picture.data, ctx->dst_picture.linesize); + (const uint8_t * const *)ctx->src_picture.data, ctx->src_picture.linesize, + 0, c->height, ctx->dst_picture.data, ctx->dst_picture.linesize); } else { avpicture_fill(&ctx->dst_picture, (uint8_t*)image->data, c->pix_fmt, c->width, c->height); } @@ -408,7 +427,7 @@ void FFMPEGInvoker::writeVideoFrame(EncodingContext* ctx, AVFormatContext *oc, A /* encode the image */ ret = avcodec_encode_video2(c, &pkt, ctx->frame, &got_packet); if (ret < 0) { - // fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret)); + // fprintf(stderr, "Error encoding video frame: %s\n", av_err2str(ret)); return; } /* If size is zero, it means the image was buffered. */ diff --git a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h index ecce031..7725ec9 100644 --- a/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h +++ b/src/uscxml/plugins/invoker/ffmpeg/FFMPEGInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 FFMPEGINVOKER_H_VQD1V1C2 #define FFMPEGINVOKER_H_VQD1V1C2 @@ -53,7 +72,7 @@ protected: if (sws_ctx) sws_freeContext(sws_ctx); } - + tthread::recursive_mutex mutex; PixelFormat videoPixFmt; std::string filename; @@ -79,7 +98,7 @@ protected: static void run(void*); void finish(EncodingContext* ctx, const SendRequest& req); void process(const SendRequest& req); - + std::set<tthread::thread*> _threads; uscxml::concurrency::BlockingQueue<SendRequest> _workQueue; bool _isRunning; diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp index 559e441..481071c 100644 --- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "DirMonInvoker.h" #include <glog/logging.h> @@ -18,7 +37,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new DirMonInvokerProvider() ); return true; } @@ -50,7 +69,7 @@ boost::shared_ptr<InvokerImpl> DirMonInvoker::create(InterpreterImpl* interprete Data DirMonInvoker::getDataModelVariables() { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); - + Data data; data.compound["dir"] = Data(_dir, Data::VERBATIM); @@ -59,7 +78,7 @@ Data DirMonInvoker::getDataModelVariables() { data.compound["suffixes"].array.push_back(Data(*suffixIter, Data::VERBATIM)); suffixIter++; } - + std::map<std::string, struct stat> entries = _watcher->getAllEntries(); std::map<std::string, struct stat>::iterator entryIter = entries.begin(); while(entryIter != entries.end()) { @@ -69,7 +88,7 @@ Data DirMonInvoker::getDataModelVariables() { data.compound["file"].compound[entryIter->first].compound["size"] = toStr(entryIter->second.st_mtime); entryIter++; } - + return data; } @@ -86,7 +105,7 @@ void DirMonInvoker::invoke(const InvokeRequest& req) { } if (req.params.find("reportexisting") != req.params.end() && - boost::iequals(req.params.find("reportexisting")->second.atom, "false")) + boost::iequals(req.params.find("reportexisting")->second.atom, "false")) _reportExisting = false; if (req.params.find("recurse") != req.params.end() && boost::iequals(req.params.find("recurse")->second.atom, "true")) @@ -256,7 +275,7 @@ DirectoryWatch::~DirectoryWatch() { } } - + void DirectoryWatch::reportAsDeleted() { std::map<std::string, struct stat>::iterator fileIter = _knownEntries.begin(); while(fileIter != _knownEntries.end()) { @@ -292,7 +311,7 @@ void DirectoryWatch::updateEntries(bool reportAsExisting) { if ((unsigned)dirStat.st_mtime >= (unsigned)_lastChecked) { // std::cout << "dirStat.st_mtime: " << dirStat.st_mtime << " / _lastChecked: " << _lastChecked << std::endl; - + // there are changes in the directory std::set<std::string> currEntries; diff --git a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h index f5aa4bc..9c3f873 100644 --- a/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h +++ b/src/uscxml/plugins/invoker/filesystem/dirmon/DirMonInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 DIRMONINVOKER_H_W09J90F0 #define DIRMONINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp index 6d2a8e2..bf4fac7 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "CompositeDisplay.h" #if 0 #ifdef MACOSX diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h index b524777..6c2adac 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/CompositeDisplay.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 COMPOSITEDISPLAY_H_W2MX9CXP #define COMPOSITEDISPLAY_H_W2MX9CXP diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp index d732e63..e4db10a 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "OSGInvoker.h" #include "uscxml/URL.h" #include "uscxml/UUID.h" @@ -37,7 +56,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new OSGInvokerProvider() ); return true; } @@ -47,8 +66,8 @@ bool connect(pluma::Host& host) { } else if (boost::iequals(LOCALNAME(childs.item(i)), tagName) && \ validChildren.find(tagName) != validChildren.end()) { \ procFunc(childs.item(i));\ + - OSGInvoker::OSGInvoker() { } @@ -68,7 +87,7 @@ Data OSGInvoker::getDataModelVariables() { void OSGInvoker::send(const SendRequest& req) { if (boost::iequals(req.name, "intersect")) { - + } } @@ -79,9 +98,9 @@ void OSGInvoker::invoke(const InvokeRequest& req) { tthread::lock_guard<tthread::recursive_mutex> lock(_mutex); setupColors(); - + std::cout << req.dom; - + // register default event handlers Arabica::DOM::Events::EventTarget<std::string> evTarget = Arabica::DOM::Events::EventTarget<std::string>(req.dom); evTarget.addEventListener("DOMSubtreeModified", *this, false); @@ -91,7 +110,7 @@ void OSGInvoker::invoke(const InvokeRequest& req) { std::set<std::string> validChilds; validChilds.insert("display"); - + // this is somewhat unfortunate, if content contains a single child, we will get that, otherwise its parent (<content>) if (boost::iequals(LOCALNAME(req.dom), "display")) { processChildren(validChilds, req.dom.getParentNode()); @@ -121,7 +140,7 @@ void OSGInvoker::setupColors() { _colors["green"] = osg::Vec4(0.0, 0.5, 0.0, 1.0); _colors["olive"] = osg::Vec4(0.5, 0.5, 0.0, 1.0); } - + void OSGInvoker::runOnMainThread() { _displays_t::iterator dispIter = _displays.begin(); if (_mutex.try_lock()) { @@ -184,7 +203,7 @@ void OSGInvoker::processViewport(const Arabica::DOM::Node<std::string>& element) unsigned int actualY = 0; unsigned int actualWidth = 0; unsigned int actualHeight = 0; - + getViewport(element, actualX, actualY, actualWidth, actualHeight, compDisp); osg::Viewport* viewPort = new osg::Viewport(actualX, actualY, actualWidth, actualHeight); compDisp->addView(name, viewPort, sceneView); @@ -196,7 +215,7 @@ void OSGInvoker::processViewport(const Arabica::DOM::Node<std::string>& element) } else { sceneView->getCamera()->setClearColor(_colors["white"]); } - + std::set<std::string> validChilds; validChilds.insert("camera"); validChilds.insert("translation"); @@ -391,11 +410,11 @@ void OSGInvoker::processSphere(const Arabica::DOM::Node<std::string>& element) { float radius = 1; osg::Vec3 center(0,0,0); - + if (HAS_ATTR(element, "radius")) { radius = strTo<float>(ATTR(element, "radius")); } - + osg::ref_ptr<osg::Sphere> sphere = new osg::Sphere(center, radius); osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(sphere); osg::ref_ptr<osg::Geode> geode = new osg::Geode(); @@ -415,26 +434,26 @@ void OSGInvoker::updateSphere(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events void OSGInvoker::processBox(const Arabica::DOM::Node<std::string>& element) { assert(_nodes.find(element.getParentNode()) != _nodes.end()); osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()]; - + float x = 1; float y = 1; float z = 1; osg::Vec3 center(0,0,0); - + if (HAS_ATTR(element, "x")) x = strTo<float>(ATTR(element, "x")); if (HAS_ATTR(element, "y")) y = strTo<float>(ATTR(element, "y")); if (HAS_ATTR(element, "z")) z = strTo<float>(ATTR(element, "z")); - + osg::ref_ptr<osg::Box> box = new osg::Box(center, x, y, z); osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(box); osg::ref_ptr<osg::Geode> geode = new osg::Geode(); geode->addDrawable(drawable); - + OSG_SET_COLOR; OSG_SET_MATERIAL; _nodes[element] = geode; - + parent->asGroup()->addChild(geode); } @@ -443,19 +462,19 @@ void OSGInvoker::updateBox(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::E void OSGInvoker::processCapsule(const Arabica::DOM::Node<std::string>& element) { assert(_nodes.find(element.getParentNode()) != _nodes.end()); osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()]; - + float radius = 1; float height = 1; osg::Vec3 center(0,0,0); - + if (HAS_ATTR(element, "radius")) radius = strTo<float>(ATTR(element, "radius")); if (HAS_ATTR(element, "height")) height = strTo<float>(ATTR(element, "height")); - + osg::ref_ptr<osg::Capsule> capsule = new osg::Capsule(center, radius, height); osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(capsule); osg::ref_ptr<osg::Geode> geode = new osg::Geode(); geode->addDrawable(drawable); - + OSG_SET_COLOR; OSG_SET_MATERIAL; @@ -464,28 +483,28 @@ void OSGInvoker::processCapsule(const Arabica::DOM::Node<std::string>& element) } void OSGInvoker::updateCapsule(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events::Event<std::string>& event) { } - + void OSGInvoker::processCone(const Arabica::DOM::Node<std::string>& element) { assert(_nodes.find(element.getParentNode()) != _nodes.end()); osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()]; - + float radius = 1; float height = 1; osg::Vec3 center(0,0,0); - + if (HAS_ATTR(element, "radius")) radius = strTo<float>(ATTR(element, "radius")); if (HAS_ATTR(element, "height")) height = strTo<float>(ATTR(element, "height")); - + osg::ref_ptr<osg::Cone> cone = new osg::Cone(center, radius, height); osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(cone); osg::ref_ptr<osg::Geode> geode = new osg::Geode(); geode->addDrawable(drawable); - + OSG_SET_COLOR; OSG_SET_MATERIAL; _nodes[element] = geode; - + parent->asGroup()->addChild(geode); } @@ -495,24 +514,24 @@ void OSGInvoker::updateCone(osg::ref_ptr<osg::Node> node, Arabica::DOM::Events:: void OSGInvoker::processCylinder(const Arabica::DOM::Node<std::string>& element) { assert(_nodes.find(element.getParentNode()) != _nodes.end()); osg::ref_ptr<osg::Node> parent = _nodes[element.getParentNode()]; - + float radius = 1; float height = 1; osg::Vec3 center(0,0,0); - + if (HAS_ATTR(element, "radius")) radius = strTo<float>(ATTR(element, "radius")); if (HAS_ATTR(element, "height")) height = strTo<float>(ATTR(element, "height")); - + osg::ref_ptr<osg::Cylinder> cylinder = new osg::Cylinder(center, radius, height); osg::ref_ptr<osg::ShapeDrawable> drawable = new osg::ShapeDrawable(cylinder); osg::ref_ptr<osg::Geode> geode = new osg::Geode(); geode->addDrawable(drawable); - + OSG_SET_COLOR; OSG_SET_MATERIAL; _nodes[element] = geode; - + parent->asGroup()->addChild(geode); } @@ -528,14 +547,15 @@ osg::Vec4 OSGInvoker::getColor(const Arabica::DOM::Node<std::string>& element, c valid = true; return _colors[color]; } - + // otherwise try to parse as rgba values int i; osg::Vec4 colorVec = parseVec4(color, i); - + if (i == 1) { // only a single value was given, interpret as grey value - colorVec[1] = colorVec[2] = colorVec[0]; colorVec[3] = 1.0; + colorVec[1] = colorVec[2] = colorVec[0]; + colorVec[3] = 1.0; valid = true; return colorVec; } @@ -547,7 +567,7 @@ osg::Vec4 OSGInvoker::getColor(const Arabica::DOM::Node<std::string>& element, c return colorVec; } } - + // return empty reference valid = false; return osg::Vec4(); @@ -566,7 +586,7 @@ osg::ref_ptr<osg::Material> OSGInvoker::getMaterial(const Arabica::DOM::Node<std nodeMat->setDiffuse(osg::Material::FRONT, matColor); nodeMat->setDiffuse(osg::Material::BACK, matColor); } - + // translucency if (HAS_ATTR(element, "transparency")) { std::string transparency = ATTR(element, "transparency"); @@ -576,18 +596,18 @@ osg::ref_ptr<osg::Material> OSGInvoker::getMaterial(const Arabica::DOM::Node<std nodeMat->setTransparency(osg::Material::FRONT, trans); nodeMat->setTransparency(osg::Material::BACK, trans); } - + return nodeMat; } osg::Vec4 OSGInvoker::parseVec4(const std::string& coeffs, int& i) { - + // otherwise try to parse as rgba values std::string coeff; std::stringstream coeffSS(coeffs); - + osg::Vec4 vec; - + i = 0; while(std::getline(coeffSS, coeff, ',')) { boost::trim(coeff); @@ -595,13 +615,13 @@ osg::Vec4 OSGInvoker::parseVec4(const std::string& coeffs, int& i) { continue; if (!isNumeric(coeff.c_str(), 10)) continue; - + vec[i] = strTo<float>(coeff); i++; } return vec; } - + void OSGInvoker::processChildren(const std::set<std::string>& validChildren, const Arabica::DOM::Node<std::string>& element) { Arabica::DOM::NodeList<std::string> childs = element.getChildNodes(); for (int i = 0; i < childs.getLength(); ++i) { diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h index 512eecb..cda0ad3 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/OSGInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 OSGINVOKER_H_H6T4R8HU #define OSGINVOKER_H_H6T4R8HU @@ -115,7 +134,7 @@ protected: void setupColors(); std::map<std::string, osg::Vec4> _colors; typedef std::map<std::string, osg::Vec4> _colors_t; - + tthread::recursive_mutex _mutex; }; diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp index a6f303a..3fbcc36 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "OSGConverter.h" #include <glog/logging.h> #include "uscxml/config.h" @@ -34,7 +53,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new OSGConverterProvider() ); return true; } @@ -145,7 +164,7 @@ void OSGConverter::cancel(const std::string sendId) { void OSGConverter::invoke(const InvokeRequest& req) { int nrThreads = 1; - + if (req.params.find("threads") != req.params.end() && isNumeric(req.params.find("threads")->second.atom.c_str(), 10)) { nrThreads = strTo<int>(req.params.find("threads")->second); } @@ -194,8 +213,8 @@ void OSGConverter::process(const SendRequest& req) { bool autoRotate = true; if (req.params.find("autorotate") != req.params.end()) { if (boost::iequals(req.params.find("autorotate")->second.atom, "off") || - boost::iequals(req.params.find("autorotate")->second.atom, "0") || - boost::iequals(req.params.find("autorotate")->second.atom, "false")) { + boost::iequals(req.params.find("autorotate")->second.atom, "0") || + boost::iequals(req.params.find("autorotate")->second.atom, "false")) { autoRotate = false; } } @@ -210,7 +229,7 @@ void OSGConverter::process(const SendRequest& req) { sceneGraph->addChild(model); osgDB::ReaderWriter::WriteResult result; - + osg::ref_ptr<osgDB::ReaderWriter> writer = osgDB::Registry::instance()->getReaderWriterForExtension(format); if(writer.valid()) { std::stringstream ss; @@ -225,7 +244,7 @@ void OSGConverter::process(const SendRequest& req) { return; } } - + /** * If we failed to interpret the extension as another 3D file, try to make a screenshot. */ @@ -273,7 +292,7 @@ void OSGConverter::process(const SendRequest& req) { LOG(ERROR) << "Traits returned with zero dimensions"; return; } - + GLenum pbuffer = gc->getTraits()->doubleBuffer ? GL_BACK : GL_FRONT; viewer.setCameraManipulator(new osgGA::TrackballManipulator()); @@ -289,10 +308,10 @@ void OSGConverter::process(const SendRequest& req) { viewer.getCamera()->setClearColor(osg::Vec4f(1.0f,1.0f,1.0f,1.0f)); viewer.getCamera()->setClearMask(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); viewer.getCameraManipulator()->setByMatrix(osg::Matrix::lookAt(osg::Vec3d(0,0,bs.radius() * (-3.4 * zoom)), // eye - (osg::Vec3d)bs.center(), // center - osg::Vec3d(0,1,0))); // up + (osg::Vec3d)bs.center(), // center + osg::Vec3d(0,1,0))); // up - // viewer.home(); + // viewer.home(); // perform one viewer iteration viewer.realize(); @@ -310,9 +329,9 @@ void OSGConverter::reportSuccess(const SendRequest& req, const Data& content) { std::string format; Event::getParam(req.params, "format", format); - + event.data.compound["mimetype"] = Data(URL::getMimeType(format), Data::VERBATIM); - + if (event.name.length() == 0) event.name = "convert"; event.name += ".success"; @@ -530,11 +549,11 @@ void OSGConverter::dumpMatrix(const osg::Matrix& m) { } void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image, const unsigned int context_id) { - + // std::cout << "NameRespectingWriteToFile" << std::endl; // std::cout << image.s() << std::endl; // std::cout << image.t() << std::endl; - + // write to memory first std::string format; if (_req.params.find("format") != _req.params.end()) { @@ -552,21 +571,21 @@ void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image if (!osgDB::writeImageFile(image, tempFile, op)) { _converter->reportFailure(_req); } - + char* buffer = NULL; size_t length = 0; { std::ifstream file(tempFile.c_str()); - + file.seekg(0, std::ios::end); length = file.tellg(); file.seekg(0, std::ios::beg); buffer = (char*)malloc(length); file.read(buffer, length); } - - std::cout << tempFile << std::endl; - + + std::cout << tempFile << std::endl; + // remove(tempFile.c_str()); // osg::ref_ptr<osgDB::ReaderWriter> writerFormat = osgDB::Registry::instance()->getReaderWriterForExtension(format); // if(!writerFormat.valid()) @@ -577,7 +596,7 @@ void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image std::stringstream ssFormat; osgDB::ReaderWriter::WriteResult res = writerFormat->writeImage(image, ssFormat, op); - + if (_filename.length() > 0) { std::string tmpName = _filename; size_t pathSep = _filename.find_last_of(PATH_SEPERATOR); @@ -589,7 +608,7 @@ void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image std::ofstream outFile(tmpName.c_str()); outFile << ssFormat.str(); } - + if (pathSep != std::string::npos) { int err = rename(tmpName.c_str(), _filename.c_str()); if (err) { @@ -598,7 +617,7 @@ void OSGConverter::NameRespectingWriteToFile::operator()(const osg::Image& image } } #endif - + Data content; content.compound[format] = Data(buffer, length, false); diff --git a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h index 2bc84a1..7164bb8 100644 --- a/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h +++ b/src/uscxml/plugins/invoker/graphics/openscenegraph/converter/OSGConverter.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 OSGCONVERTER_H_W09J90F0 #define OSGCONVERTER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp index 5afbc66..ed528b2 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "HeartbeatInvoker.h" #include <glog/logging.h> @@ -9,7 +28,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new HeartbeatInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h index ea83db9..c44e362 100644 --- a/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h +++ b/src/uscxml/plugins/invoker/heartbeat/HeartbeatInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 HEARTBEATINVOKER_H_W09J90F0 #define HEARTBEATINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp index 1a95396..d259e9a 100644 --- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp +++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "HTTPServletInvoker.h" #include <glog/logging.h> @@ -11,7 +30,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new HTTPServletInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h index e2d3b2b..7fb2438 100644 --- a/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h +++ b/src/uscxml/plugins/invoker/http/HTTPServletInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 HTTPSERVERINVOKER_H_OAAWX8NF #define HTTPSERVERINVOKER_H_OAAWX8NF diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.cpp b/src/uscxml/plugins/invoker/im/IMInvoker.cpp index 1e12650..1624b49 100644 --- a/src/uscxml/plugins/invoker/im/IMInvoker.cpp +++ b/src/uscxml/plugins/invoker/im/IMInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "IMInvoker.h" #include <glog/logging.h> #include "uscxml/UUID.h" @@ -17,10 +36,10 @@ if (_accountInstances.find(account) == _accountInstances.end()) { \ namespace uscxml { - + #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new IMInvokerProvider() ); return true; } @@ -30,8 +49,7 @@ Data IMInvoker::_pluginData; GHashTable* IMInvoker::_uiInfo = NULL; GRand* IMInvoker::_gRand = NULL; -PurpleEventLoopUiOps IMInvoker::_uiEventLoopOps = -{ +PurpleEventLoopUiOps IMInvoker::_uiEventLoopOps = { purpleEventTimeoutAdd, purpleEventTimeoutRemove, purpleEventInputAdd, @@ -106,8 +124,7 @@ PurpleConnectionUiOps IMInvoker::_uiConnectOps = { }; //libpurple conversation operations -PurpleConversationUiOps IMInvoker::_uiConvOps = -{ +PurpleConversationUiOps IMInvoker::_uiConvOps = { NULL, //purpleCreateConversation, NULL, //purpleDestroyConversation, NULL, //purpleWriteChat, @@ -186,7 +203,7 @@ PurpleWhiteboardUiOps IMInvoker::_uiWhiteboardOps = { NULL, NULL }; - + PurpleCoreUiOps IMInvoker::_uiCoreOps = { purplePrefsInit, NULL, @@ -205,12 +222,12 @@ tthread::condition_variable IMInvoker::_initCond; tthread::recursive_mutex IMInvoker::_accountMutex; std::map<PurpleAccount*, IMInvoker*> IMInvoker::_accountInstances; - + void IMInvoker::setupPurpleSignals() { int handle; // connection signals purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, PURPLE_CALLBACK(signedOnCB), NULL); - + // conversation signals purple_signal_connect(purple_conversations_get_handle(), "conversation-created", &handle, PURPLE_CALLBACK(conversationCreatedCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "chat-joined", &handle, PURPLE_CALLBACK(chatJoinedCB), NULL); @@ -218,7 +235,7 @@ void IMInvoker::setupPurpleSignals() { purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", &handle, PURPLE_CALLBACK(buddyTypingCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "buddy-typed", &handle, PURPLE_CALLBACK(buddyTypedCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", &handle, PURPLE_CALLBACK(buddyTypingStoppedCB), NULL); - + // buddy signals purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNON)); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNOFF)); @@ -230,12 +247,12 @@ void IMInvoker::setupPurpleSignals() { purple_signal_connect(purple_blist_get_handle(), "buddy-removed", &handle, PURPLE_CALLBACK(buddyRemovedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "blist-node-aliased", &handle, PURPLE_CALLBACK(blistNodeAliasedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-caps-changed", &handle, PURPLE_CALLBACK(buddyCapsChangedCB), NULL); - + // xfer signals purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", &handle, PURPLE_CALLBACK(fileRecvRequestCB), NULL); } - + void IMInvoker::initLibPurple(void *userdata, const std::string event) { _initMutex.lock(); @@ -247,34 +264,34 @@ void IMInvoker::initLibPurple(void *userdata, const std::string event) { // g_hash_table_insert(_uiInfo, "client_type", "pc"); _gRand = g_rand_new(); - + /* Set a custom user directory (optional) */ //purple_util_set_user_dir(CUSTOM_USER_DIRECTORY); /* We do not want any debugging for now to keep the noise to a minimum. */ purple_debug_set_enabled(false); - + purple_core_set_ui_ops(&_uiCoreOps); purple_eventloop_set_ui_ops(&_uiEventLoopOps); - + purple_plugins_add_search_path("/usr/local/lib/purple-3"); // purple_plugins_probe(G_MODULE_SUFFIX); - + if (!purple_core_init("uscxml")) { LOG(ERROR) << "libpurple initialization failed." << std::endl; return; } - + /* Load the preferences. */ purple_prefs_load(); purple_plugins_load_saved("/purple/uscxml/plugins/saved"); - + GList *l; PurplePlugin *plugin; - + for (l = purple_plugins_get_all(); l != NULL; l = l->next) { plugin = (PurplePlugin *)l->data; - + Data pluginData; if (plugin->info->id) pluginData.compound["id"] = Data(plugin->info->id, Data::VERBATIM); if (plugin->info->homepage) pluginData.compound["homepage"] = Data(plugin->info->homepage, Data::VERBATIM); @@ -285,10 +302,10 @@ void IMInvoker::initLibPurple(void *userdata, const std::string event) { if (plugin->info->version) pluginData.compound["version"] = Data(plugin->info->version, Data::VERBATIM); if (plugin->info->major_version) pluginData.compound["majorVersion"] = Data(toStr(plugin->info->major_version), Data::VERBATIM); if (plugin->info->minor_version) pluginData.compound["minorVersion"] = Data(toStr(plugin->info->minor_version), Data::VERBATIM); - + if (plugin->info->type == PURPLE_PLUGIN_PROTOCOL) _pluginData.compound["protocol"].compound[plugin->info->id] = pluginData; - + } _initMutex.unlock(); @@ -314,7 +331,7 @@ void IMInvoker::signedOnCB(PurpleConnection *gc, gpointer null) { // set my status to active PurpleSavedStatus* status = purple_savedstatus_new(NULL, PURPLE_STATUS_AVAILABLE); purple_savedstatus_activate(status); - + Event retEv("im.signed.on"); inst->returnEvent(retEv); } @@ -329,40 +346,40 @@ void IMInvoker::buddyTypingStoppedCB(PurpleAccount *account, const char *name, v void IMInvoker::buddyEventCB(PurpleBuddy *buddy, PurpleBuddyEvent event) { if (!buddy) return; - + PurpleAccount *account = purple_buddy_get_account(buddy); GET_INSTANCE_IN_CALLBACK(account); if (!inst) return; switch (event) { - case PURPLE_BUDDY_SIGNOFF: - case PURPLE_BUDDY_SIGNON: { - PurplePresence* presence = purple_buddy_get_presence(buddy); - PurpleStatus* status = purple_presence_get_active_status(presence); - buddyStatusChangedCB(buddy, NULL, status, event); - break; - } - case PURPLE_BUDDY_ICON: - break; + case PURPLE_BUDDY_SIGNOFF: + case PURPLE_BUDDY_SIGNON: { + PurplePresence* presence = purple_buddy_get_presence(buddy); + PurpleStatus* status = purple_presence_get_active_status(presence); + buddyStatusChangedCB(buddy, NULL, status, event); + break; + } + case PURPLE_BUDDY_ICON: + break; - default: - break; + default: + break; } - + } void IMInvoker::buddyIdleChangedCB(PurpleBuddy *buddy, gboolean old_idle, gboolean idle, PurpleBuddyEvent event) { } - + void IMInvoker::buddyStatusChangedCB(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *newstatus, PurpleBuddyEvent event) { PurpleAccount *account = purple_buddy_get_account(buddy); GET_INSTANCE_IN_CALLBACK(account); - + std::string buddyName = purple_buddy_get_name(buddy); Data buddyData = buddyToData(buddy); inst->_dataModelVars.compound["buddies"].compound[buddyName] = buddyData; - + Event retEv("im.buddy.status.changed"); retEv.data = buddyData; inst->returnEvent(retEv); @@ -374,7 +391,7 @@ void IMInvoker::buddyAddedCB(PurpleBuddy* buddy) { GET_INSTANCE_IN_CALLBACK(account); if (!inst) return; - + std::string buddyName = purple_buddy_get_name(buddy); Event retEv("im.buddy.added"); @@ -389,11 +406,11 @@ void IMInvoker::buddyRemovedCB(PurpleBuddy* buddy) { PurpleAccount *account = purple_buddy_get_account(buddy); GET_INSTANCE_IN_CALLBACK(account); std::string buddyName = purple_buddy_get_name(buddy); - + Event retEv("im.buddy.removed"); retEv.data.compound["name"] = Data(buddyName, Data::VERBATIM); inst->returnEvent(retEv); - + inst->_dataModelVars.compound["buddies"].compound.erase(buddyName); } @@ -415,9 +432,9 @@ Data IMInvoker::statusToData(PurpleStatus *status) { Data data; const char* statusName = purple_status_get_name(status); if (statusName) data.compound["name"] = Data(statusName, Data::VERBATIM); - + PurpleStatusType* statusType = purple_status_get_type(status); - + GList *statusAttrElem; GList *statusAttrList = purple_status_type_get_attrs(statusType); PurpleStatusAttr* statusAttr; @@ -429,26 +446,26 @@ Data IMInvoker::statusToData(PurpleStatus *status) { data.compound[statusAttrId] = purpleValueToData(statusValue); } } - + data.compound["active"] = Data((bool)purple_status_is_active(status)); data.compound["available"] = Data((bool)purple_status_is_available(status)); data.compound["exclusive"] = Data((bool)purple_status_is_exclusive(status)); data.compound["active"] = Data((bool)purple_status_is_active(status)); data.compound["independent"] = Data((bool)purple_status_is_independent(status)); data.compound["online"] = Data((bool)purple_status_is_online(status)); - + return data; } Data IMInvoker::buddyToData(PurpleBuddy *buddy) { Data data; std::string buddyName = purple_buddy_get_name(buddy); - + if (purple_buddy_get_name(buddy)) data.compound["name"] = Data(purple_buddy_get_name(buddy), Data::VERBATIM); if (purple_buddy_get_alias(buddy)) data.compound["alias"] = Data(purple_buddy_get_alias(buddy), Data::VERBATIM); if (purple_buddy_get_alias_only(buddy)) data.compound["aliasOnly"] = Data(purple_buddy_get_alias_only(buddy), Data::VERBATIM); if (purple_buddy_get_server_alias(buddy)) data.compound["server"] = Data(purple_buddy_get_server_alias(buddy), Data::VERBATIM); - + PurpleGroup* group = purple_buddy_get_group(buddy); if (group) { if (purple_group_get_name(group)) data.compound["group"] = Data(purple_group_get_name(group), Data::VERBATIM); @@ -460,7 +477,7 @@ Data IMInvoker::buddyToData(PurpleBuddy *buddy) { gconstpointer iconData = purple_buddy_icon_get_data(icon, &iconSize); data.compound["icon"] = Data((char*)iconData, iconSize, false); } - + PurplePresence* presence = purple_buddy_get_presence(buddy); if (presence) { @@ -478,7 +495,7 @@ Data IMInvoker::buddyToData(PurpleBuddy *buddy) { continue; data.compound["status"].compound[statusId] = statusToData(status); } - + } return data; @@ -487,58 +504,58 @@ Data IMInvoker::buddyToData(PurpleBuddy *buddy) { Data IMInvoker::purpleValueToData(PurpleValue* value) { Data data; switch (purple_value_get_type(value)) { - case PURPLE_TYPE_BOOLEAN: - if (purple_value_get_boolean(value)) - data = Data("true"); - data = Data("false"); - break; - case PURPLE_TYPE_STRING: - if (purple_value_get_string(value)) { - data = Data(purple_value_get_string(value), Data::VERBATIM); - } - break; - case PURPLE_TYPE_CHAR: - Data(purple_value_get_char(value)); - break; - case PURPLE_TYPE_UCHAR: - Data(purple_value_get_uchar(value)); - break; - case PURPLE_TYPE_SHORT: - Data(purple_value_get_short(value)); - break; - case PURPLE_TYPE_USHORT: - Data(purple_value_get_ushort(value)); - break; - case PURPLE_TYPE_INT: - Data(purple_value_get_int(value)); - break; - case PURPLE_TYPE_UINT: - Data(purple_value_get_uint(value)); - break; - case PURPLE_TYPE_LONG: - Data(purple_value_get_long(value)); - break; - case PURPLE_TYPE_ULONG: - Data(purple_value_get_ulong(value)); - break; - case PURPLE_TYPE_INT64: - Data(purple_value_get_int64(value)); - break; - case PURPLE_TYPE_UINT64: - Data(purple_value_get_uint64(value)); - break; - case PURPLE_TYPE_OBJECT: - case PURPLE_TYPE_POINTER: - case PURPLE_TYPE_ENUM: - case PURPLE_TYPE_BOXED: - case PURPLE_TYPE_UNKNOWN: - case PURPLE_TYPE_SUBTYPE: - LOG(ERROR) << "purple thingy not supported"; - break; + case PURPLE_TYPE_BOOLEAN: + if (purple_value_get_boolean(value)) + data = Data("true"); + data = Data("false"); + break; + case PURPLE_TYPE_STRING: + if (purple_value_get_string(value)) { + data = Data(purple_value_get_string(value), Data::VERBATIM); + } + break; + case PURPLE_TYPE_CHAR: + Data(purple_value_get_char(value)); + break; + case PURPLE_TYPE_UCHAR: + Data(purple_value_get_uchar(value)); + break; + case PURPLE_TYPE_SHORT: + Data(purple_value_get_short(value)); + break; + case PURPLE_TYPE_USHORT: + Data(purple_value_get_ushort(value)); + break; + case PURPLE_TYPE_INT: + Data(purple_value_get_int(value)); + break; + case PURPLE_TYPE_UINT: + Data(purple_value_get_uint(value)); + break; + case PURPLE_TYPE_LONG: + Data(purple_value_get_long(value)); + break; + case PURPLE_TYPE_ULONG: + Data(purple_value_get_ulong(value)); + break; + case PURPLE_TYPE_INT64: + Data(purple_value_get_int64(value)); + break; + case PURPLE_TYPE_UINT64: + Data(purple_value_get_uint64(value)); + break; + case PURPLE_TYPE_OBJECT: + case PURPLE_TYPE_POINTER: + case PURPLE_TYPE_ENUM: + case PURPLE_TYPE_BOXED: + case PURPLE_TYPE_UNKNOWN: + case PURPLE_TYPE_SUBTYPE: + LOG(ERROR) << "purple thingy not supported"; + break; } return data; } - + IMInvoker::IMInvoker() { _account = NULL; if (!_eventQueue) { @@ -575,7 +592,7 @@ void IMInvoker::send(const SendRequest& req) { EventContext* ctx = new EventContext(); ctx->sendReq = req; ctx->instance = this; - + std::string eventId = UUID::getUUID(); _eventQueue->addEvent(eventId, IMInvoker::send, 0, ctx); return; @@ -592,21 +609,21 @@ void IMInvoker::send(void *userdata, const std::string event) { Data data; Event::getParam(ctx->sendReq.params, "data", data); - + // purple_conv_im_send PurpleConversation* conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, ctx->instance->_account, receiver.c_str()); purple_conv_im_send(purple_conversation_get_im_data(conv), ctx->sendReq.content.c_str()); - + if (data.binary) { PurpleConnection *gc = purple_account_get_connection(ctx->instance->_account); PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; - + if (gc) { prpl = purple_connection_get_prpl(gc); prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); - + // if (prpl_info && prpl_info->new_xfer) { // PurpleXfer* xfer = (prpl_info->new_xfer)(purple_account_get_connection(ctx->instance->_account), receiver.c_str()); // purple_xfer_set_local_filename(xfer, "/Users/sradomski/Documents/W3C Standards.pdf"); @@ -614,7 +631,7 @@ void IMInvoker::send(void *userdata, const std::string event) { // purple_xfer_request(xfer); // purple_xfer_request_accepted(xfer, "/Users/sradomski/Documents/W3C Standards.pdf"); // } - + //Set the filename // purple_xfer_set_local_filename(xfer, [[fileTransfer localFilename] UTF8String]); // purple_xfer_set_filename(xfer, [[[fileTransfer localFilename] lastPathComponent] UTF8String]); @@ -638,7 +655,7 @@ void IMInvoker::cancel(const std::string sendId) { } void IMInvoker::invoke(const InvokeRequest& req) { - + EventContext* ctx = new EventContext(); ctx->invokeReq = req; ctx->instance = this; @@ -651,20 +668,20 @@ void IMInvoker::invoke(void *userdata, const std::string event) { EventContext* ctx = (EventContext*)userdata; IMInvoker* instance = ctx->instance; - + std::string username; Event::getParam(ctx->invokeReq.params, "username", username); std::string protocolId; Event::getParam(ctx->invokeReq.params, "protocol", protocolId); std::string password; Event::getParam(ctx->invokeReq.params, "password", password); - + instance->_account = purple_account_new(username.c_str(), protocolId.c_str()); _accountInstances[instance->_account] = instance; - + purple_account_set_password(instance->_account, password.c_str(), NULL, NULL); purple_account_set_enabled(instance->_account, "uscxml", true); - + delete(ctx); _accountMutex.unlock(); } @@ -696,13 +713,13 @@ guint IMInvoker::purpleEventInputAdd(int fd, PurpleInputCondition cond, PurpleIn ctx->inputFD = fd; ctx->cond = cond; ctx->data = data; - + short opMask = 0; if (cond & PURPLE_INPUT_READ) opMask |= DelayedEventQueue::DEQ_READ; if (cond & PURPLE_INPUT_WRITE) opMask |= DelayedEventQueue::DEQ_WRITE; - + guint eventId = g_rand_int(_gRand); // std::cout << "-- Input add " << eventId << " --------" << fd << std::endl; _eventQueue->addEvent(toStr(eventId), fd, opMask, purpleCallback, ctx, true); @@ -719,7 +736,7 @@ int IMInvoker::purpleEventInputGetError(int fd, int *error) { int ret; socklen_t len; len = sizeof(*error); - + ret = getsockopt(fd, SOL_SOCKET, SO_ERROR, error, &len); if (!ret && !(*error)) { /* @@ -732,23 +749,22 @@ int IMInvoker::purpleEventInputGetError(int fd, int *error) { * Any listening socket will select for reading, and any read will fail * So, select for writing, if you can write, and the write fails, not connected */ - + { fd_set thisfd; struct timeval timeout; - + FD_ZERO(&thisfd); FD_SET(fd, &thisfd); timeout.tv_sec = 0; timeout.tv_usec = 0; select(fd+1, NULL, &thisfd, NULL, &timeout); - if(FD_ISSET(fd, &thisfd)){ + if(FD_ISSET(fd, &thisfd)) { ssize_t length = 0; char buffer[4] = {0, 0, 0, 0}; - + length = write(fd, buffer, length); - if(length == -1) - { + if(length == -1) { /* Not connected */ ret = -1; *error = ENOTCONN; @@ -756,7 +772,7 @@ int IMInvoker::purpleEventInputGetError(int fd, int *error) { } } } - + return ret; } @@ -799,36 +815,36 @@ GHashTable* IMInvoker::purpleGetUIInfo(void) { } void IMInvoker::accountNotifyAdded(PurpleAccount *account, - const char *remote_user, - const char *id, - const char *alias, - const char *message) { + const char *remote_user, + const char *id, + const char *alias, + const char *message) { std::cout << "accountNotifyAdded" << std::endl; } void IMInvoker::accountStatusChanged(PurpleAccount *account, - PurpleStatus *status) { + PurpleStatus *status) { std::cout << "accountStatusChanged" << std::endl; } void IMInvoker::accountRequestAdd(PurpleAccount *account, - const char *remote_user, - const char *id, - const char *alias, - const char *message) { + const char *remote_user, + const char *id, + const char *alias, + const char *message) { std::cout << "accountRequestAdd" << std::endl; } void* IMInvoker::accountRequestAuthorize(PurpleAccount *account, - const char *remote_user, - const char *id, - const char *alias, - const char *message, - gboolean on_list, - PurpleAccountRequestAuthorizationCb authorize_cb, - PurpleAccountRequestAuthorizationCb deny_cb, - void *user_data) { + const char *remote_user, + const char *id, + const char *alias, + const char *message, + gboolean on_list, + PurpleAccountRequestAuthorizationCb authorize_cb, + PurpleAccountRequestAuthorizationCb deny_cb, + void *user_data) { // always accept all "may I add you as a buddy?" requests authorize_cb(message, user_data); return user_data; @@ -851,10 +867,10 @@ void IMInvoker::purpleWriteConv(PurpleConversation *conv, const char *name, cons who = name; else who = NULL; - + printf("(%s) %s %s: %s\n", purple_conversation_get_name(conv), - purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)), - who, message); + purple_utf8_strftime("(%H:%M:%S)", localtime(&mtime)), + who, message); } void IMInvoker::purpleChatAddUsers(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals) {} void IMInvoker::purpleChatRenameUser(PurpleConversation *conv, const char *old_name, const char *new_name, const char *new_alias) {} @@ -964,33 +980,33 @@ void IMInvoker::purplePermitRemoved(PurpleAccount *account, const char *name) {} void IMInvoker::purpleDebyAdded(PurpleAccount *account, const char *name) {} void IMInvoker::purpleDenyRemoved(PurpleAccount *account, const char *name) {} - + // request ui operations void* IMInvoker::purpleRequestInput(const char *title, const char *primary, - const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data) { + const char *secondary, const char *default_value, + gboolean multiline, gboolean masked, gchar *hint, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data) { return NULL; } void* IMInvoker::purpleRequestChoice(const char *title, const char *primary, - const char *secondary, gpointer default_value, - const char *ok_text, GCallback ok_cb, const char *cancel_text, - GCallback cancel_cb, PurpleRequestCommonParameters *cpar, - void *user_data, va_list choices) { + const char *secondary, gpointer default_value, + const char *ok_text, GCallback ok_cb, const char *cancel_text, + GCallback cancel_cb, PurpleRequestCommonParameters *cpar, + void *user_data, va_list choices) { return NULL; } void* IMInvoker::purpleRequestAction(const char *title, const char *primary, - const char *secondary, int default_action, - PurpleRequestCommonParameters *cpar, void *user_data, - size_t action_count, va_list actions) { + const char *secondary, int default_action, + PurpleRequestCommonParameters *cpar, void *user_data, + size_t action_count, va_list actions) { return NULL; } void* IMInvoker::purpleRequestWait(const char *title, const char *primary, - const char *secondary, gboolean with_progress, - PurpleRequestCancelCb cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data) { + const char *secondary, gboolean with_progress, + PurpleRequestCancelCb cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data) { return NULL; } @@ -998,15 +1014,15 @@ void IMInvoker::purpleRequestWaitUpdate(void *ui_handle, gboolean pulse, gfloat } void* IMInvoker::purpleRequestFields(const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data) { + const char *secondary, PurpleRequestFields *fields, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data) { return NULL; } void* IMInvoker::purpleRequestFile(const char *title, const char *filename, - gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data) { + gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data) { // click ok PurpleXfer *xfer = (PurpleXfer *)user_data; PurpleXferType xferType = purple_xfer_get_type(xfer); @@ -1023,8 +1039,8 @@ void* IMInvoker::purpleRequestFile(const char *title, const char *filename, } void* IMInvoker::purpleRequestFolder(const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data) { + GCallback ok_cb, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data) { return NULL; } @@ -1060,5 +1076,5 @@ gboolean IMInvoker::purpleDebugIsEnabled(PurpleDebugLevel level, const char *cat return true; } - + }
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/im/IMInvoker.h b/src/uscxml/plugins/invoker/im/IMInvoker.h index 51af8f8..25cbdd3 100644 --- a/src/uscxml/plugins/invoker/im/IMInvoker.h +++ b/src/uscxml/plugins/invoker/im/IMInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 IMINVOKER_H_FNWG0XCQ #define IMINVOKER_H_FNWG0XCQ @@ -6,7 +25,7 @@ extern "C" { #include <libpurple/purple.h> } - + #ifdef BUILD_AS_PLUGINS #include "uscxml/plugins/Plugins.h" #endif @@ -14,17 +33,17 @@ extern "C" { namespace uscxml { typedef enum { - PURPLE_BUDDY_NONE = 0x00, /**< No events. */ - PURPLE_BUDDY_SIGNON = 0x01, /**< The buddy signed on. */ - PURPLE_BUDDY_SIGNOFF = 0x02, /**< The buddy signed off. */ - PURPLE_BUDDY_INFO_UPDATED = 0x10, /**< The buddy's information (profile) changed. */ - PURPLE_BUDDY_ICON = 0x40, /**< The buddy's icon changed. */ - PURPLE_BUDDY_MISCELLANEOUS = 0x80, /**< The buddy's service-specific miscalleneous info changed. */ - PURPLE_BUDDY_SIGNON_TIME = 0x11, /**< The buddy's signon time changed. */ - PURPLE_BUDDY_EVIL = 0x12, /**< The buddy's warning level changed. */ - PURPLE_BUDDY_DIRECTIM_CONNECTED = 0x14, /**< Connected to the buddy via DirectIM. */ - PURPLE_BUDDY_DIRECTIM_DISCONNECTED = 0x18, /**< Disconnected from the buddy via DirectIM. */ - PURPLE_BUDDY_NAME = 0x20 /**<Buddy name (UID) changed. */ + PURPLE_BUDDY_NONE = 0x00, /**< No events. */ + PURPLE_BUDDY_SIGNON = 0x01, /**< The buddy signed on. */ + PURPLE_BUDDY_SIGNOFF = 0x02, /**< The buddy signed off. */ + PURPLE_BUDDY_INFO_UPDATED = 0x10, /**< The buddy's information (profile) changed. */ + PURPLE_BUDDY_ICON = 0x40, /**< The buddy's icon changed. */ + PURPLE_BUDDY_MISCELLANEOUS = 0x80, /**< The buddy's service-specific miscalleneous info changed. */ + PURPLE_BUDDY_SIGNON_TIME = 0x11, /**< The buddy's signon time changed. */ + PURPLE_BUDDY_EVIL = 0x12, /**< The buddy's warning level changed. */ + PURPLE_BUDDY_DIRECTIM_CONNECTED = 0x14, /**< Connected to the buddy via DirectIM. */ + PURPLE_BUDDY_DIRECTIM_DISCONNECTED = 0x18, /**< Disconnected from the buddy via DirectIM. */ + PURPLE_BUDDY_NAME = 0x20 /**<Buddy name (UID) changed. */ } PurpleBuddyEvent; class IMInvoker : public InvokerImpl { @@ -34,7 +53,7 @@ public: SendRequest sendReq; IMInvoker* instance; }; - + IMInvoker(); virtual ~IMInvoker(); virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter); @@ -55,13 +74,13 @@ public: private: static bool _libPurpleIsInitialized; static Data _pluginData; - + Data _dataModelVars; static Data buddyToData(PurpleBuddy *buddy); static Data statusToData(PurpleStatus *status); static Data purpleValueToData(PurpleValue* value); - + static PurpleAccountUiOps _uiAccountOps; static PurpleEventLoopUiOps _uiEventLoopOps; static PurpleCoreUiOps _uiCoreOps; @@ -74,7 +93,7 @@ private: static PurpleConnectionUiOps _uiConnectOps; static PurpleWhiteboardUiOps _uiWhiteboardOps; static PurpleDebugUiOps _uiDebugOps; - + static PurpleRequestFeature _features; static GHashTable* _uiInfo; static GRand* _gRand; @@ -84,7 +103,7 @@ private: static tthread::mutex _initMutex; static tthread::condition_variable _initCond; static DelayedEventQueue* _eventQueue; - + // libpurple event callbacks static void signedOnCB(PurpleConnection *gc, gpointer null); static void conversationCreatedCB(PurpleConversation *conv, void *data); @@ -101,7 +120,7 @@ private: static void buddyRemovedCB(PurpleBuddy* buddy); static void fileRecvRequestCB(PurpleXfer *xfer); static void buddyCapsChangedCB(PurpleBuddy* buddy, PurpleMediaCaps newcaps, PurpleMediaCaps oldcaps); - + // these are only being called from the delayed queue's thread static void initLibPurple(void *userdata, const std::string event); static void setupPurpleSignals(); @@ -126,12 +145,12 @@ private: gpointer data; }; static void purpleCallback(void *userdata, const std::string event); - + // libpurple debug static void purpleDebugPrint(PurpleDebugLevel level, const char *category, const char *arg_s); static gboolean purpleDebugIsEnabled(PurpleDebugLevel level, const char *category); - + // libpurple core operations static void purplePrefsInit(void); static void purpleDebugInit(void); @@ -155,7 +174,7 @@ private: static void purpleCustomSmileyWrite(PurpleConversation *conv, const char *smile, const guchar *data, gsize size); static void purpleCustomSmileyClose(PurpleConversation *conv, const char *smile); static void purpleSendConfirm(PurpleConversation *conv, const char *message); - + // buddy operations static void purpleNewList(PurpleBuddyList *list); static void purpleNewNode(PurpleBlistNode *node); @@ -193,7 +212,7 @@ private: static void* purpeNotifyUserInfo(PurpleConnection *gc, const char *who, PurpleNotifyUserInfo *user_info); static void* purpeNotifyURI(const char *uri); static void purpeNotifyClose(PurpleNotifyType type, void *ui_handle); - + // account operations static void accountNotifyAdded(PurpleAccount *account, const char *remote_user, const char *id, const char *alias, const char *message); static void accountStatusChanged(PurpleAccount *account, PurpleStatus *status); @@ -209,40 +228,40 @@ private: // request ui operations static void* purpleRequestInput(const char *title, const char *primary, - const char *secondary, const char *default_value, - gboolean multiline, gboolean masked, gchar *hint, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data); + const char *secondary, const char *default_value, + gboolean multiline, gboolean masked, gchar *hint, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data); static void* purpleRequestChoice(const char *title, const char *primary, - const char *secondary, gpointer default_value, - const char *ok_text, GCallback ok_cb, const char *cancel_text, - GCallback cancel_cb, PurpleRequestCommonParameters *cpar, - void *user_data, va_list choices); + const char *secondary, gpointer default_value, + const char *ok_text, GCallback ok_cb, const char *cancel_text, + GCallback cancel_cb, PurpleRequestCommonParameters *cpar, + void *user_data, va_list choices); static void* purpleRequestAction(const char *title, const char *primary, - const char *secondary, int default_action, - PurpleRequestCommonParameters *cpar, void *user_data, - size_t action_count, va_list actions); + const char *secondary, int default_action, + PurpleRequestCommonParameters *cpar, void *user_data, + size_t action_count, va_list actions); static void* purpleRequestWait(const char *title, const char *primary, - const char *secondary, gboolean with_progress, - PurpleRequestCancelCb cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data); + const char *secondary, gboolean with_progress, + PurpleRequestCancelCb cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data); static void purpleRequestWaitUpdate(void *ui_handle, gboolean pulse, gfloat fraction); static void* purpleRequestFields(const char *title, const char *primary, - const char *secondary, PurpleRequestFields *fields, - const char *ok_text, GCallback ok_cb, - const char *cancel_text, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data); + const char *secondary, PurpleRequestFields *fields, + const char *ok_text, GCallback ok_cb, + const char *cancel_text, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data); static void* purpleRequestFile(const char *title, const char *filename, - gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data); + gboolean savedialog, GCallback ok_cb, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data); static void* purpleRequestFolder(const char *title, const char *dirname, - GCallback ok_cb, GCallback cancel_cb, - PurpleRequestCommonParameters *cpar, void *user_data); + GCallback ok_cb, GCallback cancel_cb, + PurpleRequestCommonParameters *cpar, void *user_data); static void purpleRequestClose(PurpleRequestType type, void *ui_handle); - + // connection ui operations static void purpleConnectProgress(PurpleConnection *gc, const char *text, size_t step, size_t step_count); static void purpleConnected(PurpleConnection *gc); @@ -251,8 +270,8 @@ private: static void purpleNetworkConnected(void); static void purpleNetworkDisconnected(void); static void purpleReportDisconnect(PurpleConnection *gc, PurpleConnectionError reason, const char *text); - - + + // whiteboard ui operations static void purpleCreateWB(PurpleWhiteboard *wb); static void purpleDestroyWB(PurpleWhiteboard *wb); @@ -261,7 +280,7 @@ private: static void purpleDrawPont(PurpleWhiteboard *wb, int x, int y, int color, int size); static void purpleDrawLine(PurpleWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size); static void purpleClearWB(PurpleWhiteboard *wb); - + PurpleAccount* _account; }; diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp index 3a3354a..196211a 100644 --- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp +++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "MilesSessionInvoker.h" #include <glog/logging.h> @@ -11,7 +30,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new MilesSessionInvokerProvider() ); return true; } @@ -41,10 +60,10 @@ void MilesSessionInvoker::send(const SendRequest& req) { if (boost::iequals(req.name, "disconnect")) { std::string reflectorIP = "127.0.0.1"; Event::getParam(req.params, "reflectorip", reflectorIP); - + std::string problemName = "Generic"; Event::getParam(req.params, "problemname", problemName); - + int rv; rv = miles_disconnect_reflector_session((char*)reflectorIP.c_str(), (char*)problemName.c_str()); if (!rv) { @@ -60,31 +79,31 @@ void MilesSessionInvoker::send(const SendRequest& req) { imageURL2.toAbsolute(_interpreter->getBaseURI()); std::stringstream ssImage; - + if (alternate) { ssImage << imageURL1; } else { ssImage << imageURL2; } alternate = !alternate; - + std::string imageContent = ssImage.str(); - + Event retEv; retEv.data.compound["base64"] = Data(base64_encode(imageContent.data(), imageContent.size()), Data::VERBATIM); std::string origin; Event::getParam(req.params, "origin", origin); retEv.data.compound["origin"] = origin; - + tthread::this_thread::sleep_for(tthread::chrono::milliseconds(20)); - + returnEvent(retEv); - + } else if (boost::iequals(req.name, "connect")) { std::string email = "someSaneDefault"; Event::getParam(req.params, "email", email); - + std::string reflectorIP = "127.0.0.1"; Event::getParam(req.params, "reflectorip", reflectorIP); diff --git a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h index c28f2cc..bd86c5b 100644 --- a/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h +++ b/src/uscxml/plugins/invoker/miles/MilesSessionInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 MILESSESIONINVOKER_H_W09J90F0 #define MILESSESIONINVOKER_H_W09J90F0 @@ -40,7 +59,7 @@ public: protected: bool alternate; // this is to alternate test1 an test2.jpeg and has no other use! remove me later .. - + int video_rtp_in_socket, audio_rtp_in_socket; int video_rtp_out_socket, audio_rtp_out_socket; int video_rtcp_in_socket, audio_rtcp_in_socket; diff --git a/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp.old b/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp.old index 9a26960..2f8e032 100644 --- a/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp.old +++ b/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp.old @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "uscxml/Common.h" #include "SpatialAudio.h" #include "uscxml/Interpreter.h" @@ -14,7 +33,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new SpatialAudioProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/miles/SpatialAudio.h.old b/src/uscxml/plugins/invoker/miles/SpatialAudio.h.old index e7ab830..d6ca285 100644 --- a/src/uscxml/plugins/invoker/miles/SpatialAudio.h.old +++ b/src/uscxml/plugins/invoker/miles/SpatialAudio.h.old @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 SPATIALAUDIO_H_EH11SAQC #define SPATIALAUDIO_H_EH11SAQC diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp index bb17370..0777c62 100644 --- a/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp +++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "SampleInvoker.h" #include <glog/logging.h> @@ -9,7 +28,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new SampleInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/sample/SampleInvoker.h b/src/uscxml/plugins/invoker/sample/SampleInvoker.h index 30297b2..16e4df1 100644 --- a/src/uscxml/plugins/invoker/sample/SampleInvoker.h +++ b/src/uscxml/plugins/invoker/sample/SampleInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 SAMPLEINVOKER_H_W09J90F0 #define SAMPLEINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp index 85c4b9c..05ea460 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "USCXMLInvoker.h" #include <glog/logging.h> @@ -9,13 +28,14 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new USCXMLInvokerProvider() ); return true; } #endif USCXMLInvoker::USCXMLInvoker() : _cancelled(false) { + _parentQueue._invoker = this; } @@ -62,7 +82,7 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { if (dataModel) { } - _invokedInterpreter.getImpl()->setParentQueue(this); + _invokedInterpreter.getImpl()->setParentQueue(&_parentQueue); // transfer namespace prefixes _invokedInterpreter.getImpl()->_nsURL = _parentInterpreter->_nsURL; _invokedInterpreter.getImpl()->_xpathPrefix = _parentInterpreter->_xpathPrefix; @@ -86,13 +106,13 @@ void USCXMLInvoker::invoke(const InvokeRequest& req) { } } -void USCXMLInvoker::push(const SendRequest& event) { +void USCXMLInvoker::ParentQueue::push(const SendRequest& event) { // test 252 - if (_cancelled) + if (_invoker->_cancelled) return; SendRequest copyEvent(event); - copyEvent.invokeid = _invokeId; - _parentInterpreter->receive(copyEvent); + copyEvent.invokeid = _invoker->_invokeId; + _invoker->_parentInterpreter->receive(copyEvent); } }
\ No newline at end of file diff --git a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h index 896eaa3..7c0e217 100644 --- a/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h +++ b/src/uscxml/plugins/invoker/scxml/USCXMLInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 USCXMLINVOKER_H_OQFA21IO #define USCXMLINVOKER_H_OQFA21IO @@ -12,12 +31,19 @@ namespace uscxml { class Interpreter; - +class USCXMLInvoker; + class USCXMLInvoker : public InvokerImpl, - public uscxml::concurrency::BlockingQueue<SendRequest>, public boost::enable_shared_from_this<USCXMLInvoker> { public: + class ParentQueue : public concurrency::BlockingQueue<SendRequest> { + public: + ParentQueue() {} + virtual void push(const SendRequest& event); + USCXMLInvoker* _invoker; + }; + USCXMLInvoker(); virtual ~USCXMLInvoker(); virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter); @@ -34,11 +60,10 @@ public: virtual void send(const SendRequest& req); virtual void cancel(const std::string sendId); virtual void invoke(const InvokeRequest& req); - - virtual void push(const SendRequest& event); - + protected: bool _cancelled; + ParentQueue _parentQueue; Interpreter _invokedInterpreter; InterpreterImpl* _parentInterpreter; }; diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp index db65ab8..debe371 100644 --- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp +++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "Sqlite3Invoker.h" #include <glog/logging.h> @@ -9,7 +28,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new Sqlite3InvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h index b3a9fd7..e024fd7 100644 --- a/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h +++ b/src/uscxml/plugins/invoker/sqlite3/Sqlite3Invoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 SQLITE3INVOKER_H_W09J90F0 #define SQLITE3INVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp index d306cb9..c5f574f 100644 --- a/src/uscxml/plugins/invoker/system/SystemInvoker.cpp +++ b/src/uscxml/plugins/invoker/system/SystemInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "SystemInvoker.h" #include <glog/logging.h> @@ -9,7 +28,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add(new SystemInvokerProvider()); return true; } diff --git a/src/uscxml/plugins/invoker/system/SystemInvoker.h b/src/uscxml/plugins/invoker/system/SystemInvoker.h index 78903f6..5be04eb 100644 --- a/src/uscxml/plugins/invoker/system/SystemInvoker.h +++ b/src/uscxml/plugins/invoker/system/SystemInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 SYSTEMINVOKER_H_W09J90F0 #define SYSTEMINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp index 6845280..b1776d9 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "UmundoInvoker.h" #include <glog/logging.h> #include "uscxml/URL.h" @@ -10,7 +29,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new UmundoInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h index c013a52..4b28bfe 100644 --- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h +++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 UMUNDOINVOKER_H_77YXQGU7 #define UMUNDOINVOKER_H_77YXQGU7 diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp index c0d3329..573920f 100644 --- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 "VoiceXMLInvoker.h" #include <glog/logging.h> @@ -9,7 +28,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new VoiceXMLInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h index d89382e..f354927 100644 --- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h +++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 VOICEXMLINVOKER_H_W09J90F0 #define VOICEXMLINVOKER_H_W09J90F0 diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp index acbf085..0952b13 100644 --- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp +++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 <uscxml/config.h> #include "XHTMLInvoker.h" #include <glog/logging.h> @@ -20,7 +39,7 @@ namespace uscxml { #ifdef BUILD_AS_PLUGINS PLUMA_CONNECTOR -bool connect(pluma::Host& host) { +bool pluginConnect(pluma::Host& host) { host.add( new XHTMLInvokerProvider() ); return true; } diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h index e94c4fd..03b9116 100644 --- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h +++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.h @@ -1,3 +1,22 @@ +/** + * @file + * @author 2012-2013 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 XHTMLINVOKER_H_W09J90F0 #define XHTMLINVOKER_H_W09J90F0 |