LPCconnector/LPCAppObject.py
changeset 42 30eae94f35f7
parent 41 b02a30880829
child 44 a6577420a27b
equal deleted inserted replaced
41:b02a30880829 42:30eae94f35f7
    95         Return a list of variables, corresponding to the list of required idx
    95         Return a list of variables, corresponding to the list of required idx
    96         """
    96         """
    97         strbuf = self.HandleSerialTransaction(
    97         strbuf = self.HandleSerialTransaction(
    98                                      GET_TRACE_VARIABLETransaction())
    98                                      GET_TRACE_VARIABLETransaction())
    99         if strbuf is not None and len(strbuf) > 4 and self.PLCStatus == "Started":
    99         if strbuf is not None and len(strbuf) > 4 and self.PLCStatus == "Started":
   100             res=[]
       
   101             size = len(strbuf) - 4
   100             size = len(strbuf) - 4
   102             ctick = ctypes.create_string_buffer(strbuf[:4])
   101             ctick = ctypes.create_string_buffer(strbuf[:4])
   103             tick = ctypes.cast(ctick, ctypes.POINTER(ctypes.c_int)).contents
   102             tick = ctypes.cast(ctick, ctypes.POINTER(ctypes.c_int)).contents
   104             cbuff = ctypes.create_string_buffer(strbuf[4:])
   103             cbuff = ctypes.create_string_buffer(strbuf[4:])
   105             buff = ctypes.cast(cbuff, ctypes.c_void_p)
   104             buff = ctypes.cast(cbuff, ctypes.c_void_p)
   106             TraceVariables = UnpackDebugBuffer(buff, size,  self._Idxs)
   105             TraceVariables = UnpackDebugBuffer(buff, size,  self._Idxs)
   107             if TraceVariables is not None:
   106             if TraceVariables is not None:
   108                 return self.PLCStatus, tick.value, res
   107                 return self.PLCStatus, tick.value, TraceVariables
   109         return self.PLCStatus, None, [] 
   108         return self.PLCStatus, None, [] 
   110 
   109 
   111     def GetLogMessage(self, level, msgid):
   110     def GetLogMessage(self, level, msgid):
   112         strbuf = self.HandleSerialTransaction(GET_LOGMSGTransaction(level, msgid))
   111         strbuf = self.HandleSerialTransaction(GET_LOGMSGTransaction(level, msgid))
   113         if strbuf is not None and len(strbuf) > 12:
   112         if strbuf is not None and len(strbuf) > 12: