[dss-commits] r8797 - in dss/trunk: core unix

dss-commits at forum.digitalstrom.org dss-commits at forum.digitalstrom.org
Fri Sep 25 12:43:10 CEST 2009


Author: pstaehlin
Date: 2009-09-25 12:43:10 +0200 (Fri, 25 Sep 2009)
New Revision: 8797

Modified:
   dss/trunk/core/eventinterpreterplugins.cpp
   dss/trunk/core/jshandler.cpp
   dss/trunk/unix/ds485proxy.cpp
Log:
Made dSLink working:
* Ignore garbage word sent by dss in dSLinkReceive
* Set the packet source as modulator ID of a dSLinkInterrupt
* Initialize ScriptContext::m_KeepContext

Modified: dss/trunk/core/eventinterpreterplugins.cpp
===================================================================
--- dss/trunk/core/eventinterpreterplugins.cpp	2009-09-24 14:58:20 UTC (rev 8796)
+++ dss/trunk/core/eventinterpreterplugins.cpp	2009-09-25 10:43:10 UTC (rev 8797)
@@ -92,13 +92,15 @@
 
           // add raisedEvent.parameter
           ScriptObject param(*ctx, NULL);
-          raisedEvent.setProperty("parameter", &param);
           const HashMapConstStringString& props =  _event.getProperties().getContainer();
           for(HashMapConstStringString::const_iterator iParam = props.begin(), e = props.end();
               iParam != e; ++iParam)
           {
+            Logger::getInstance()->log("EventInterpreterPluginJavascript::handleEvent: setting parameter " + iParam->first +
+                                       " to " + iParam->second);
             param.setProperty<const std::string&>(iParam->first, iParam->second);
           }
+          raisedEvent.setProperty("parameter", &param);
 
           // add raisedEvent.subscription
           ScriptObject subscriptionObj(*ctx, NULL);

Modified: dss/trunk/core/jshandler.cpp
===================================================================
--- dss/trunk/core/jshandler.cpp	2009-09-24 14:58:20 UTC (rev 8796)
+++ dss/trunk/core/jshandler.cpp	2009-09-25 10:43:10 UTC (rev 8797)
@@ -169,7 +169,8 @@
   ScriptContext::ScriptContext(ScriptEnvironment& _env, JSContext* _pContext)
   : m_pScriptToExecute(NULL),
     m_Environment(_env),
-    m_pContext(_pContext)
+    m_pContext(_pContext),
+    m_KeepContext(false)
   {
     JS_SetOptions(m_pContext, JSOPTION_VAROBJFIX | JSOPTION_DONT_REPORT_UNCAUGHT);
     JS_SetErrorReporter(m_pContext, jsErrorHandler);

Modified: dss/trunk/unix/ds485proxy.cpp
===================================================================
--- dss/trunk/unix/ds485proxy.cpp	2009-09-24 14:58:20 UTC (rev 8796)
+++ dss/trunk/unix/ds485proxy.cpp	2009-09-25 10:43:10 UTC (rev 8797)
@@ -962,7 +962,13 @@
       }
       PayloadDissector pd(recFrame->getFrame()->getPayload());
       pd.get<uint8_t>(); // discard the function id
-      pd.get<uint16_t>(); // device id
+      pd.get<uint16_t>(); // garbage
+      devid_t devAddress = pd.get<uint16_t>(); // device address
+      if(devAddress != _devAdr) {
+        log("dSLinkSend: Received answer for wrong device expected: " 
+            + intToString(_devAdr, true) + 
+            " got: " + intToString(devAddress, true));
+      }
       return pd.get<uint16_t>();
     }
     log("dsLinkSend: Not waiting for response (waitOnly is set)");
@@ -1296,7 +1302,7 @@
               pd.get<uint8_t>(); // functionID
               uint16_t devID = pd.get<uint16_t>();
               uint16_t priority = pd.get<uint16_t>();
-              int modID = frame->getHeader().getDestination();
+              int modID = frame->getHeader().getSource();
               ModelEvent* pEvent = new ModelEvent(ModelEvent::etDSLinkInterrupt);
               pEvent->addParameter(modID);
               pEvent->addParameter(devID);



More information about the dss-commits mailing list