author | laurent |
Fri, 04 Jun 2010 15:39:14 +0200 | |
changeset 561 | 4cc6eef4778f |
parent 556 | 1ad4e7f1e89e |
child 563 | c74a37d156df |
permissions | -rwxr-xr-x |
448 | 1 |
#!/usr/bin/env python |
2 |
# -*- coding: utf-8 -*- |
|
3 |
||
4 |
#This file is part of Beremiz, a Integrated Development Environment for |
|
5 |
#programming IEC 61131-3 automates supporting plcopen standard and CanFestival. |
|
6 |
# |
|
7 |
#Copyright (C) 2007: Edouard TISSERANT and Laurent BESSARD |
|
8 |
# |
|
9 |
#See COPYING file for copyrights details. |
|
10 |
# |
|
11 |
#This library is free software; you can redistribute it and/or |
|
12 |
#modify it under the terms of the GNU General Public |
|
13 |
#License as published by the Free Software Foundation; either |
|
14 |
#version 2.1 of the License, or (at your option) any later version. |
|
15 |
# |
|
16 |
#This library is distributed in the hope that it will be useful, |
|
17 |
#but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
18 |
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
19 |
#General Public License for more details. |
|
20 |
# |
|
21 |
#You should have received a copy of the GNU General Public |
|
22 |
#License along with this library; if not, write to the Free Software |
|
23 |
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
24 |
||
453 | 25 |
from LPCProto import * |
448 | 26 |
|
27 |
class LPCObject(): |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
28 |
def __init__(self, pluginsroot, comportstr): |
508 | 29 |
self.PLCStatus = "Disconnected" |
448 | 30 |
self.pluginsroot = pluginsroot |
31 |
self.PLCprint = pluginsroot.logger.write |
|
453 | 32 |
self._Idxs = [] |
556
1ad4e7f1e89e
LPC Composer don't send comma at the end of serial port name.
Lolitech
parents:
545
diff
changeset
|
33 |
comport = int(comportstr[3:]) - 1 |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
34 |
try: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
35 |
self.connect(comportstr) |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
36 |
except Exception,e: |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
37 |
self.pluginsroot.logger.write_error(str(e)+"\n") |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
38 |
self.SerialConnection = None |
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
39 |
self.PLCStatus = "Disconnected" |
508 | 40 |
|
41 |
def HandleSerialTransaction(self, transaction): |
|
42 |
if self.SerialConnection is not None: |
|
43 |
try: |
|
44 |
self.PLCStatus, res = self.SerialConnection.HandleTransaction(transaction) |
|
45 |
return res |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
46 |
except LPCProtoError,e: |
508 | 47 |
self.pluginsroot.logger.write_error(str(e)+"\n") |
48 |
self.SerialConnection = None |
|
49 |
self.PLCStatus = "Disconnected" |
|
50 |
return None |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
51 |
|
448 | 52 |
def StartPLC(self, debug=False): |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
53 |
raise LPCProtoError("Not implemented") |
448 | 54 |
|
55 |
def StopPLC(self): |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
56 |
raise LPCProtoError("Not implemented") |
448 | 57 |
|
58 |
def GetPLCstatus(self): |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
59 |
raise LPCProtoError("Not implemented") |
448 | 60 |
|
61 |
def NewPLC(self, md5sum, data, extrafiles): |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
62 |
raise LPCProtoError("Not implemented") |
448 | 63 |
|
64 |
def MatchMD5(self, MD5): |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
65 |
raise LPCProtoError("Not implemented") |
502 | 66 |
|
67 |
def SetTraceVariablesList(self, idxs): |
|
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
68 |
raise LPCProtoError("Not implemented") |
502 | 69 |
|
448 | 70 |
def GetTraceVariables(self): |
545
627e5c636a4f
Refactored LPC connector for new bootloader and application modes
Lolitech
parents:
525
diff
changeset
|
71 |
raise LPCProtoError("Not implemented") |
448 | 72 |