134 self._GetDebugData = self.PLClibraryHandle.GetDebugData |
134 self._GetDebugData = self.PLClibraryHandle.GetDebugData |
135 self._GetDebugData.restype = ctypes.c_int |
135 self._GetDebugData.restype = ctypes.c_int |
136 self._GetDebugData.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_void_p)] |
136 self._GetDebugData.argtypes = [ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_void_p)] |
137 |
137 |
138 self._suspendDebug = self.PLClibraryHandle.suspendDebug |
138 self._suspendDebug = self.PLClibraryHandle.suspendDebug |
139 self._suspendDebug.restype = None |
139 self._suspendDebug.restype = ctypes.c_int |
140 self._suspendDebug.argtypes = [ctypes.c_int] |
140 self._suspendDebug.argtypes = [ctypes.c_int] |
141 |
141 |
142 self._resumeDebug = self.PLClibraryHandle.resumeDebug |
142 self._resumeDebug = self.PLClibraryHandle.resumeDebug |
143 self._resumeDebug.restype = None |
143 self._resumeDebug.restype = None |
144 |
144 |
159 self._ResetDebugVariables = lambda:None |
159 self._ResetDebugVariables = lambda:None |
160 self._RegisterDebugVariable = lambda x, y:None |
160 self._RegisterDebugVariable = lambda x, y:None |
161 self._IterDebugData = lambda x,y:None |
161 self._IterDebugData = lambda x,y:None |
162 self._FreeDebugData = lambda:None |
162 self._FreeDebugData = lambda:None |
163 self._GetDebugData = lambda:-1 |
163 self._GetDebugData = lambda:-1 |
164 self._suspendDebug = lambda x:None |
164 self._suspendDebug = lambda x:-1 |
165 self._resumeDebug = lambda:None |
165 self._resumeDebug = lambda:None |
166 self._PythonIterator = lambda:"" |
166 self._PythonIterator = lambda:"" |
167 self.PLClibraryHandle = None |
167 self.PLClibraryHandle = None |
168 # Unload library explicitely |
168 # Unload library explicitely |
169 if getattr(self,"_PLClibraryHandle",None) is not None: |
169 if getattr(self,"_PLClibraryHandle",None) is not None: |
327 Call ctype imported function to append |
327 Call ctype imported function to append |
328 these indexes to registred variables in PLC debugger |
328 these indexes to registred variables in PLC debugger |
329 """ |
329 """ |
330 if idxs: |
330 if idxs: |
331 # suspend but dont disable |
331 # suspend but dont disable |
332 self._suspendDebug(False) |
332 if self._suspendDebug(False) == 0: |
333 # keep a copy of requested idx |
333 # keep a copy of requested idx |
334 self._Idxs = idxs[:] |
334 self._Idxs = idxs[:] |
335 self._ResetDebugVariables() |
335 self._ResetDebugVariables() |
336 for idx,iectype,force in idxs: |
336 for idx,iectype,force in idxs: |
337 if force !=None: |
337 if force !=None: |
338 c_type,unpack_func, pack_func = \ |
338 c_type,unpack_func, pack_func = \ |
339 TypeTranslator.get(iectype, |
339 TypeTranslator.get(iectype, |
340 (None,None,None)) |
340 (None,None,None)) |
341 force = ctypes.byref(pack_func(c_type,force)) |
341 force = ctypes.byref(pack_func(c_type,force)) |
342 self._RegisterDebugVariable(idx, force) |
342 self._RegisterDebugVariable(idx, force) |
343 self._resumeDebug() |
343 self._resumeDebug() |
344 else: |
344 else: |
345 self._suspendDebug(True) |
345 self._suspendDebug(True) |
346 self._Idxs = [] |
346 self._Idxs = [] |
347 |
347 |
348 def GetTraceVariables(self): |
348 def GetTraceVariables(self): |