Merged
authorEdouard Tisserant
Tue, 02 Oct 2018 15:57:26 +0200
changeset 2308 4d7cee25a474
parent 2307 c44692b53736 (diff)
parent 2305 56f1d8aca886 (current diff)
child 2309 d8fb90a2e11f
child 2310 f9f9f5856032
Merged
BeremizIDE.py
IDEFrame.py
connectors/PYRO/__init__.py
connectors/__init__.py
dialogs/AboutDialog.py
dialogs/BlockPreviewDialog.py
dialogs/ConnectionDialog.py
dialogs/FBDBlockDialog.py
modbus/mb_runtime.h
runtime/ServicePublisher.py
runtime/WampClient.py
svgui/svguilib.py
targets/Generic/XSD
targets/Generic/__init__.py
targets/Linux/XSD
targets/Linux/__init__.py
targets/Win32/XSD
targets/Win32/__init__.py
targets/XSD_toolchain_gcc
targets/XSD_toolchain_makefile
targets/Xenomai/XSD
targets/Xenomai/__init__.py
targets/__init__.py
targets/toolchain_gcc.py
targets/toolchain_makefile.py
tests/ethercat/wago_higen/beremiz.xml
tests/ethercat/wago_higen/ethercat@etherlab/baseconfnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/confnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/baseconfnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/config.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/confnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/baseconfnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/confnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/higen@EthercatCIA402Slave/baseconfnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/higen@EthercatCIA402Slave/confnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/baseconfnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/confnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/baseconfnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/confnode.xml
tests/ethercat/wago_higen/ethercat@etherlab/master@EthercatNode/process_variables.xml
tests/ethercat/wago_higen/ethercat@etherlab/modules/Beckhoff EKxxxx.xml
tests/ethercat/wago_higen/ethercat@etherlab/modules/Beckhoff EL1xxx.xml
tests/ethercat/wago_higen/ethercat@etherlab/modules/Beckhoff EL2xxx.xml
tests/ethercat/wago_higen/ethercat@etherlab/modules/Higen_EDA7000_CoE_ver16_with_variablePDO_rv3.xml
tests/ethercat/wago_higen/ethercat@etherlab/modules/modules_extra_params.cfg
tests/ethercat/wago_higen/plc.xml
tests/ethercat/wago_sanyo/beremiz.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/baseconfnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/confnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/baseconfnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/config.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/confnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/baseconfnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/coupler@EthercatSlave/confnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/baseconfnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/inputs@EthercatSlave/confnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/baseconfnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/outputs@EthercatSlave/confnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/baseconfnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/master@EthercatNode/sanyo@EthercatCIA402Slave/confnode.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/modules/Beckhoff EKxxxx.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/modules/Beckhoff EL1xxx.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/modules/Beckhoff EL2xxx.xml
tests/ethercat/wago_sanyo/ethercat@etherlab/modules/sanyo.xml
tests/ethercat/wago_sanyo/plc.xml
tests/svgui/beremiz.xml
tests/svgui/plc.xml
tests/svgui/svgui@svgui/gui.svg
tests/wamp/.crossbar/config.json
tests/wamp/README
tests/wamp/py_ext_0@py_ext/baseconfnode.xml
tests/wamp/py_ext_0@py_ext/pyfile.xml
tests/wxHMI/HMI@wxglade_hmi/baseconfnode.xml
tests/wxHMI/HMI@wxglade_hmi/hmi.wxg
tests/wxHMI/HMI@wxglade_hmi/hmi.wxg.bak
tests/wxHMI/HMI@wxglade_hmi/pyfile.xml
--- a/runtime/WampClient.py	Wed Sep 12 22:59:30 2018 +0200
+++ b/runtime/WampClient.py	Tue Oct 02 15:57:26 2018 +0200
@@ -32,13 +32,13 @@
 from autobahn.twisted.websocket import WampWebSocketClientFactory, connectWS
 from autobahn.wamp import types, auth
 from autobahn.wamp.serializer import MsgPackSerializer
-from twisted.internet.defer import inlineCallbacks
 from twisted.internet.protocol import ReconnectingClientFactory
 from twisted.python.components import registerAdapter
 
 from formless import annotate, webform
 import formless
 from nevow import tags, url, static
+from runtime import GetPLCObjectSingleton
 
 mandatoryConfigItems = ["ID", "active", "realm", "url"]
 
@@ -87,7 +87,7 @@
 def GetCallee(name):
     """ Get Callee or Subscriber corresponding to '.' spearated object path """
     names = name.split('.')
-    obj = _PySrv.plcobj
+    obj = GetPLCObjectSingleton()
     while names:
         obj = getattr(obj, names.pop(0))
     return obj
@@ -115,7 +115,6 @@
             raise Exception(
                 "don't know how to handle authmethod {}".format(challenge.method))
 
-    @inlineCallbacks
     def onJoin(self, details):
         global _WampSession
         _WampSession = self
@@ -128,13 +127,13 @@
                 registerOptions = None
                 print(_("TypeError register option: {}".format(e)))
 
-            yield self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
+            self.register(GetCallee(name), u'.'.join((ID, name)), registerOptions)
 
         for name in SubscribedEvents:
-            yield self.subscribe(GetCallee(name), unicode(name))
+            self.subscribe(GetCallee(name), unicode(name))
 
         for func in DoOnJoin:
-            yield func(self)
+            func(self)
 
         print(_('WAMP session joined (%s) by:' % time.ctime()), ID)
 
@@ -145,6 +144,9 @@
         _transportFactory = None
         print(_('WAMP session left'))
 
+    def publishWithOwnID(eventID, value):
+        ID = self.config.extra["ID"]
+        self.publish(unicode(ID+'.'+eventID), value)
 
 class ReconnectingWampWebSocketClientFactory(WampWebSocketClientFactory, ReconnectingClientFactory):
 
@@ -341,6 +343,13 @@
     global _PySrv
     _PySrv = pysrv
 
+def PublishEvent(eventID, value):
+    if getWampStatus() == "Attached":
+         _WampSession.publish(eventID, value)
+
+def PublishEventWithOwnID(eventID, value):
+    if getWampStatus() == "Attached":
+         _WampSession.publishWithOwnID(eventID, value)
 
 # WEB CONFIGURATION INTERFACE
 WAMP_SECRET_URL = "secret"
--- a/runtime/Worker.py	Wed Sep 12 22:59:30 2018 +0200
+++ b/runtime/Worker.py	Tue Oct 02 15:57:26 2018 +0200
@@ -8,6 +8,7 @@
 # See COPYING.Runtime file for copyrights details.
 
 from __future__ import absolute_import
+import sys
 import thread
 from threading import Lock, Condition
 
@@ -54,8 +55,13 @@
         """
         self._threadID = thread.get_ident()
         if args or kwargs:
-            job(*args, **kwargs).do()
-            # result is ignored
+            _job = job(*args, **kwargs)
+            _job.do()
+            if _job.success:
+                # result is ignored
+                pass
+            else:
+                raise _job.exc_info[0], _job.exc_info[1], _job.exc_info[2]
         self.mutex.acquire()
         while not self._finish:
             self.todo.wait()
--- a/runtime/__init__.py	Wed Sep 12 22:59:30 2018 +0200
+++ b/runtime/__init__.py	Tue Oct 02 15:57:26 2018 +0200
@@ -23,9 +23,8 @@
         exp = sys.exc_info()
     if _PLCObjectSingleton is not None:
         _PLCObjectSingleton.LogMessage(0, msg + '\n'.join(traceback.format_exception(*exp)))
-    else:
-        print(msg)
-        traceback.print_exception(*exp)
+    print(msg)
+    traceback.print_exception(*exp)
 
 def CreatePLCObjectSingleton(*args):
     global _PLCObjectSingleton