connectors/LPC/LPCBootProto.py
changeset 545 627e5c636a4f
child 548 1428fd553988
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/connectors/LPC/LPCBootProto.py	Thu Jun 03 12:57:28 2010 +0200
@@ -0,0 +1,34 @@
+from LPCProto import *
+
+class LPCBootProto(LPCProto):
+    def HandleTransaction(self, transaction):
+        self.TransactionLock.acquire()
+        try:
+            transaction.SetPseudoFile(self.serialPort)
+            res = transaction.ExchangeData()
+        finally:
+            self.TransactionLock.release()
+        return "Stopped", res
+    
+class LPCBootTransaction:
+    def __init__(self, optdata = ""):
+        self.OptData = optdata
+        self.pseudofile = None
+        
+    def SetPseudoFile(self, pseudofile):
+        self.pseudofile = pseudofile
+        
+    def SendData(self):
+        return self.pseudofile.write(self.OptData) == len(self.OptData)
+
+    def GetData(self):
+        pass # not impl
+
+    def ExchangeData(self): 
+        pass
+
+class LOADTransaction(LPCBootTransaction):
+    def __init__(self, data):
+        LPCBootTransaction.__init__(self, data)
+    ExchangeData = LPCBootTransaction.SendData
+