[dss-commits] r8806 - in dss/trunk: core webservices
dss-commits at forum.digitalstrom.org
dss-commits at forum.digitalstrom.org
Tue Sep 29 09:02:21 CEST 2009
Author: pstaehlin
Date: 2009-09-29 09:02:21 +0200 (Tue, 29 Sep 2009)
New Revision: 8806
Modified:
dss/trunk/core/dss.cpp
dss/trunk/webservices/model_soap.cpp
dss/trunk/webservices/webservices.cpp
Log:
Make event subscriptions really work.
Closes #90
Modified: dss/trunk/core/dss.cpp
===================================================================
--- dss/trunk/core/dss.cpp 2009-09-29 06:59:44 UTC (rev 8805)
+++ dss/trunk/core/dss.cpp 2009-09-29 07:02:21 UTC (rev 8806)
@@ -208,6 +208,8 @@
m_pEventInterpreter->addPlugin(plugin);
plugin = new EventInterpreterPluginJavascript(m_pEventInterpreter.get());
m_pEventInterpreter->addPlugin(plugin);
+ plugin = new EventInterpreterInternalRelay(m_pEventInterpreter.get());
+ m_pEventInterpreter->addPlugin(plugin);
m_pEventRunner->setEventQueue(m_pEventQueue.get());
m_pEventInterpreter->setEventRunner(m_pEventRunner.get());
Modified: dss/trunk/webservices/model_soap.cpp
===================================================================
--- dss/trunk/webservices/model_soap.cpp 2009-09-29 06:59:44 UTC (rev 8805)
+++ dss/trunk/webservices/model_soap.cpp 2009-09-29 07:02:21 UTC (rev 8806)
@@ -32,11 +32,11 @@
return result;
} // isAuthorized
-int AuthorizeAndGetSession(struct soap *soap, const int _token, dss::WebServiceSession& result) {
+int AuthorizeAndGetSession(struct soap *soap, const int _token, dss::WebServiceSession** result) {
if(!IsAuthorized(soap, _token)) {
return NotAuthorized(soap);
}
- result = dss::DSS::getInstance()->getWebServices().getSession(soap, _token);
+ *result = &dss::DSS::getInstance()->getWebServices().getSession(soap, _token);
return SOAP_OK;
} // AuthorizeAndGetSession
@@ -1171,16 +1171,16 @@
} // dss__EventRaise
int dss__EventWaitFor(struct soap *soap, int _token, int _timeout, std::vector<dss__Event>& result) {
- dss::WebServiceSession session;
- int getResult = AuthorizeAndGetSession(soap, _token, session);
+ dss::WebServiceSession* session;
+ int getResult = AuthorizeAndGetSession(soap, _token, &session);
if(getResult != SOAP_OK) {
return getResult;
}
- session.waitForEvent(_timeout);
+ session->waitForEvent(_timeout);
- while(session.hasEvent()) {
- dss::Event origEvent = session.popEvent();
+ while(session->hasEvent()) {
+ dss::Event origEvent = session->popEvent();
dss__Event evt;
evt.name = origEvent.getName();
const dss::HashMapConstStringString& props = origEvent.getProperties().getContainer();
@@ -1197,13 +1197,13 @@
} // dss__EventWaitFor
int dss__EventSubscribeTo(struct soap *soap, int _token, std::string _name, std::string& result) {
- dss::WebServiceSession session;
- int getResult = AuthorizeAndGetSession(soap, _token, session);
+ dss::WebServiceSession* session;
+ int getResult = AuthorizeAndGetSession(soap, _token, &session);
if(getResult != SOAP_OK) {
return getResult;
}
- result = session.subscribeTo(_name);
+ result = session->subscribeTo(_name);
return SOAP_OK;
} // dss__EventSubscribeTo
Modified: dss/trunk/webservices/webservices.cpp
===================================================================
--- dss/trunk/webservices/webservices.cpp 2009-09-29 06:59:44 UTC (rev 8805)
+++ dss/trunk/webservices/webservices.cpp 2009-09-29 07:02:21 UTC (rev 8806)
@@ -214,6 +214,7 @@
} // popEvent
std::string WebServiceSession::subscribeTo(const std::string& _eventName) {
+ createListener();
return m_pEventListener->subscribeTo(_eventName);
} // subscribeTo
More information about the dss-commits
mailing list