summaryrefslogtreecommitdiffstats
path: root/src/uscxml/plugins/invoker
diff options
context:
space:
mode:
Diffstat (limited to 'src/uscxml/plugins/invoker')
-rw-r--r--src/uscxml/plugins/invoker/CMakeLists.txt21
-rw-r--r--src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp583
-rw-r--r--src/uscxml/plugins/invoker/calendar/CalendarInvoker.h39
-rw-r--r--src/uscxml/plugins/invoker/location/LocationInvoker.cpp44
-rw-r--r--src/uscxml/plugins/invoker/location/LocationInvoker.h40
-rw-r--r--src/uscxml/plugins/invoker/miles/SpatialAudio.cpp6
-rw-r--r--src/uscxml/plugins/invoker/umundo/JSON.pb.h458
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp22
-rw-r--r--src/uscxml/plugins/invoker/umundo/UmundoInvoker.h2
-rw-r--r--src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp2
-rw-r--r--src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp10
11 files changed, 894 insertions, 333 deletions
diff --git a/src/uscxml/plugins/invoker/CMakeLists.txt b/src/uscxml/plugins/invoker/CMakeLists.txt
index 67d356a..4f13aaf 100644
--- a/src/uscxml/plugins/invoker/CMakeLists.txt
+++ b/src/uscxml/plugins/invoker/CMakeLists.txt
@@ -147,6 +147,27 @@ if (LIBICAL_FOUND)
endif()
+# location invoker
+
+if (CORELOCATION_LIBRARY AND OFF)
+ file(GLOB_RECURSE LOCATION_INVOKER
+ location/CoreLocation/*.cpp
+ location/CoreLocation/*.mm
+ location/CoreLocation/*.h
+ )
+ source_group("Invoker\\location" FILES ${LOCATION_INVOKER})
+ if (BUILD_AS_PLUGINS)
+ add_library(
+ invoker_location SHARED
+ ${LOCATION_INVOKER})
+ target_link_libraries(invoker_location uscxml)
+ set_target_properties(invoker_location PROPERTIES FOLDER "Plugin Invoker")
+ else()
+ list (APPEND USCXML_FILES ${LOCATION_INVOKER})
+ endif()
+endif()
+
+
# UMUNDO invoker
if (UMUNDO_FOUND)
diff --git a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp
index 7ea3fc3..947c86c 100644
--- a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp
+++ b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.cpp
@@ -16,14 +16,42 @@ bool connect(pluma::Host& host) {
#endif
CalendarInvoker::CalendarInvoker() {
+ _icalSet = NULL;
+ _icalComp = NULL;
}
CalendarInvoker::~CalendarInvoker() {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::set<std::string>::iterator _eventIdIter = _eventIds.begin();
+ while(_eventIdIter != _eventIds.end()) {
+ _interpreter->getDelayQueue()->cancelEvent(*_eventIdIter);
+ _eventIds.erase(_eventIdIter++);
+
+ }
+
+ std::map<std::string, CalendarEvent*>::iterator eventIter = _events.begin();
+ while(eventIter != _events.end()) {
+ delete eventIter->second;
+ eventIter++;
+ }
+
+ if (_icalComp)
+ icalcomponent_free(_icalComp);
};
boost::shared_ptr<InvokerImpl> CalendarInvoker::create(InterpreterImpl* interpreter) {
boost::shared_ptr<CalendarInvoker> invoker = boost::shared_ptr<CalendarInvoker>(new CalendarInvoker());
invoker->_interpreter = interpreter;
+
+ icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL);
+
+// invoker->_calFile = URL::tmpFile();
+// invoker->_icalSet = icalfileset_new(invoker->_calFile.c_str());
+
+// if (!invoker->_icalSet) {
+// LOG(WARNING) << "Could not create new ical fileset: " << icalerror_perror();
+// }
+
return invoker;
}
@@ -33,12 +61,567 @@ Data CalendarInvoker::getDataModelVariables() {
}
void CalendarInvoker::send(const SendRequest& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
}
void CalendarInvoker::cancel(const std::string sendId) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+ std::set<std::string>::iterator _eventIdIter = _eventIds.begin();
+ while(_eventIdIter != _eventIds.end()) {
+ _interpreter->getDelayQueue()->cancelEvent(*_eventIdIter);
+ _eventIds.erase(_eventIdIter++);
+ }
}
void CalendarInvoker::invoke(const InvokeRequest& req) {
+ tthread::lock_guard<tthread::recursive_mutex> lock(_mutex);
+
+ _icalComp = addIcal(req.content);
+// dumpComponent(_icalComp);
+ setupEvents(_icalComp);
+
+}
+
+icalcomponent* CalendarInvoker::addIcal(const std::string& icalString) {
+
+ icalcomponent* root = icalparser_parse_string(icalString.c_str());
+ if (!root) {
+ LOG(WARNING) << "Could not parse ical data: " << icalerror_perror();
+ return NULL;
+ }
+// icalerrorenum err;
+// err = icalset_add_component(_icalSet, root);
+// icalfileset_commit(_icalSet);
+
+ return root;
+}
+
+void CalendarInvoker::setupEvents(icalcomponent* comp) {
+// dumpComponent(comp);
+
+ switch (icalcomponent_isa(comp)) {
+ case ICAL_VCALENDAR_COMPONENT:
+ case ICAL_XROOT_COMPONENT:
+ break;
+ case ICAL_VALARM_COMPONENT: {
+ break;
+ }
+ case ICAL_VEVENT_COMPONENT: {
+ // event to map
+ CalendarEvent* event = new CalendarEvent(comp);
+ _events[toStr((uintptr_t)event)] = event;
+ queueEvent(event);
+ break;
+ }
+ default:
+// dumpComponent(comp);
+ break;
+ }
+
+ icalcomponent* child = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
+ while(child) {
+ setupEvents(child);
+ child = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT);
+ }
+
+}
+
+void CalendarInvoker::queueEvent(CalendarEvent* event) {
+ if (_events.find(toStr((uintptr_t)event)) == _events.end()) {
+ _events[toStr((uintptr_t)event)] = event;
+ }
+ time_t now = time(NULL);
+ struct icaltime_span span;
+
+ if (event->_nextSpan.start > 0) {
+ span = event->getNextDuration(event->_nextSpan.start + 1);
+ } else {
+ span = event->getNextDuration(now);
+ }
+
+#if 0
+ if (span.end > 0) {
+ std::cout << "\t\t" << ctime(&span.start);
+ std::cout << "\t\t" << ctime(&span.end);
+ span = event->getNextDuration(span.end);
+ }
+#endif
+
+ if (span.start <= 0 || span.end <= 0) {
+ event->_nextSpan.start = 0;
+ event->_nextSpan.end = 0;
+ return;
+ }
+
+ int beginSecs = span.start - now;
+ int endSecs = span.end - now;
+
+ if (beginSecs > endSecs) {
+ LOG(WARNING) << "Event ends before it starts";
+ return;
+ }
+
+ event->_nextSpan = span;
+
+ std::string beginEventId = event->getId() + "." + toStr(span.start) + ".started";
+ std::string endEventId = event->getId() + "." + toStr(span.end) + ".ended";
+
+#if 1
+ beginSecs = 1;
+ endSecs = 2;
+#endif
+ if (beginSecs > 0) {
+ _interpreter->getDelayQueue()->addEvent(beginEventId, CalendarInvoker::raiseEvent, beginSecs * 1000, this);
+ _eventIds.insert(beginEventId);
+ } else {
+ raiseEvent(this, beginEventId);
+ }
+ _interpreter->getDelayQueue()->addEvent(endEventId, CalendarInvoker::raiseEvent, endSecs * 1000, this);
+ _eventIds.insert(endEventId);
+
+}
+
+void CalendarInvoker::raiseEvent(void* userdata, const std::string eventId) {
+ CalendarInvoker* INSTANCE = (CalendarInvoker*)userdata;
+ tthread::lock_guard<tthread::recursive_mutex> lock(INSTANCE->_mutex);
+
+ std::string address = eventId.substr(0, eventId.find_first_of("."));
+
+ if (INSTANCE->_events.find(address) == INSTANCE->_events.end()) {
+ LOG(WARNING) << "No such event: " << eventId;
+ return;
+ }
+
+ if(INSTANCE->_eventIds.find(eventId) != INSTANCE->_eventIds.end()) {
+ INSTANCE->_eventIds.erase(eventId);
+ }
+
+ CalendarEvent* calEvent = INSTANCE->_events[address];
+ Event event;
+
+ event.data = *calEvent;
+ if (boost::ends_with(eventId, ".started")) {
+ event.name = "event.started." + calEvent->getId();
+ assert(!calEvent->_active);
+ calEvent->_active = true;
+ } else {
+ event.name = "event.ended." + calEvent->getId();
+ assert(calEvent->_active);
+ calEvent->_active = false;
+ }
+ INSTANCE->returnEvent(event);
+
+ // event ended, reschedule next event
+ if (boost::ends_with(eventId, ".ended"))
+ INSTANCE->queueEvent(calEvent);
}
+/**
+ * Get the next duration for this event starting no earlier
+ * than the given time.
+ */
+icaltime_span CalendarEvent::getNextDuration(time_t time) {
+ if (!_icalComp)
+ return icaltime_span_new(icaltime_null_time(), icaltime_null_time(), 0);
+
+ // see icalcomponent_foreach_recurrence
+ icalproperty *rrule;
+
+ icaltimetype calTime = icaltime_from_timet_with_zone(time, 0, 0);
+
+ // actual occurence, without reocurrence
+ if (!icalproperty_recurrence_is_excluded(_icalComp, &_dtstart, &_dtend)) {
+ if (icaltime_compare(_dtstart, calTime) >= 0) {
+ // start is still in the future
+ return icaltime_span_new(_dtstart, _dtend, 0);
+ }
+ }
+
+ icaltime_span recDur = icaltime_span_new(icaltime_null_time(), icaltime_null_time(), 0);
+
+ // iterate all rrules
+ for (rrule = icalcomponent_get_first_property(_icalComp, ICAL_RRULE_PROPERTY);
+ rrule != NULL;
+ rrule = icalcomponent_get_next_property(_icalComp, ICAL_RRULE_PROPERTY)) {
+
+ struct icalrecurrencetype recurType = icalproperty_get_rrule(rrule);
+ icalrecur_iterator *ritr;
+ struct icaltimetype rtime;
+
+ // do we have an old iterator that has not yet passed time?
+ if (_recIters.find(rrule) != _recIters.end()) {
+ if (_recIters[rrule].second > time) {
+ icalrecur_iterator_free(_recIters[rrule].first);
+ _recIters[rrule].first = icalrecur_iterator_new(recurType, _dtstart);
+
+ // skip initial non-reoccurence
+ if(_recIters[rrule].first)
+ rtime = icalrecur_iterator_next(_recIters[rrule].first);
+
+ }
+ ritr = _recIters[rrule].first;
+ } else {
+ // create a new iterator for this rrule
+ _recIters[rrule] = std::make_pair(icalrecur_iterator_new(recurType, _dtstart), 0);
+ ritr = _recIters[rrule].first;
+ }
+
+// std::cout << icalrecurrencetype_as_string(&recurType) << std::endl;
+
+ while (ritr) {
+ rtime = icalrecur_iterator_next(ritr);
+
+#if 0
+ time_t tt = icaltime_as_timet(rtime);
+ std::cout << "\t\t" << ctime(&tt);
+#endif
+
+ if (icaltime_is_null_time(rtime)) {
+ // remove iterator
+ icalrecur_iterator_free(_recIters[rrule].first);
+ _recIters.erase(rrule);
+ break; // for next rule
+ }
+ _recIters[rrule].second = icaltime_as_timet(rtime);
+
+ if (icaltime_compare(rtime, calTime) < 0)
+ continue; // until we are after given time
+
+ if (icalproperty_recurrence_is_excluded(_icalComp, &_dtstart, &rtime))
+ continue;
+
+ icaltime_span thisDur = icaltime_span_new(rtime, rtime, 1);
+ thisDur.end += _dtduration;
+
+ if (recDur.start == 0 || thisDur.start < recDur.start) {
+ // update soonest reoccurence with the one from this rule
+ recDur = thisDur;
+ }
+ break; // we are after the event
+ }
+ }
+ return recDur;
+}
+
+CalendarEvent::~CalendarEvent() {
+ std::map<icalproperty*, std::pair<icalrecur_iterator*, time_t> >::iterator recItersIter = _recIters.begin();
+ while(recItersIter != _recIters.end()) {
+ icalrecur_iterator_free(recItersIter->second.first);
+ recItersIter++;
+ }
+}
+
+CalendarEvent::CalendarEvent(icalcomponent* icalComp) {
+ _nextSpan.start = 0;
+ _nextSpan.end = 0;
+ _icalComp = NULL;
+ _active = false;
+
+
+ _dtstart = icalcomponent_get_dtstart(icalComp);
+ _dtend = icalcomponent_get_dtend(icalComp);
+
+ if (!icaltime_is_valid_time(_dtstart)) {
+ LOG(WARNING) << "Start of event not a valid time";
+ return;
+ }
+
+ if (!icaltime_is_valid_time(_dtend)) {
+ LOG(WARNING) << "End of event not a valid time";
+ return;
+ }
+
+ _dtduration = icaldurationtype_as_int(icaltime_subtract(_dtend, _dtstart));
+
+ if (_dtduration <= 0) {
+ LOG(WARNING) << "Event has negative or zero duration";
+ return;
+ }
+
+ _icalComp = icalComp;
+
+ // initialize all iterators - not really needed anymore
+ for (icalproperty* rrule = icalcomponent_get_first_property(_icalComp, ICAL_RRULE_PROPERTY);
+ rrule != NULL;
+ rrule = icalcomponent_get_next_property(_icalComp, ICAL_RRULE_PROPERTY)) {
+
+ struct icalrecurrencetype recurType = icalproperty_get_rrule(rrule);
+ icalrecur_iterator *ritr = icalrecur_iterator_new(recurType, _dtstart);
+
+ _recIters[rrule] = std::make_pair(ritr, 0);
+ }
+
+
+}
+
+CalendarEvent::operator Data() {
+ Data data;
+ data = CalendarInvoker::toData(_icalComp);
+ return data;
+}
+
+Data CalendarInvoker::toData(icalcomponent* comp) {
+ Data data;
+ data.compound["kind"] = Data(icalcomponent_kind_to_string(icalcomponent_isa(comp)), Data::VERBATIM);
+
+ // iterate all properties
+ icalproperty* prop = icalcomponent_get_first_property(comp, ICAL_ANY_PROPERTY);
+ while(prop) {
+ std::string propName = icalproperty_kind_to_string(icalproperty_isa(prop));
+ boost::to_lower(propName);
+
+#if 0
+ // iterate all parameters
+ icalparameter* para = icalproperty_get_first_parameter(prop, ICAL_ANY_PARAMETER);
+ while(para) {
+ std::string paraName = icalparameter_kind_to_string(icalparameter_isa(para));
+
+ switch(icalparameter_get_value(para)) {
+ case ICAL_VALUE_X:
+ data.compound[propName].compound[paraName] = Data(icalparameter_get_x(para), Data::VERBATIM);
+ break;
+ case ICAL_VALUE_BOOLEAN:
+ case ICAL_VALUE_BINARY:
+ case ICAL_VALUE_DATE:
+ case ICAL_VALUE_DURATION:
+ case ICAL_VALUE_FLOAT:
+ case ICAL_VALUE_INTEGER:
+ case ICAL_VALUE_PERIOD:
+ case ICAL_VALUE_RECUR:
+ case ICAL_VALUE_TEXT:
+ case ICAL_VALUE_URI:
+ case ICAL_VALUE_ERROR:
+ case ICAL_VALUE_DATETIME:
+ case ICAL_VALUE_UTCOFFSET:
+ case ICAL_VALUE_CALADDRESS:
+ case ICAL_VALUE_NONE:
+ data.compound[propName].compound[paraName] = Data("", Data::VERBATIM);
+ break;
+ }
+
+ para = icalproperty_get_next_parameter(prop, ICAL_ANY_PARAMETER);
+ }
+ data.compound[propName].compound["value"] = Data(icalproperty_get_value_as_string(prop), Data::VERBATIM);
+#endif
+#if 0
+ data.compound[propName] = Data(icalproperty_as_ical_string(prop), Data::VERBATIM);
+#endif
+ data.compound[propName] = Data(icalproperty_get_value_as_string(prop), Data::VERBATIM);
+
+ prop = icalcomponent_get_next_property(comp, ICAL_ANY_PROPERTY);
+ }
+
+
+ icalcomponent* child = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
+ while(child) {
+ data.compound["childs"].array.push_back(toData(child));
+ child = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT);
+ }
+
+ return data;
+}
+
+void CalendarInvoker::dumpComponent(icalcomponent* comp) {
+ std::cout << icalcomponent_kind_to_string(icalcomponent_isa(comp)) << std::endl;
+
+ struct icaltimetype start, end;
+ time_t tt;
+
+ icalproperty *startProp = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
+ if (startProp) {
+ start = icalproperty_get_dtstart(startProp);
+ }
+
+ icalproperty *endProp = icalcomponent_get_first_property(comp, ICAL_DTEND_PROPERTY);
+ if (endProp) {
+ end = icalproperty_get_dtend(endProp);
+ }
+
+ icalproperty *prop = icalcomponent_get_first_property(comp, ICAL_ANY_PROPERTY);
+
+ while(prop) {
+ std::cout << "\t" << icalproperty_kind_to_string(icalproperty_isa(prop)) << std::endl;
+ switch (icalproperty_isa(prop)) {
+ case ICAL_ANY_PROPERTY:
+ case ICAL_ACKNOWLEDGED_PROPERTY:
+ case ICAL_ACTION_PROPERTY:
+ case ICAL_ALLOWCONFLICT_PROPERTY:
+ case ICAL_ATTACH_PROPERTY:
+ case ICAL_ATTENDEE_PROPERTY:
+ case ICAL_CALID_PROPERTY:
+ case ICAL_CALMASTER_PROPERTY:
+ case ICAL_CALSCALE_PROPERTY:
+ case ICAL_CAPVERSION_PROPERTY:
+ case ICAL_CARLEVEL_PROPERTY:
+ case ICAL_CARID_PROPERTY:
+ case ICAL_CATEGORIES_PROPERTY:
+ case ICAL_CLASS_PROPERTY:
+ case ICAL_CMD_PROPERTY:
+ case ICAL_COMMENT_PROPERTY:
+ case ICAL_COMPLETED_PROPERTY:
+ case ICAL_COMPONENTS_PROPERTY:
+ case ICAL_CONTACT_PROPERTY:
+ case ICAL_CREATED_PROPERTY:
+ case ICAL_CSID_PROPERTY:
+ case ICAL_DATEMAX_PROPERTY:
+ case ICAL_DATEMIN_PROPERTY:
+ case ICAL_DECREED_PROPERTY:
+ case ICAL_DEFAULTCHARSET_PROPERTY:
+ case ICAL_DEFAULTLOCALE_PROPERTY:
+ case ICAL_DEFAULTTZID_PROPERTY:
+ case ICAL_DEFAULTVCARS_PROPERTY:
+ case ICAL_DENY_PROPERTY:
+ break;
+ case ICAL_DESCRIPTION_PROPERTY:
+ std::cout << "\t\t" << icalproperty_get_description(prop) << std::endl;
+ break;
+ case ICAL_DTEND_PROPERTY: {
+ end = icalproperty_get_dtend(prop);
+ tt = icaltime_as_timet(start);
+ std::cout << "\t\t" << ctime(&tt) << std::endl;
+ break;
+ }
+ case ICAL_DTSTAMP_PROPERTY:
+ break;
+ case ICAL_DTSTART_PROPERTY: {
+ start = icalproperty_get_dtstart(prop);
+ tt = icaltime_as_timet(start);
+ std::cout << "\t\t" << ctime(&tt) << std::endl;
+ break;
+ }
+ case ICAL_DUE_PROPERTY:
+ case ICAL_DURATION_PROPERTY:
+ case ICAL_EXDATE_PROPERTY:
+ case ICAL_EXPAND_PROPERTY:
+ case ICAL_EXRULE_PROPERTY:
+ case ICAL_FREEBUSY_PROPERTY:
+ case ICAL_GEO_PROPERTY:
+ case ICAL_GRANT_PROPERTY:
+ case ICAL_ITIPVERSION_PROPERTY:
+ case ICAL_LASTMODIFIED_PROPERTY:
+ case ICAL_LOCATION_PROPERTY:
+ case ICAL_MAXCOMPONENTSIZE_PROPERTY:
+ case ICAL_MAXDATE_PROPERTY:
+ case ICAL_MAXRESULTS_PROPERTY:
+ case ICAL_MAXRESULTSSIZE_PROPERTY:
+ case ICAL_METHOD_PROPERTY:
+ case ICAL_MINDATE_PROPERTY:
+ case ICAL_MULTIPART_PROPERTY:
+ case ICAL_NAME_PROPERTY:
+ case ICAL_ORGANIZER_PROPERTY:
+ case ICAL_OWNER_PROPERTY:
+ case ICAL_PERCENTCOMPLETE_PROPERTY:
+ case ICAL_PERMISSION_PROPERTY:
+ case ICAL_PRIORITY_PROPERTY:
+ case ICAL_PRODID_PROPERTY:
+ case ICAL_QUERY_PROPERTY:
+ case ICAL_QUERYLEVEL_PROPERTY:
+ case ICAL_QUERYID_PROPERTY:
+ case ICAL_QUERYNAME_PROPERTY:
+ case ICAL_RDATE_PROPERTY:
+ case ICAL_RECURACCEPTED_PROPERTY:
+ case ICAL_RECUREXPAND_PROPERTY:
+ case ICAL_RECURLIMIT_PROPERTY:
+ case ICAL_RECURRENCEID_PROPERTY:
+ case ICAL_RELATEDTO_PROPERTY:
+ case ICAL_RELCALID_PROPERTY:
+ case ICAL_REPEAT_PROPERTY:
+ case ICAL_REQUESTSTATUS_PROPERTY:
+ case ICAL_RESOURCES_PROPERTY:
+ case ICAL_RESTRICTION_PROPERTY:
+ break;
+ case ICAL_RRULE_PROPERTY: {
+ // struct icaltimetype start = icaltime_from_timet(1,0);
+ // struct icaltimetype start = icalproperty_get_dtstart(icalcomponent_get_first_property(comp,ICAL_DTSTART_PROPERTY));
+
+ // struct icaltimetype end = icaltime_today();
+ struct icalrecurrencetype recur = icalproperty_get_rrule(prop);
+ struct icaltimetype next;
+
+ icalrecur_iterator* ritr;
+ for(ritr = icalrecur_iterator_new(recur,start),
+ next = icalrecur_iterator_next(ritr);
+ !icaltime_is_null_time(next);
+ next = icalrecur_iterator_next(ritr)) {
+
+ tt = icaltime_as_timet(next);
+ printf(" %s",ctime(&tt ));
+
+ }
+ icalrecur_iterator_free(ritr);
+
+ break;
+ }
+ case ICAL_SCOPE_PROPERTY:
+ case ICAL_SEQUENCE_PROPERTY:
+ case ICAL_STATUS_PROPERTY:
+ case ICAL_STORESEXPANDED_PROPERTY:
+ case ICAL_SUMMARY_PROPERTY:
+ case ICAL_TARGET_PROPERTY:
+ case ICAL_TRANSP_PROPERTY:
+ case ICAL_TRIGGER_PROPERTY:
+ case ICAL_TZID_PROPERTY:
+ case ICAL_TZNAME_PROPERTY:
+ case ICAL_TZOFFSETFROM_PROPERTY:
+ case ICAL_TZOFFSETTO_PROPERTY:
+ case ICAL_TZURL_PROPERTY:
+ case ICAL_UID_PROPERTY:
+ case ICAL_URL_PROPERTY:
+ case ICAL_VERSION_PROPERTY:
+ case ICAL_X_PROPERTY:
+ case ICAL_XLICCLASS_PROPERTY:
+ case ICAL_XLICCLUSTERCOUNT_PROPERTY:
+ case ICAL_XLICERROR_PROPERTY:
+ case ICAL_XLICMIMECHARSET_PROPERTY:
+ case ICAL_XLICMIMECID_PROPERTY:
+ case ICAL_XLICMIMECONTENTTYPE_PROPERTY:
+ case ICAL_XLICMIMEENCODING_PROPERTY:
+ case ICAL_XLICMIMEFILENAME_PROPERTY:
+ case ICAL_XLICMIMEOPTINFO_PROPERTY:
+ case ICAL_NO_PROPERTY:
+ break;
+ }
+ prop = icalcomponent_get_next_property(comp, ICAL_ANY_PROPERTY);
+ }
+
+ switch (icalcomponent_isa(comp)) {
+ case ICAL_NO_COMPONENT:
+ case ICAL_ANY_COMPONENT:
+ break;
+ case ICAL_XROOT_COMPONENT: {
+ icalcomponent* child = icalcomponent_get_first_component(comp, ICAL_ANY_COMPONENT);
+ while(child) {
+ dumpComponent(child);
+ child = icalcomponent_get_next_component(comp, ICAL_ANY_COMPONENT);
+ }
+ break;
+ }
+ case ICAL_XATTACH_COMPONENT:
+ case ICAL_VEVENT_COMPONENT:
+ case ICAL_VTODO_COMPONENT:
+ case ICAL_VJOURNAL_COMPONENT:
+ case ICAL_VCALENDAR_COMPONENT:
+ case ICAL_VAGENDA_COMPONENT:
+ case ICAL_VFREEBUSY_COMPONENT:
+ case ICAL_VALARM_COMPONENT:
+ case ICAL_XAUDIOALARM_COMPONENT:
+ case ICAL_XDISPLAYALARM_COMPONENT:
+ case ICAL_XEMAILALARM_COMPONENT:
+ case ICAL_XPROCEDUREALARM_COMPONENT:
+ case ICAL_VTIMEZONE_COMPONENT:
+ case ICAL_XSTANDARD_COMPONENT:
+ case ICAL_XDAYLIGHT_COMPONENT:
+ case ICAL_X_COMPONENT:
+ case ICAL_VSCHEDULE_COMPONENT:
+ case ICAL_VQUERY_COMPONENT:
+ case ICAL_VREPLY_COMPONENT:
+ case ICAL_VCAR_COMPONENT:
+ case ICAL_VCOMMAND_COMPONENT:
+ case ICAL_XLICINVALID_COMPONENT:
+ case ICAL_XLICMIMEPART_COMPONENT:
+ break;
+ }
+}
+
+
} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h
index 45dc8d0..3faf570 100644
--- a/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h
+++ b/src/uscxml/plugins/invoker/calendar/CalendarInvoker.h
@@ -2,6 +2,10 @@
#define CALENDARINVOKER_H_W09J90F0
#include <uscxml/Interpreter.h>
+extern "C" {
+# include <libical/ical.h>
+# include <libical/icalss.h>
+}
#ifdef BUILD_AS_PLUGINS
#include "uscxml/plugins/Plugins.h"
@@ -9,6 +13,25 @@
namespace uscxml {
+class CalendarEvent {
+public:
+ CalendarEvent(icalcomponent* _icalComp);
+ ~CalendarEvent();
+ icalcomponent* _icalComp;
+ icaltime_span _nextSpan;
+ bool _active;
+ struct icaltimetype _dtstart, _dtend;
+ time_t _dtduration;
+
+ icaltime_span getNextDuration(time_t time);
+ std::string getId() {
+ return toStr((uintptr_t)this);
+ }
+
+ std::map<icalproperty*, std::pair<icalrecur_iterator*, time_t> > _recIters;
+ operator Data();
+};
+
class CalendarInvoker : public InvokerImpl {
public:
CalendarInvoker();
@@ -27,7 +50,23 @@ public:
virtual void cancel(const std::string sendId);
virtual void invoke(const InvokeRequest& req);
+ static void raiseEvent(void* userdata, const std::string eventId);
+ static Data toData(icalcomponent* comp);
protected:
+ icalcomponent* addIcal(const std::string& icalString);
+ void setupEvents(icalcomponent* comp);
+ void queueEvent(CalendarEvent* event);
+
+ void dumpComponent(icalcomponent* comp);
+
+ tthread::recursive_mutex _mutex;
+
+ std::string _calFile;
+ icalset* _icalSet;
+ icalcomponent* _icalComp;
+
+ std::set<std::string> _eventIds;
+ std::map<std::string, CalendarEvent*> _events;
};
#ifdef BUILD_AS_PLUGINS
diff --git a/src/uscxml/plugins/invoker/location/LocationInvoker.cpp b/src/uscxml/plugins/invoker/location/LocationInvoker.cpp
deleted file mode 100644
index 9aeb6b4..0000000
--- a/src/uscxml/plugins/invoker/location/LocationInvoker.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-#include "LocationInvoker.h"
-#include <glog/logging.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include <Pluma/Connector.hpp>
-#endif
-
-namespace uscxml {
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_CONNECTOR
-bool connect(pluma::Host& host) {
- host.add( new LocationInvokerProvider() );
- return true;
-}
-#endif
-
-LocationInvoker::LocationInvoker() {
-}
-
-LocationInvoker::~LocationInvoker() {
-};
-
-boost::shared_ptr<InvokerImpl> LocationInvoker::create(InterpreterImpl* interpreter) {
- boost::shared_ptr<LocationInvoker> invoker = boost::shared_ptr<LocationInvoker>(new LocationInvoker());
- invoker->_interpreter = interpreter;
- return invoker;
-}
-
-Data LocationInvoker::getDataModelVariables() {
- Data data;
- return data;
-}
-
-void LocationInvoker::send(const SendRequest& req) {
-}
-
-void LocationInvoker::cancel(const std::string sendId) {
-}
-
-void LocationInvoker::invoke(const InvokeRequest& req) {
-}
-
-} \ No newline at end of file
diff --git a/src/uscxml/plugins/invoker/location/LocationInvoker.h b/src/uscxml/plugins/invoker/location/LocationInvoker.h
deleted file mode 100644
index 2eb4833..0000000
--- a/src/uscxml/plugins/invoker/location/LocationInvoker.h
+++ /dev/null
@@ -1,40 +0,0 @@
-#ifndef LOCATIONINVOKER_H_W09J90F0
-#define LOCATIONINVOKER_H_W09J90F0
-
-#include <uscxml/Interpreter.h>
-
-#ifdef BUILD_AS_PLUGINS
-#include "uscxml/plugins/Plugins.h"
-#endif
-
-namespace uscxml {
-
-class LocationInvoker : public InvokerImpl {
-public:
- LocationInvoker();
- virtual ~LocationInvoker();
- virtual boost::shared_ptr<InvokerImpl> create(InterpreterImpl* interpreter);
-
- virtual std::set<std::string> getNames() {
- std::set<std::string> names;
- names.insert("location");
- names.insert("http://uscxml.tk.informatik.tu-darmstadt.de/#location");
- return names;
- }
-
- virtual Data getDataModelVariables();
- virtual void send(const SendRequest& req);
- virtual void cancel(const std::string sendId);
- virtual void invoke(const InvokeRequest& req);
-
-protected:
-};
-
-#ifdef BUILD_AS_PLUGINS
-PLUMA_INHERIT_PROVIDER(LocationInvoker, InvokerImpl);
-#endif
-
-}
-
-
-#endif /* end of include guard: LOCATIONINVOKER_H_W09J90F0 */
diff --git a/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp b/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp
index 298b15f..fb91e40 100644
--- a/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp
+++ b/src/uscxml/plugins/invoker/miles/SpatialAudio.cpp
@@ -70,11 +70,11 @@ void SpatialAudio::send(const SendRequest& req) {
miles_audio_device_control(MILES_AUDIO_IO_OPENAL, _audioDev, MILES_AUDIO_DEVICE_CTRL_SET_POSITION, _pos);
-
+
char* buffer = (char*)malloc(_audioDev->chunk_size);
// skip wav header
_dataStream.seekg(44);
-
+
while(_dataStream.readsome(buffer, _audioDev->chunk_size) != 0) {
int written = 0;
while(written < _audioDev->chunk_size) {
@@ -187,7 +187,7 @@ void SpatialAudio::getPosFromParams(const std::multimap<std::string, std::string
} catch (boost::bad_lexical_cast& e) {
LOG(ERROR) << "Cannot interpret circle as float value in params: " << e.what();
}
-
+
position[0] = position[0] / _maxPos[0];
position[1] = position[1] / _maxPos[1];
position[2] = position[2] / _maxPos[2];
diff --git a/src/uscxml/plugins/invoker/umundo/JSON.pb.h b/src/uscxml/plugins/invoker/umundo/JSON.pb.h
index fe4ee57..a8125bf 100644
--- a/src/uscxml/plugins/invoker/umundo/JSON.pb.h
+++ b/src/uscxml/plugins/invoker/umundo/JSON.pb.h
@@ -36,127 +36,129 @@ class JSONProto;
// ===================================================================
class JSONProto : public ::google::protobuf::Message {
- public:
- JSONProto();
- virtual ~JSONProto();
-
- JSONProto(const JSONProto& from);
-
- inline JSONProto& operator=(const JSONProto& from) {
- CopyFrom(from);
- return *this;
- }
-
- inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
- return _unknown_fields_;
- }
-
- inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
- return &_unknown_fields_;
- }
-
- static const ::google::protobuf::Descriptor* descriptor();
- static const JSONProto& default_instance();
-
- void Swap(JSONProto* other);
-
- // implements Message ----------------------------------------------
-
- JSONProto* New() const;
- void CopyFrom(const ::google::protobuf::Message& from);
- void MergeFrom(const ::google::protobuf::Message& from);
- void CopyFrom(const JSONProto& from);
- void MergeFrom(const JSONProto& from);
- void Clear();
- bool IsInitialized() const;
-
- int ByteSize() const;
- bool MergePartialFromCodedStream(
- ::google::protobuf::io::CodedInputStream* input);
- void SerializeWithCachedSizes(
- ::google::protobuf::io::CodedOutputStream* output) const;
- ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
- int GetCachedSize() const { return _cached_size_; }
- private:
- void SharedCtor();
- void SharedDtor();
- void SetCachedSize(int size) const;
- public:
-
- ::google::protobuf::Metadata GetMetadata() const;
-
- // nested types ----------------------------------------------------
-
- // accessors -------------------------------------------------------
-
- // repeated .JSONProto compound = 1;
- inline int compound_size() const;
- inline void clear_compound();
- static const int kCompoundFieldNumber = 1;
- inline const ::JSONProto& compound(int index) const;
- inline ::JSONProto* mutable_compound(int index);
- inline ::JSONProto* add_compound();
- inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
- compound() const;
- inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
- mutable_compound();
-
- // optional string key = 2;
- inline bool has_key() const;
- inline void clear_key();
- static const int kKeyFieldNumber = 2;
- inline const ::std::string& key() const;
- inline void set_key(const ::std::string& value);
- inline void set_key(const char* value);
- inline void set_key(const char* value, size_t size);
- inline ::std::string* mutable_key();
- inline ::std::string* release_key();
- inline void set_allocated_key(::std::string* key);
-
- // optional string atom = 3;
- inline bool has_atom() const;
- inline void clear_atom();
- static const int kAtomFieldNumber = 3;
- inline const ::std::string& atom() const;
- inline void set_atom(const ::std::string& value);
- inline void set_atom(const char* value);
- inline void set_atom(const char* value, size_t size);
- inline ::std::string* mutable_atom();
- inline ::std::string* release_atom();
- inline void set_allocated_atom(::std::string* atom);
-
- // optional bool verbatim = 4;
- inline bool has_verbatim() const;
- inline void clear_verbatim();
- static const int kVerbatimFieldNumber = 4;
- inline bool verbatim() const;
- inline void set_verbatim(bool value);
-
- // @@protoc_insertion_point(class_scope:JSONProto)
- private:
- inline void set_has_key();
- inline void clear_has_key();
- inline void set_has_atom();
- inline void clear_has_atom();
- inline void set_has_verbatim();
- inline void clear_has_verbatim();
-
- ::google::protobuf::UnknownFieldSet _unknown_fields_;
-
- ::google::protobuf::RepeatedPtrField< ::JSONProto > compound_;
- ::std::string* key_;
- ::std::string* atom_;
- bool verbatim_;
-
- mutable int _cached_size_;
- ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
-
- friend void protobuf_AddDesc_JSON_2eproto();
- friend void protobuf_AssignDesc_JSON_2eproto();
- friend void protobuf_ShutdownFile_JSON_2eproto();
-
- void InitAsDefaultInstance();
- static JSONProto* default_instance_;
+public:
+ JSONProto();
+ virtual ~JSONProto();
+
+ JSONProto(const JSONProto& from);
+
+ inline JSONProto& operator=(const JSONProto& from) {
+ CopyFrom(from);
+ return *this;
+ }
+
+ inline const ::google::protobuf::UnknownFieldSet& unknown_fields() const {
+ return _unknown_fields_;
+ }
+
+ inline ::google::protobuf::UnknownFieldSet* mutable_unknown_fields() {
+ return &_unknown_fields_;
+ }
+
+ static const ::google::protobuf::Descriptor* descriptor();
+ static const JSONProto& default_instance();
+
+ void Swap(JSONProto* other);
+
+ // implements Message ----------------------------------------------
+
+ JSONProto* New() const;
+ void CopyFrom(const ::google::protobuf::Message& from);
+ void MergeFrom(const ::google::protobuf::Message& from);
+ void CopyFrom(const JSONProto& from);
+ void MergeFrom(const JSONProto& from);
+ void Clear();
+ bool IsInitialized() const;
+
+ int ByteSize() const;
+ bool MergePartialFromCodedStream(
+ ::google::protobuf::io::CodedInputStream* input);
+ void SerializeWithCachedSizes(
+ ::google::protobuf::io::CodedOutputStream* output) const;
+ ::google::protobuf::uint8* SerializeWithCachedSizesToArray(::google::protobuf::uint8* output) const;
+ int GetCachedSize() const {
+ return _cached_size_;
+ }
+private:
+ void SharedCtor();
+ void SharedDtor();
+ void SetCachedSize(int size) const;
+public:
+
+ ::google::protobuf::Metadata GetMetadata() const;
+
+ // nested types ----------------------------------------------------
+
+ // accessors -------------------------------------------------------
+
+ // repeated .JSONProto compound = 1;
+ inline int compound_size() const;
+ inline void clear_compound();
+ static const int kCompoundFieldNumber = 1;
+ inline const ::JSONProto& compound(int index) const;
+ inline ::JSONProto* mutable_compound(int index);
+ inline ::JSONProto* add_compound();
+ inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
+ compound() const;
+ inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
+ mutable_compound();
+
+ // optional string key = 2;
+ inline bool has_key() const;
+ inline void clear_key();
+ static const int kKeyFieldNumber = 2;
+ inline const ::std::string& key() const;
+ inline void set_key(const ::std::string& value);
+ inline void set_key(const char* value);
+ inline void set_key(const char* value, size_t size);
+ inline ::std::string* mutable_key();
+ inline ::std::string* release_key();
+ inline void set_allocated_key(::std::string* key);
+
+ // optional string atom = 3;
+ inline bool has_atom() const;
+ inline void clear_atom();
+ static const int kAtomFieldNumber = 3;
+ inline const ::std::string& atom() const;
+ inline void set_atom(const ::std::string& value);
+ inline void set_atom(const char* value);
+ inline void set_atom(const char* value, size_t size);
+ inline ::std::string* mutable_atom();
+ inline ::std::string* release_atom();
+ inline void set_allocated_atom(::std::string* atom);
+
+ // optional bool verbatim = 4;
+ inline bool has_verbatim() const;
+ inline void clear_verbatim();
+ static const int kVerbatimFieldNumber = 4;
+ inline bool verbatim() const;
+ inline void set_verbatim(bool value);
+
+ // @@protoc_insertion_point(class_scope:JSONProto)
+private:
+ inline void set_has_key();
+ inline void clear_has_key();
+ inline void set_has_atom();
+ inline void clear_has_atom();
+ inline void set_has_verbatim();
+ inline void clear_has_verbatim();
+
+ ::google::protobuf::UnknownFieldSet _unknown_fields_;
+
+ ::google::protobuf::RepeatedPtrField< ::JSONProto > compound_;
+ ::std::string* key_;
+ ::std::string* atom_;
+ bool verbatim_;
+
+ mutable int _cached_size_;
+ ::google::protobuf::uint32 _has_bits_[(4 + 31) / 32];
+
+ friend void protobuf_AddDesc_JSON_2eproto();
+ friend void protobuf_AssignDesc_JSON_2eproto();
+ friend void protobuf_ShutdownFile_JSON_2eproto();
+
+ void InitAsDefaultInstance();
+ static JSONProto* default_instance_;
};
// ===================================================================
@@ -167,189 +169,189 @@ class JSONProto : public ::google::protobuf::Message {
// repeated .JSONProto compound = 1;
inline int JSONProto::compound_size() const {
- return compound_.size();
+ return compound_.size();
}
inline void JSONProto::clear_compound() {
- compound_.Clear();
+ compound_.Clear();
}
inline const ::JSONProto& JSONProto::compound(int index) const {
- return compound_.Get(index);
+ return compound_.Get(index);
}
inline ::JSONProto* JSONProto::mutable_compound(int index) {
- return compound_.Mutable(index);
+ return compound_.Mutable(index);
}
inline ::JSONProto* JSONProto::add_compound() {
- return compound_.Add();
+ return compound_.Add();
}
inline const ::google::protobuf::RepeatedPtrField< ::JSONProto >&
JSONProto::compound() const {
- return compound_;
+ return compound_;
}
inline ::google::protobuf::RepeatedPtrField< ::JSONProto >*
JSONProto::mutable_compound() {
- return &compound_;
+ return &compound_;
}
// optional string key = 2;
inline bool JSONProto::has_key() const {
- return (_has_bits_[0] & 0x00000002u) != 0;
+ return (_has_bits_[0] & 0x00000002u) != 0;
}
inline void JSONProto::set_has_key() {
- _has_bits_[0] |= 0x00000002u;
+ _has_bits_[0] |= 0x00000002u;
}
inline void JSONProto::clear_has_key() {
- _has_bits_[0] &= ~0x00000002u;
+ _has_bits_[0] &= ~0x00000002u;
}
inline void JSONProto::clear_key() {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- key_->clear();
- }
- clear_has_key();
+ if (key_ != &::google::protobuf::internal::kEmptyString) {
+ key_->clear();
+ }
+ clear_has_key();
}
inline const ::std::string& JSONProto::key() const {
- return *key_;
+ return *key_;
}
inline void JSONProto::set_key(const ::std::string& value) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(value);
+ set_has_key();
+ if (key_ == &::google::protobuf::internal::kEmptyString) {
+ key_ = new ::std::string;
+ }
+ key_->assign(value);
}
inline void JSONProto::set_key(const char* value) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(value);
+ set_has_key();
+ if (key_ == &::google::protobuf::internal::kEmptyString) {
+ key_ = new ::std::string;
+ }
+ key_->assign(value);
}
inline void JSONProto::set_key(const char* value, size_t size) {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- key_->assign(reinterpret_cast<const char*>(value), size);
+ set_has_key();
+ if (key_ == &::google::protobuf::internal::kEmptyString) {
+ key_ = new ::std::string;
+ }
+ key_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* JSONProto::mutable_key() {
- set_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- key_ = new ::std::string;
- }
- return key_;
+ set_has_key();
+ if (key_ == &::google::protobuf::internal::kEmptyString) {
+ key_ = new ::std::string;
+ }
+ return key_;
}
inline ::std::string* JSONProto::release_key() {
- clear_has_key();
- if (key_ == &::google::protobuf::internal::kEmptyString) {
- return NULL;
- } else {
- ::std::string* temp = key_;
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- return temp;
- }
+ clear_has_key();
+ if (key_ == &::google::protobuf::internal::kEmptyString) {
+ return NULL;
+ } else {
+ ::std::string* temp = key_;
+ key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ return temp;
+ }
}
inline void JSONProto::set_allocated_key(::std::string* key) {
- if (key_ != &::google::protobuf::internal::kEmptyString) {
- delete key_;
- }
- if (key) {
- set_has_key();
- key_ = key;
- } else {
- clear_has_key();
- key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- }
+ if (key_ != &::google::protobuf::internal::kEmptyString) {
+ delete key_;
+ }
+ if (key) {
+ set_has_key();
+ key_ = key;
+ } else {
+ clear_has_key();
+ key_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ }
}
// optional string atom = 3;
inline bool JSONProto::has_atom() const {
- return (_has_bits_[0] & 0x00000004u) != 0;
+ return (_has_bits_[0] & 0x00000004u) != 0;
}
inline void JSONProto::set_has_atom() {
- _has_bits_[0] |= 0x00000004u;
+ _has_bits_[0] |= 0x00000004u;
}
inline void JSONProto::clear_has_atom() {
- _has_bits_[0] &= ~0x00000004u;
+ _has_bits_[0] &= ~0x00000004u;
}
inline void JSONProto::clear_atom() {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- atom_->clear();
- }
- clear_has_atom();
+ if (atom_ != &::google::protobuf::internal::kEmptyString) {
+ atom_->clear();
+ }
+ clear_has_atom();
}
inline const ::std::string& JSONProto::atom() const {
- return *atom_;
+ return *atom_;
}
inline void JSONProto::set_atom(const ::std::string& value) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(value);
+ set_has_atom();
+ if (atom_ == &::google::protobuf::internal::kEmptyString) {
+ atom_ = new ::std::string;
+ }
+ atom_->assign(value);
}
inline void JSONProto::set_atom(const char* value) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(value);
+ set_has_atom();
+ if (atom_ == &::google::protobuf::internal::kEmptyString) {
+ atom_ = new ::std::string;
+ }
+ atom_->assign(value);
}
inline void JSONProto::set_atom(const char* value, size_t size) {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- atom_->assign(reinterpret_cast<const char*>(value), size);
+ set_has_atom();
+ if (atom_ == &::google::protobuf::internal::kEmptyString) {
+ atom_ = new ::std::string;
+ }
+ atom_->assign(reinterpret_cast<const char*>(value), size);
}
inline ::std::string* JSONProto::mutable_atom() {
- set_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- atom_ = new ::std::string;
- }
- return atom_;
+ set_has_atom();
+ if (atom_ == &::google::protobuf::internal::kEmptyString) {
+ atom_ = new ::std::string;
+ }
+ return atom_;
}
inline ::std::string* JSONProto::release_atom() {
- clear_has_atom();
- if (atom_ == &::google::protobuf::internal::kEmptyString) {
- return NULL;
- } else {
- ::std::string* temp = atom_;
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- return temp;
- }
+ clear_has_atom();
+ if (atom_ == &::google::protobuf::internal::kEmptyString) {
+ return NULL;
+ } else {
+ ::std::string* temp = atom_;
+ atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ return temp;
+ }
}
inline void JSONProto::set_allocated_atom(::std::string* atom) {
- if (atom_ != &::google::protobuf::internal::kEmptyString) {
- delete atom_;
- }
- if (atom) {
- set_has_atom();
- atom_ = atom;
- } else {
- clear_has_atom();
- atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
- }
+ if (atom_ != &::google::protobuf::internal::kEmptyString) {
+ delete atom_;
+ }
+ if (atom) {
+ set_has_atom();
+ atom_ = atom;
+ } else {
+ clear_has_atom();
+ atom_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
+ }
}
// optional bool verbatim = 4;
inline bool JSONProto::has_verbatim() const {
- return (_has_bits_[0] & 0x00000008u) != 0;
+ return (_has_bits_[0] & 0x00000008u) != 0;
}
inline void JSONProto::set_has_verbatim() {
- _has_bits_[0] |= 0x00000008u;
+ _has_bits_[0] |= 0x00000008u;
}
inline void JSONProto::clear_has_verbatim() {
- _has_bits_[0] &= ~0x00000008u;
+ _has_bits_[0] &= ~0x00000008u;
}
inline void JSONProto::clear_verbatim() {
- verbatim_ = false;
- clear_has_verbatim();
+ verbatim_ = false;
+ clear_has_verbatim();
}
inline bool JSONProto::verbatim() const {
- return verbatim_;
+ return verbatim_;
}
inline void JSONProto::set_verbatim(bool value) {
- set_has_verbatim();
- verbatim_ = value;
+ set_has_verbatim();
+ verbatim_ = value;
}
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
index 081842f..bbfdabd 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.cpp
@@ -59,12 +59,12 @@ void UmundoInvoker::send(const SendRequest& req) {
LOG(ERROR) << "Cannot transform content to data object per datamodel";
return;
}
-
+
std::string type;
if (req.params.find("type") != req.params.end()) {
// we are supposed to build a typed object
type = req.params.find("type")->second;
-
+
const google::protobuf::Message* protoMsg = umundo::PBSerializer::getProto(type);
if (protoMsg == NULL) {
LOG(ERROR) << "No type '" << type << "' is known, pass a directory with proto .desc files via types param when invoking";
@@ -76,7 +76,7 @@ void UmundoInvoker::send(const SendRequest& req) {
LOG(ERROR) << "Cannot create message from JSON - not sending";
return;
}
-
+
if (!_isService) {
// add all s11n properties
_pub->prepareMsg(&msg, type, pbMsg);
@@ -90,12 +90,12 @@ void UmundoInvoker::send(const SendRequest& req) {
void* rv = NULL;
stub->callStubMethod(req.name, pbMsg, type, rv, "");
protobufToData(event.data, *(const google::protobuf::Message*)rv);
-
+
event.name = _invokeId + ".reply." + req.name;
event.origin = msg.getMeta("um.channel");
event.origintype = "umundo";
event.type = Event::EXTERNAL;
-
+
returnEvent(event);
svcIter++;
}
@@ -116,7 +116,7 @@ void UmundoInvoker::send(const SendRequest& req) {
LOG(ERROR) << "Cannot invoke services with untyped JSON";
return;
}
-
+
}
} catch (Event e) {
LOG(ERROR) << "Syntax error when invoking umundo:" << std::endl << e << std::endl;
@@ -125,7 +125,7 @@ void UmundoInvoker::send(const SendRequest& req) {
} else {
LOG(ERROR) << "Required JSON object in content" << std::endl;
return;
- }
+ }
}
void UmundoInvoker::cancel(const std::string sendId) {
@@ -187,7 +187,7 @@ void UmundoInvoker::invoke(const InvokeRequest& req) {
_pub->setGreeter(this);
_sub->registerType("JSON", new JSONProto());
-
+
_node->addPublisher(*_pub);
_node->addSubscriber(*_sub);
@@ -237,7 +237,7 @@ void UmundoInvoker::receive(void* object, umundo::Message* msg) {
if (object != NULL) {
if (msg->getMeta().find("um.s11n.type") != msg->getMeta().end() &&
- boost::equals(msg->getMeta().find("um.s11n.type")->second, "JSON")) {
+ boost::equals(msg->getMeta().find("um.s11n.type")->second, "JSON")) {
jsonbufToData(event.data, *(JSONProto*)object);
} else {
protobufToData(event.data, *(const google::protobuf::Message*)object);
@@ -349,7 +349,7 @@ bool UmundoInvoker::jsonbufToData(Data& data, const JSONProto& json) {
data.type = Data::INTERPRETED;
}
}
-
+
return true;
}
@@ -485,7 +485,7 @@ bool UmundoInvoker::dataToJSONbuf(JSONProto* msg, Data& data) {
} else if (!data.array.empty()) {
const google::protobuf::FieldDescriptor* fieldDesc = desc->FindFieldByName("compound");
- std::list<Data>::iterator arrayIter = data.array.begin();
+ std::list<Data>::iterator arrayIter = data.array.begin();
while(arrayIter != data.array.end()) {
JSONProto* arrayMsg = (JSONProto*)reflect->AddMessage(msg, fieldDesc);
dataToJSONbuf(arrayMsg, *arrayIter);
diff --git a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
index 4d81e79..c013a52 100644
--- a/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
+++ b/src/uscxml/plugins/invoker/umundo/UmundoInvoker.h
@@ -18,7 +18,7 @@ namespace uscxml {
class Interpreter;
- class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public umundo::ResultSet<umundo::ServiceDescription>, public umundo::TypedGreeter {
+class UmundoInvoker : public InvokerImpl, public umundo::TypedReceiver, public umundo::ResultSet<umundo::ServiceDescription>, public umundo::TypedGreeter {
public:
UmundoInvoker();
virtual ~UmundoInvoker();
diff --git a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
index a18be8e..ddca2eb 100644
--- a/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/vxml/VoiceXMLInvoker.cpp
@@ -61,7 +61,7 @@ void VoiceXMLInvoker::send(const SendRequest& req) {
domSS << req.getFirstDOMElement();
start.content = domSS.str();
_interpreter->getDataModel().replaceExpressions(start.content);
-
+
start.requestId = "asdf";
start.source = "asdf";
start.target = "umundo://mmi/jvoicexml";
diff --git a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
index 4e2c01a..82e0a48 100644
--- a/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
+++ b/src/uscxml/plugins/invoker/xhtml/XHTMLInvoker.cpp
@@ -92,7 +92,7 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) {
} else if(_invokeReq.data) {
ss << _invokeReq.data;
content = ss.str();
- } else if (_invokeReq.content.length() > 0){
+ } else if (_invokeReq.content.length() > 0) {
content = _invokeReq.content;
} else {
URL templateURL("templates/xhtml-invoker.html");
@@ -100,10 +100,10 @@ bool XHTMLInvoker::httpRecvRequest(const HTTPServer::Request& req) {
templateURL.download(true);
content = templateURL.getInContent();
}
-
+
_interpreter->getDataModel().replaceExpressions(content);
reply.content = content;
-
+
// application/xhtml+xml
reply.headers["Content-Type"] = "text/html; charset=utf-8";
// reply.headers["Content-Type"] = "application/xhtml+xml; charset=utf-8";
@@ -140,7 +140,7 @@ void XHTMLInvoker::send(const SendRequest& req) {
if (json) {
reqCopy.data = json;
}
-
+
if (!_longPoll) {
_outQueue.push_back(reqCopy);
return;
@@ -154,7 +154,7 @@ void XHTMLInvoker::reply(const SendRequest& req, const HTTPServer::Request& long
// is there JSON in the content?
std::string content = req.content;
-
+
if (req.dom) {
std::stringstream ss;
Arabica::DOM::Node<std::string> content = req.dom.getDocumentElement();