Edouard@0: #!/usr/bin/env python Edouard@0: # -*- coding: utf-8 -*- Edouard@0: Edouard@0: #This file is part of Beremiz, a Integrated Development Environment for Edouard@0: #programming IEC 61131-3 automates supporting plcopen standard and CanFestival. Edouard@0: # Edouard@0: #Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD Edouard@0: # Edouard@0: #See COPYING file for copyrights details. Edouard@0: # Edouard@0: #This library is free software; you can redistribute it and/or Edouard@0: #modify it under the terms of the GNU General Public Edouard@0: #License as published by the Free Software Foundation; either Edouard@0: #version 2.1 of the License, or (at your option) any later version. Edouard@0: # Edouard@0: #This library is distributed in the hope that it will be useful, Edouard@0: #but WITHOUT ANY WARRANTY; without even the implied warranty of Edouard@0: #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Edouard@0: #General Public License for more details. Edouard@0: # Edouard@0: #You should have received a copy of the GNU General Public Edouard@0: #License along with this library; if not, write to the Free Software Edouard@0: #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Edouard@0: Edouard@0: from LPCBootProto import * Edouard@0: from LPCObject import * Edouard@0: Edouard@0: class LPCBootObject(LPCObject): Edouard@0: def __init__(self, confnodesroot, comportstr): Edouard@0: LPCObject.__init__(self, confnodesroot, comportstr) Edouard@0: self.successfully_transfered = False Edouard@0: Edouard@0: def connect(self,comport): Edouard@0: self.SerialConnection = LPCBootProto(comport,#number Edouard@0: 115200, #speed Edouard@0: 120) #timeout Edouard@0: self.HandleSerialTransaction(KEEPBOOTINGTransaction()) Edouard@0: self.PLCStatus = "Stopped" Edouard@0: Edouard@0: def StartPLC(self, debug=False): Edouard@0: self.HandleSerialTransaction(STARTTransaction()) Edouard@0: Edouard@0: def NewPLC(self, md5sum, data, extrafiles): Edouard@0: self.successfully_transfered = self.HandleSerialTransaction(LOADTransaction(data, self.PLCprint)) Edouard@0: return self.successfully_transfered Edouard@0: Edouard@0: def MatchMD5(self, MD5): Edouard@0: res = self.HandleSerialTransaction(CHECKMD5Transaction(MD5)) Edouard@0: if res : Edouard@0: return "".join(res).find('FAILED') == -1 Edouard@0: return False Edouard@0: Edouard@0: Edouard@0: def SetTraceVariablesList(self, idxs): Edouard@0: pass Edouard@0: Edouard@0: def GetTraceVariables(self): Edouard@0: return self.PLCStatus, None, None Edouard@0: