--- a/Beremiz.py Tue Feb 01 17:28:41 2011 +0100
+++ b/Beremiz.py Thu Feb 03 18:20:47 2011 +0100
@@ -278,6 +278,10 @@
def write_error(self, s):
self.write(s,self.red_yellow)
+ def writeyield(self, s): --- a/connectors/LPC/LPCBootObject.py Tue Feb 01 17:28:41 2011 +0100
+++ b/connectors/LPC/LPCBootObject.py Thu Feb 03 18:20:47 2011 +0100
@@ -38,7 +38,7 @@
self.PLCStatus = "Stopped"
def NewPLC(self, md5sum, data, extrafiles):
- self.successfully_transfered = self.HandleSerialTransaction(LOADTransaction(data))
+ self.successfully_transfered = self.HandleSerialTransaction(LOADTransaction(data, self.PLCprint)) return self.successfully_transfered
--- a/connectors/LPC/LPCBootProto.py Tue Feb 01 17:28:41 2011 +0100
+++ b/connectors/LPC/LPCBootProto.py Thu Feb 03 18:20:47 2011 +0100
@@ -34,7 +34,32 @@
ExchangeData = LPCBootTransaction.SendData
class LOADTransaction(LPCBootTransaction):
- def __init__(self, data):
+ def __init__(self, data, PLCprint): + self.PLCprint = PLCprint LPCBootTransaction.__init__(self, data)
- ExchangeData = LPCBootTransaction.SendData
+ def sendDataHook(self): + #file("fw.bin","w").write(self.OptData) + loptdata = len(self.OptData) + self.PLCprint("%dkB:" % (loptdata/1024)) + res = self.pseudofile.write(data[:loptdata/100]) + self.PLCprint("%d%%" % count) + ExchangeData = sendDataHook +if __name__ == "__main__": + TestConnection = LPCBootProto(2,115200,1200) + mystr=file("fw.bin").read() + TestConnection.HandleTransaction(LOADTransaction(mystr, mylog)) --- a/connectors/LPC/LPCObject.py Tue Feb 01 17:28:41 2011 +0100
+++ b/connectors/LPC/LPCObject.py Thu Feb 03 18:20:47 2011 +0100
@@ -24,11 +24,13 @@
def __init__(self, pluginsroot, comportstr):
self.PLCStatus = "Disconnected"
self.pluginsroot = pluginsroot
- self.PLCprint = pluginsroot.logger.write
+ self.PLCprint = pluginsroot.logger.writeyield comport = int(comportstr[3:]) - 1
@@ -43,7 +45,7 @@
self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction)
- except LPCProtoError,e:
self.pluginsroot.logger.write_error(str(e)+"\n")
self.SerialConnection.close()
self.SerialConnection = None