[dss-commits] digitalSTROM Server branch, master, updated. 362c2f6ea31d14bbfcd89f60737fca7b65b710e1

git version control dss-commits at forum.digitalstrom.org
Fri Nov 13 16:36:09 CET 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "digitalSTROM Server".

The branch, master has been updated
       via  362c2f6ea31d14bbfcd89f60737fca7b65b710e1 (commit)
      from  6ceaff0933be8623f9754ae4a62680b212daf157 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 362c2f6ea31d14bbfcd89f60737fca7b65b710e1
Author: Patrick Stählin <pstaehlin at futurelab.ch>
Date:   Fri Nov 13 16:28:31 2009 +0100

    Added a stresstest
    
    The script intends to put load on the dSS SOAP=>dSLink datapath.

-----------------------------------------------------------------------

Changes:
diff --git a/data/handle_temperature_sensor_events.js b/data/handle_temperature_sensor_events.js
new file mode 100644
index 0000000..e1f647a
--- /dev/null
+++ b/data/handle_temperature_sensor_events.js
@@ -0,0 +1,34 @@
+
+if(raisedEvent.name == 'model_ready') {
+  var s = subscription("temperature_interrupt", "javascript", { 'filename': 'data/handle_temperature_sensor_events.js' } );
+  s.subscribe();
+  var sensors = getDevices().byFunctionID(0xbeef);
+  print("found ", sensors.length(), " sensors");
+
+  var setup = function(dev) {
+    print("setting-up ", dev.dsid, "...");
+    var temperature = dev.dSLinkSend(0x55, // value
+                                     true, // lastByte
+                                     false); // writeOnly
+    print("temperature is ", temperature);
+    var propBasePath = '/apartment/zones/zone0/' + dev.dsid;
+    setProperty(propBasePath + '/interrupt/mode', 'raise_event');
+    setProperty(propBasePath + '/interrupt/event/name', 'temperature_interrupt');    
+  }
+
+  // call check on each sensor
+  sensors.perform(setup);
+} else if(raisedEvent.name == 'temperature_interrupt') {
+  var readRegister = function(dev, number) {
+    dev.dSLinkSend(number, false, false);
+    return dev.dSLinkSend(number, true, false);
+  };
+
+  var dsid = raisedEvent.parameter.device;
+  var dev = getDevices().byDSID(dsid);
+  var propBasePath = '/apartment/zones/zone' + dev.zoneID + '/' + dsid;
+  var newTemp = readRegister(dev, 0);
+  log("newTemp: ", newTemp);
+
+  setProperty(propBasePath + 'temperature', newTemp);
+}
diff --git a/data/subscriptions.xml b/data/subscriptions.xml
index c148866..e71e2a4 100644
--- a/data/subscriptions.xml
+++ b/data/subscriptions.xml
@@ -46,6 +46,11 @@
   <subscription event-name="darker" handler-name="bus_handler">
     <send type="decreaseValue" />
   </subscription>
+ <subscription event-name="model_ready" handler-name="javascript">
+   <parameter>
+      <parameter name="filename">data/handle_temperature_sensor_events.js</parameter>
+    </parameter>
+ </subscription>
   <subscription event-name="model_ready" handler-name="javascript">
     <parameter>
       <parameter name="filename">data/initialize.js</parameter>
diff --git a/tools/stresstest.py b/tools/stresstest.py
new file mode 100755
index 0000000..2edb93b
--- /dev/null
+++ b/tools/stresstest.py
@@ -0,0 +1,47 @@
+#!/usr/bin/python
+
+#
+#    Copyright (c) 2009 digitalSTROM.org, Zurich, Switzerland
+#    Copyright (c) 2009 futureLAB AG, Winterthur, Switzerland
+#
+#    This file is part of digitalSTROM Server.
+#
+#    digitalSTROM Server is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    digitalSTROM Server 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.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with digitalSTROM Server. If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+
+from suds.client import Client
+import telnetlib
+import time
+
+import datetime
+
+url = 'http://localhost:8080/dss.wsdl'
+
+print 'stresstest.py'
+while 1:
+  print 'creating client'
+  client = Client(url);
+  try:
+    print 'getting token'
+    token = client.service.Authenticate('user', 'pass')
+    i = 0;
+    while 1:
+      print 'Setting property'
+      client.service.PropertySetInt(token, '/sim/3504175fe0000000ffc00016/temperature', i);
+      i += 1;
+      time.sleep(0.5);
+  except Exception, inst:
+    print 'error ', inst


hooks/post-receive
-- 
digitalSTROM Server


More information about the dss-commits mailing list