--- a/LPCconnector/LPCAppObject.py Wed Mar 13 12:04:18 2013 +0900
+++ b/LPCconnector/LPCAppObject.py Tue Mar 19 17:22:27 2013 +0900
@@ -45,8 +45,11 @@
return self.PLCStatus
def GetPLCstatus(self):
- self.HandleSerialTransaction(GET_PLCIDTransaction())
- return self.PLCStatus
+ strcounts = self.HandleSerialTransaction(GET_LOGCOUNTSTransaction())
+ ccounts = ctypes.cast(
+ ctypes.c_char_p(strcounts),
+ ctypes.POINTER(ctypes.c_uint32))
+ return (self.PLCStatus,)+tuple(int(ccounts[idx]) for idx in range(4))
def MatchMD5(self, MD5):
data = self.HandleSerialTransaction(GET_PLCIDTransaction())
@@ -118,3 +121,11 @@
#PLCprint("Debug error - wrong buffer unpack !")
return self.PLCStatus, None, []
+ def GetLogMessage(self, level, msgid):
+ strbuf = self.HandleSerialTransaction(GET_LOGMSGTransaction(level, msgid))
+ if len(strbuf) > 12:
+ cbuf = ctypes.cast(
+ ctypes.c_char_p(strbuf[:12]),
+ ctypes.POINTER(ctypes.c_uint32))
+ return (strbuf[12:],)+tuple(int(cbuf[idx]) for idx in range(3))
+ return None