ed@448: #!/usr/bin/env python ed@448: # -*- coding: utf-8 -*- ed@448: ed@448: #This file is part of Beremiz, a Integrated Development Environment for ed@448: #programming IEC 61131-3 automates supporting plcopen standard and CanFestival. ed@448: # ed@448: #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD ed@448: # ed@448: #See COPYING file for copyrights details. ed@448: # ed@448: #This library is free software; you can redistribute it and/or ed@448: #modify it under the terms of the GNU General Public ed@448: #License as published by the Free Software Foundation; either ed@448: #version 2.1 of the License, or (at your option) any later version. ed@448: # ed@448: #This library is distributed in the hope that it will be useful, ed@448: #but WITHOUT ANY WARRANTY; without even the implied warranty of ed@448: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ed@448: #General Public License for more details. ed@448: # ed@448: #You should have received a copy of the GNU General Public ed@448: #License along with this library; if not, write to the Free Software ed@448: #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ed@448: edouard@453: from LPCProto import * ed@448: ed@448: class LPCObject(): Lolitech@545: def __init__(self, pluginsroot, comportstr): edouard@508: self.PLCStatus = "Disconnected" ed@448: self.pluginsroot = pluginsroot ed@448: self.PLCprint = pluginsroot.logger.write edouard@453: self._Idxs = [] Lolitech@556: comport = int(comportstr[3:]) - 1 Lolitech@545: try: Lolitech@545: self.connect(comportstr) Lolitech@545: except Exception,e: Lolitech@545: self.pluginsroot.logger.write_error(str(e)+"\n") Lolitech@545: self.SerialConnection = None Lolitech@545: self.PLCStatus = "Disconnected" edouard@508: edouard@508: def HandleSerialTransaction(self, transaction): edouard@508: if self.SerialConnection is not None: edouard@508: try: edouard@508: self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction) edouard@508: return res Lolitech@545: except LPCProtoError,e: edouard@508: self.pluginsroot.logger.write_error(str(e)+"\n") edouard@508: self.SerialConnection = None edouard@508: self.PLCStatus = "Disconnected" edouard@508: return None Lolitech@545: ed@448: def StartPLC(self, debug=False): Lolitech@545: raise LPCProtoError("Not implemented") ed@448: ed@448: def StopPLC(self): Lolitech@545: raise LPCProtoError("Not implemented") ed@448: ed@448: def GetPLCstatus(self): Lolitech@545: raise LPCProtoError("Not implemented") ed@448: ed@448: def NewPLC(self, md5sum, data, extrafiles): Lolitech@545: raise LPCProtoError("Not implemented") ed@448: ed@448: def MatchMD5(self, MD5): Lolitech@545: raise LPCProtoError("Not implemented") edouard@502: edouard@502: def SetTraceVariablesList(self, idxs): Lolitech@545: raise LPCProtoError("Not implemented") edouard@502: ed@448: def GetTraceVariables(self): Lolitech@545: raise LPCProtoError("Not implemented") ed@448: