connectors/PYRO/__init__.py
changeset 235 a66e150f2888
parent 231 f1db3ce8f40a
child 284 3fecc96090c8
equal deleted inserted replaced
234:aff053bad924 235:a66e150f2888
    74             This func returns the real Pyro Proxy.
    74             This func returns the real Pyro Proxy.
    75             Use this if you musn't keep reference to it.
    75             Use this if you musn't keep reference to it.
    76             """
    76             """
    77             return RemotePLCObjectProxy
    77             return RemotePLCObjectProxy
    78 
    78 
    79         def _PyroStartPLC(self):
    79         def _PyroStartPLC(self, *args, **kwargs):
    80             """
    80             """
    81             pluginsroot._connector.GetPyroProxy() is used 
    81             pluginsroot._connector.GetPyroProxy() is used 
    82             rather than RemotePLCObjectProxy because
    82             rather than RemotePLCObjectProxy because
    83             object is recreated meanwhile, 
    83             object is recreated meanwhile, 
    84             so we must not keep ref to it here
    84             so we must not keep ref to it here
    92                 pluginsroot._connector.GetPyroProxy().ForceReload()
    92                 pluginsroot._connector.GetPyroProxy().ForceReload()
    93                 pluginsroot._Disconnect()
    93                 pluginsroot._Disconnect()
    94                 # let remote PLC time to resurect.(freeze app)
    94                 # let remote PLC time to resurect.(freeze app)
    95                 sleep(0.5)
    95                 sleep(0.5)
    96                 pluginsroot._Connect()
    96                 pluginsroot._Connect()
    97             return pluginsroot._connector.GetPyroProxy().StartPLC()
    97             return pluginsroot._connector.GetPyroProxy().StartPLC(*args, **kwargs)
    98         StartPLC = PyroCatcher(_PyroStartPLC, False)
    98         StartPLC = PyroCatcher(_PyroStartPLC, False)
    99 
    99 
   100 
   100 
   101         def _PyroGetTraceVariables(self):
   101         def _PyroGetTraceVariables(self):
   102             """
   102             """
   103             for safe use in from debug thread, must use the copy
   103             for safe use in from debug thread, must use the copy
   104             """
   104             """
   105             return RemotePLCObjectProxyCopy.GetTraceVariables()
   105             if RemotePLCObjectProxyCopy.GetPLCstatus() == "Started":
       
   106                 return RemotePLCObjectProxyCopy.GetTraceVariables()
       
   107             else:
       
   108                 return None,None
   106         GetTraceVariables = PyroCatcher(_PyroGetTraceVariables)
   109         GetTraceVariables = PyroCatcher(_PyroGetTraceVariables)
   107 
   110 
   108         
   111         
   109         def __getattr__(self, attrName):
   112         def __getattr__(self, attrName):
   110             member = self.__dict__.get(attrName, None)
   113             member = self.__dict__.get(attrName, None)