equal
deleted
inserted
replaced
36 def HandleSerialTransaction(self, transaction): |
36 def HandleSerialTransaction(self, transaction): |
37 if self.SerialConnection is not None: |
37 if self.SerialConnection is not None: |
38 try: |
38 try: |
39 self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction) |
39 self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction) |
40 return res |
40 return res |
41 except LPCError,e: |
41 except LPCProtoError,e: |
42 self.pluginsroot.logger.write_error(str(e)+"\n") |
42 self.pluginsroot.logger.write_error(str(e)+"\n") |
43 self.SerialConnection = None |
43 self.SerialConnection = None |
44 self.PLCStatus = "Disconnected" |
44 self.PLCStatus = "Disconnected" |
45 return None |
45 return None |
46 |
46 |
50 |
50 |
51 def StopPLC(self): |
51 def StopPLC(self): |
52 PLCprint("StopPLC") |
52 PLCprint("StopPLC") |
53 self.HandleSerialTransaction(STOPTransaction()) |
53 self.HandleSerialTransaction(STOPTransaction()) |
54 |
54 |
55 def GetPLCstatus(self): |
55 def ResetPLC(self): |
56 self.HandleSerialTransaction(RESETTransaction()) |
56 self.HandleSerialTransaction(RESETTransaction()) |
57 return self.PLCStatus |
57 return self.PLCStatus |
58 |
58 |
59 def ResetPLC(self): |
59 def GetPLCstatus(self): |
60 self.HandleSerialTransaction(IDLETransaction()) |
60 self.HandleSerialTransaction(IDLETransaction()) |
61 return self.PLCStatus |
61 return self.PLCStatus |
62 |
62 |
63 def MatchMD5(self, MD5): |
63 def MatchMD5(self, MD5): |
64 data = self.HandleSerialTransaction(GET_PLCIDTransaction()) |
64 data = self.HandleSerialTransaction(GET_PLCIDTransaction()) |
65 print "PLCINFO",data[32:] |
65 print "PLCINFO",data |
66 return data[:32] == MD5 |
66 return data[:32] == MD5 |
67 |
67 |
68 class IEC_STRING(ctypes.Structure): |
68 class IEC_STRING(ctypes.Structure): |
69 """ |
69 """ |
70 Must be changed according to changes in iec_types.h |
70 Must be changed according to changes in iec_types.h |