connectors/LPC/LPCAppObject.py
changeset 575 6765adf58711
parent 564 464d470bdbd7
child 576 7fcdc0d3d8d9
equal deleted inserted replaced
574:1b6bd9f590aa 575:6765adf58711
    29 class LPCAppObject(LPCObject):
    29 class LPCAppObject(LPCObject):
    30     def connect(self,comport):
    30     def connect(self,comport):
    31         self.SerialConnection = LPCAppProto(comport,#number
    31         self.SerialConnection = LPCAppProto(comport,#number
    32                                          115200, #speed
    32                                          115200, #speed
    33                                          2)      #timeout
    33                                          2)      #timeout
    34         self.HandleSerialTransaction(IDLETransaction())
       
    35 
    34 
    36     def StartPLC(self, debug=False):
    35     def StartPLC(self, debug=False):
    37         self.HandleSerialTransaction(STARTTransaction())
    36         self.HandleSerialTransaction(STARTTransaction())
    38             
    37             
    39     def StopPLC(self):
    38     def StopPLC(self):
    43     def ResetPLC(self):
    42     def ResetPLC(self):
    44         self.HandleSerialTransaction(RESETTransaction())
    43         self.HandleSerialTransaction(RESETTransaction())
    45         return self.PLCStatus
    44         return self.PLCStatus
    46 
    45 
    47     def GetPLCstatus(self):
    46     def GetPLCstatus(self):
    48         self.HandleSerialTransaction(IDLETransaction())
    47         self.HandleSerialTransaction(GET_PLCIDTransaction())
    49         return self.PLCStatus
    48         return self.PLCStatus
    50 
    49 
    51     def MatchMD5(self, MD5):
    50     def MatchMD5(self, MD5):
    52         data = self.HandleSerialTransaction(GET_PLCIDTransaction())
    51         data = self.HandleSerialTransaction(GET_PLCIDTransaction())
    53         if data is not None:
    52         if data is not None:
    54             return data[:32] == MD5
    53             return data[:32] == MD5[:32]
    55         return False
    54         return False
    56 
    55 
    57     class IEC_STRING(ctypes.Structure):
    56     class IEC_STRING(ctypes.Structure):
    58         """
    57         """
    59         Must be changed according to changes in iec_types.h
    58         Must be changed according to changes in iec_types.h