Some fixes in LPCApp{Obj,Proto}, to be continued.
authorLolitech
Thu, 03 Jun 2010 17:23:11 +0200
changeset 548 1428fd553988
parent 547 5748d695beee
child 549 5dd92bd6e6e5
Some fixes in LPCApp{Obj,Proto}, to be continued.
connectors/LPC/LPCAppObject.py
connectors/LPC/LPCBootObject.py
connectors/LPC/LPCBootProto.py
--- a/connectors/LPC/LPCAppObject.py	Thu Jun 03 17:21:40 2010 +0200
+++ b/connectors/LPC/LPCAppObject.py	Thu Jun 03 17:23:11 2010 +0200
@@ -38,7 +38,7 @@
             try:
                 self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction)
                 return res
-            except LPCError,e:
+            except LPCProtoError,e:
                 self.pluginsroot.logger.write_error(str(e)+"\n")
                 self.SerialConnection = None
                 self.PLCStatus = "Disconnected"
@@ -52,17 +52,17 @@
         PLCprint("StopPLC")
         self.HandleSerialTransaction(STOPTransaction())
 
-    def GetPLCstatus(self):
+    def ResetPLC(self):
         self.HandleSerialTransaction(RESETTransaction())
         return self.PLCStatus
 
-    def ResetPLC(self):
+    def GetPLCstatus(self):
         self.HandleSerialTransaction(IDLETransaction())
         return self.PLCStatus
 
     def MatchMD5(self, MD5):
         data = self.HandleSerialTransaction(GET_PLCIDTransaction())
-        print "PLCINFO",data[32:]
+        print "PLCINFO",data
         return data[:32] == MD5
 
     class IEC_STRING(ctypes.Structure):
--- a/connectors/LPC/LPCBootObject.py	Thu Jun 03 17:21:40 2010 +0200
+++ b/connectors/LPC/LPCBootObject.py	Thu Jun 03 17:23:11 2010 +0200
@@ -38,7 +38,7 @@
     
     def NewPLC(self, md5sum, data, extrafiles):
         self.successfully_transfered = self.HandleSerialTransaction(LOADTransaction(data))
-        return successfully_transfered
+        return self.successfully_transfered
 
     def MatchMD5(self, MD5):
         return self.successfully_transfered
--- a/connectors/LPC/LPCBootProto.py	Thu Jun 03 17:21:40 2010 +0200
+++ b/connectors/LPC/LPCBootProto.py	Thu Jun 03 17:23:11 2010 +0200
@@ -19,7 +19,8 @@
         self.pseudofile = pseudofile
         
     def SendData(self):
-        return self.pseudofile.write(self.OptData) == len(self.OptData)
+        res = self.pseudofile.write(self.OptData)
+        return True 
 
     def GetData(self):
         pass # not impl