96 ctypes.pointer( |
96 ctypes.pointer( |
97 ctypes.c_uint32(idx)),4) |
97 ctypes.c_uint32(idx)),4) |
98 if force !=None: |
98 if force !=None: |
99 c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None)) |
99 c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None)) |
100 forced_type_size = ctypes.sizeof(c_type) |
100 forced_type_size = ctypes.sizeof(c_type) |
101 forcedsizestr = chr(forced_type_size) |
101 forced_type_size_str = chr(forced_type_size) |
102 forcestr = ctypes.string_at( |
102 forcestr = ctypes.string_at( |
103 ctypes.pointer( |
103 ctypes.pointer( |
104 pack_func(c_type,force)), |
104 pack_func(c_type,force)), |
105 forced_type_size) |
105 forced_type_size) |
106 buff += idxstr + forced_type_size_str + forcestr |
106 buff += idxstr + forced_type_size_str + forcestr |
117 """ |
117 """ |
118 offset = 0 |
118 offset = 0 |
119 strbuf = self.HandleSerialTransaction( |
119 strbuf = self.HandleSerialTransaction( |
120 GET_TRACE_VARIABLETransaction()) |
120 GET_TRACE_VARIABLETransaction()) |
121 if strbuf is not None and len(strbuf) > 4 and self.PLCStatus == "Started": |
121 if strbuf is not None and len(strbuf) > 4 and self.PLCStatus == "Started": |
|
122 res=[] |
122 size = len(strbuf) - 4 |
123 size = len(strbuf) - 4 |
123 tick = ctypes.cast( |
124 tick = ctypes.cast( |
124 ctypes.c_char_p(strbuf[:4]), |
125 ctypes.c_char_p(strbuf[:4]), |
125 ctypes.POINTER(ctypes.c_int)).contents |
126 ctypes.POINTER(ctypes.c_int)).contents |
126 buffer = ctypes.cast( |
127 buff = ctypes.cast( |
127 ctypes.c_char_p(strbuf[4:]), |
128 ctypes.c_char_p(strbuf[4:]), |
128 ctypes.c_void_p) |
129 ctypes.c_void_p) |
129 for idx, iectype, forced in self._Idxs: |
130 for idx, iectype, forced in self._Idxs: |
130 cursor = ctypes.c_void_p(buffer.value + offset) |
131 cursor = ctypes.c_void_p(buff.value + offset) |
131 c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None)) |
132 c_type,unpack_func, pack_func = self.TypeTranslator.get(iectype, (None,None,None)) |
132 if c_type is not None and offset < size: |
133 if c_type is not None and offset < size: |
133 res.append(unpack_func(ctypes.cast(cursor, |
134 res.append(unpack_func(ctypes.cast(cursor, |
134 ctypes.POINTER(c_type)).contents)) |
135 ctypes.POINTER(c_type)).contents)) |
135 offset += ctypes.sizeof(c_type) |
136 offset += ctypes.sizeof(c_type) |