equal
deleted
inserted
replaced
20 # |
20 # |
21 # You should have received a copy of the GNU General Public License |
21 # You should have received a copy of the GNU General Public License |
22 # along with this program; if not, write to the Free Software |
22 # along with this program; if not, write to the Free Software |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
23 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
24 |
24 |
|
25 |
|
26 from __future__ import print_function |
25 import sys |
27 import sys |
26 import traceback |
28 import traceback |
27 import atexit |
29 import atexit |
28 from twisted.internet import reactor, threads |
30 from twisted.internet import reactor, threads |
29 from autobahn.twisted import wamp |
31 from autobahn.twisted import wamp |
41 class WampSession(wamp.ApplicationSession): |
43 class WampSession(wamp.ApplicationSession): |
42 def onJoin(self, details): |
44 def onJoin(self, details): |
43 global _WampSession, _WampSessionEvent |
45 global _WampSession, _WampSessionEvent |
44 _WampSession = self |
46 _WampSession = self |
45 _WampSessionEvent.set() |
47 _WampSessionEvent.set() |
46 print 'WAMP session joined for :', self.config.extra["ID"] |
48 print('WAMP session joined for :', self.config.extra["ID"]) |
47 |
49 |
48 def onLeave(self, details): |
50 def onLeave(self, details): |
49 global _WampSession, _WampSessionEvent |
51 global _WampSession, _WampSessionEvent |
50 _WampSessionEvent.clear() |
52 _WampSessionEvent.clear() |
51 _WampSession = None |
53 _WampSession = None |
52 print 'WAMP session left' |
54 print('WAMP session left') |
53 |
55 |
54 |
56 |
55 PLCObjDefaults = { |
57 PLCObjDefaults = { |
56 "StartPLC": False, |
58 "StartPLC": False, |
57 "GetTraceVariables": ("Broken", None), |
59 "GetTraceVariables": ("Broken", None), |
119 confnodesroot.logger.write_error(_("Connection lost!\n")) |
121 confnodesroot.logger.write_error(_("Connection lost!\n")) |
120 confnodesroot._SetConnector(None) |
122 confnodesroot._SetConnector(None) |
121 except Exception, e: |
123 except Exception, e: |
122 errmess = traceback.format_exc() |
124 errmess = traceback.format_exc() |
123 confnodesroot.logger.write_error(errmess+"\n") |
125 confnodesroot.logger.write_error(errmess+"\n") |
124 print errmess |
126 print(errmess) |
125 # confnodesroot._SetConnector(None) |
127 # confnodesroot._SetConnector(None) |
126 return PLCObjDefaults.get(funcname) |
128 return PLCObjDefaults.get(funcname) |
127 return catcher_func |
129 return catcher_func |
128 |
130 |
129 class WampPLCObjectProxy(object): |
131 class WampPLCObjectProxy(object): |