| | |
| | | else:
|
| | | self.Operate = Str[:15]
|
| | |
|
| | | |
| | |
|
| | | # 事件触发表 #tagDBEventTrig
|
| | | class tagDBEventTrig(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ('EventLen', ctypes.c_ulong),
|
| | | ('EventID', ctypes.c_char_p),
|
| | | ('EventValue', ctypes.c_ulong),
|
| | | ('ADOResult', ctypes.c_ulong),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | Structure.__init__(self)
|
| | | self.clear()
|
| | |
|
| | | def clear(self):
|
| | | self.EventLen = 0
|
| | | self.EventID = ''
|
| | | self.EventValue = 0
|
| | |
|
| | | def readData(self, buf, pos = 0, length = 0):
|
| | | if not pos <= length:
|
| | | return -1
|
| | | if len(buf) < pos + self.getLength():
|
| | | return -1
|
| | | self.clear()
|
| | | self.EventLen, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | tmp, pos = CommFunc.ReadString(buf, pos, self.EventLen)
|
| | | self.EventID = ctypes.c_char_p(tmp)
|
| | | self.EventValue, pos = CommFunc.ReadDWORD(buf, pos)
|
| | | return self.getLength()
|
| | |
|
| | | def getBuffer(self):
|
| | | buf = ''
|
| | | buf = CommFunc.WriteDWORD(buf, self.EventLen)
|
| | | buf = CommFunc.WriteString(buf, self.EventLen, self.EventID)
|
| | | buf = CommFunc.WriteDWORD(buf, self.EventValue)
|
| | | return buf
|
| | |
|
| | | def getLength(self):
|
| | | length = 0
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | length += self.EventLen
|
| | | length += sizeof(ctypes.c_ulong)
|
| | | return length
|
| | |
|
| | | def outputString(self):
|
| | | output = '''// 事件触发表 #tagDBEventTrig:
|
| | | EventLen = %s,
|
| | | EventID = %s,
|
| | | EventValue = %s,
|
| | | ADOResult = %s,
|
| | | '''%(
|
| | | self.EventLen,
|
| | | self.EventID,
|
| | | self.EventValue,
|
| | | self.ADOResult,
|
| | | )
|
| | | return output
|
| | |
|
| | |
|
| | | # 家族表 #tagDBFamily
|
| | | class tagDBFamily(Structure):
|
| | | _pack_ = 1
|