connectors/LPC/LPCObject.py
changeset 578 6f5795bdee49
parent 576 7fcdc0d3d8d9
child 717 1c23952dbde1
equal deleted inserted replaced
577:04baf6607a44 578:6f5795bdee49
    43     def HandleSerialTransaction(self, transaction):
    43     def HandleSerialTransaction(self, transaction):
    44         if self.SerialConnection is not None:
    44         if self.SerialConnection is not None:
    45             try:
    45             try:
    46                 self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction)
    46                 self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction)
    47                 return res
    47                 return res
       
    48             except LPCProtoError,e:
       
    49                 self.pluginsroot.logger.write(_("PLC disconnected\n"))
       
    50                 if self.SerialConnection is not None:
       
    51                     self.SerialConnection.close()
       
    52                     self.SerialConnection = None
       
    53                 self.PLCStatus = "Disconnected"
       
    54                 return None
    48             except Exception,e:
    55             except Exception,e:
    49                 self.pluginsroot.logger.write_warning(str(e)+"\n")
    56                 self.pluginsroot.logger.write_warning(str(e)+"\n")
    50                 self.SerialConnection.close()
       
    51                 self.SerialConnection = None
       
    52                 self.PLCStatus = "Disconnected"
       
    53                 return None
       
    54         
    57         
    55     def StartPLC(self, debug=False):
    58     def StartPLC(self, debug=False):
    56         raise LPCProtoError("Not implemented")
    59         raise LPCProtoError("Not implemented")
    57             
    60             
    58     def StopPLC(self):
    61     def StopPLC(self):