author | Lolitech |
Fri, 04 Jun 2010 15:11:27 +0200 | |
changeset 557 | b155ada1c14a |
parent 548 | 1428fd553988 |
child 567 | 72b51ec5be64 |
permissions | -rw-r--r-- |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
2 |
# -*- coding: utf-8 -*- |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
3 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
4 |
#This file is part of Beremiz, a Integrated Development Environment for |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
5 |
#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
6 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
8 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
9 |
#See COPYING file for copyrights details. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
10 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
11 |
#This library is free software; you can redistribute it and/or |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
12 |
#modify it under the terms of the GNU General Public |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
13 |
#License as published by the Free Software Foundation; either |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
15 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
16 |
#This library is distributed in the hope that it will be useful, |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
19 |
#General Public License for more details. |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
20 |
# |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
21 |
#You should have received a copy of the GNU General Public |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
22 |
#License along with this library; if not, write to the Free Software |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
24 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
25 |
from LPCBootProto import * |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
26 |
from LPCObject import * |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
27 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
28 |
class LPCBootObject(LPCObject): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
29 |
def __init__(self, pluginsroot, comportstr): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
30 |
LPCObject.__init__(self, pluginsroot, comportstr) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
31 |
self.successfully_transfered = False |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
32 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
33 |
def connect(self,comport): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
34 |
self.SerialConnection = LPCBootProto(comport,#number |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
35 |
115200, #speed |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
36 |
120) #timeout |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
37 |
self.PLCStatus = "Stopped" |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
38 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
39 |
def NewPLC(self, md5sum, data, extrafiles): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
40 |
self.successfully_transfered = self.HandleSerialTransaction(LOADTransaction(data)) |
548 | 41 |
return self.successfully_transfered |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
42 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
43 |
def MatchMD5(self, MD5): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
44 |
return self.successfully_transfered |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
45 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
46 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
47 |
def SetTraceVariablesList(self, idxs): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
48 |
pass |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
49 |
|
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
50 |
def GetTraceVariables(self): |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
51 |
return self.PLCStatus, None, None |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
diff
changeset
|
52 |