connectors/LPC/LPCBootProto.py
changeset 545 627e5c636a4f
child 548 1428fd553988
equal deleted inserted replaced
544:064165a5276a 545:627e5c636a4f
       
     1 from LPCProto import *
       
     2 
       
     3 class LPCBootProto(LPCProto):
       
     4     def HandleTransaction(self, transaction):
       
     5         self.TransactionLock.acquire()
       
     6         try:
       
     7             transaction.SetPseudoFile(self.serialPort)
       
     8             res = transaction.ExchangeData()
       
     9         finally:
       
    10             self.TransactionLock.release()
       
    11         return "Stopped", res
       
    12     
       
    13 class LPCBootTransaction:
       
    14     def __init__(self, optdata = ""):
       
    15         self.OptData = optdata
       
    16         self.pseudofile = None
       
    17         
       
    18     def SetPseudoFile(self, pseudofile):
       
    19         self.pseudofile = pseudofile
       
    20         
       
    21     def SendData(self):
       
    22         return self.pseudofile.write(self.OptData) == len(self.OptData)
       
    23 
       
    24     def GetData(self):
       
    25         pass # not impl
       
    26 
       
    27     def ExchangeData(self): 
       
    28         pass
       
    29 
       
    30 class LOADTransaction(LPCBootTransaction):
       
    31     def __init__(self, data):
       
    32         LPCBootTransaction.__init__(self, data)
       
    33     ExchangeData = LPCBootTransaction.SendData
       
    34