92 # keep a copy of requested idx |
92 # keep a copy of requested idx |
93 self._Idxs = idxs[:] |
93 self._Idxs = idxs[:] |
94 for idx,iectype,force in idxs: |
94 for idx,iectype,force in idxs: |
95 idxstr = ctypes.string_at( |
95 idxstr = ctypes.string_at( |
96 ctypes.pointer( |
96 ctypes.pointer( |
97 ctypes.c_uint32(length)),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 forcedsizestr = chr(ctypes.sizeof(c_type)) |
100 forced_type_size = ctypes.sizeof(c_type) |
|
101 forcedsizestr = chr(forced_type_size) |
101 forcestr = ctypes.string_at( |
102 forcestr = ctypes.string_at( |
102 ctypes.pointer( |
103 ctypes.pointer( |
103 pack_func(c_type,force)), |
104 pack_func(c_type,force)), |
104 forced_type_size) |
105 forced_type_size) |
105 buff += idxstr + forced_type_size_str + forcestr |
106 buff += idxstr + forced_type_size_str + forcestr |
115 Return a list of variables, corresponding to the list of required idx |
116 Return a list of variables, corresponding to the list of required idx |
116 """ |
117 """ |
117 offset = 0 |
118 offset = 0 |
118 strbuf = self.HandleSerialTransaction( |
119 strbuf = self.HandleSerialTransaction( |
119 GET_TRACE_VARIABLETransaction()) |
120 GET_TRACE_VARIABLETransaction()) |
120 size = len(strbuf) - 4 |
121 if strbuf is not None and len(strbuf) > 4 and self.PLCStatus == "Started": |
121 if size > 0 and self.PLCStatus == "Started": |
122 size = len(strbuf) - 4 |
122 tick = ctypes.cast( |
123 tick = ctypes.cast( |
123 ctypes.c_char_p(strbuf[:4]), |
124 ctypes.c_char_p(strbuf[:4]), |
124 ctypes.POINTER(ctypes.c_int)).contents |
125 ctypes.POINTER(ctypes.c_int)).contents |
125 buffer = ctypes.cast( |
126 buffer = ctypes.cast( |
126 ctypes.c_char_p(strbuf[4:]), |
127 ctypes.c_char_p(strbuf[4:]), |