| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 13 家族行为信息 #tagMCFamilyActionInfo
|
| | |
|
| | | class tagMCFamilyAction(Structure):
|
| | | Time = 0 #(DWORD Time)//时间
|
| | | NameLen = 0 #(BYTE NameLen)
|
| | | Name = "" #(String Name)
|
| | | Value1 = 0 #(DWORD Value1)//数值1
|
| | | Value2 = 0 #(DWORD Value2)//数值2
|
| | | Value3 = 0 #(DWORD Value3)//数值3
|
| | | Value4 = 0 #(DWORD Value4)//数值4
|
| | | Value5 = 0 #(DWORD Value5)//数值5
|
| | | Value6 = 0 #(DWORD Value6)//数值6
|
| | | UseDataLen = 0 #(WORD UseDataLen)
|
| | | UseData = "" #(String UseData)
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | self.Time,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.NameLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Name,_pos = CommFunc.ReadString(_lpData, _pos,self.NameLen)
|
| | | self.Value1,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value2,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value3,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value4,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value5,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Value6,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.UseDataLen,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.UseData,_pos = CommFunc.ReadString(_lpData, _pos,self.UseDataLen)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Time = 0
|
| | | self.NameLen = 0
|
| | | self.Name = ""
|
| | | self.Value1 = 0
|
| | | self.Value2 = 0
|
| | | self.Value3 = 0
|
| | | self.Value4 = 0
|
| | | self.Value5 = 0
|
| | | self.Value6 = 0
|
| | | self.UseDataLen = 0
|
| | | self.UseData = ""
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += 4
|
| | | length += 1
|
| | | length += len(self.Name)
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 4
|
| | | length += 2
|
| | | length += len(self.UseData)
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteDWORD(data, self.Time)
|
| | | data = CommFunc.WriteBYTE(data, self.NameLen)
|
| | | data = CommFunc.WriteString(data, self.NameLen, self.Name)
|
| | | data = CommFunc.WriteDWORD(data, self.Value1)
|
| | | data = CommFunc.WriteDWORD(data, self.Value2)
|
| | | data = CommFunc.WriteDWORD(data, self.Value3)
|
| | | data = CommFunc.WriteDWORD(data, self.Value4)
|
| | | data = CommFunc.WriteDWORD(data, self.Value5)
|
| | | data = CommFunc.WriteDWORD(data, self.Value6)
|
| | | data = CommFunc.WriteWORD(data, self.UseDataLen)
|
| | | data = CommFunc.WriteString(data, self.UseDataLen, self.UseData)
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Time:%d,
|
| | | NameLen:%d,
|
| | | Name:%s,
|
| | | Value1:%d,
|
| | | Value2:%d,
|
| | | Value3:%d,
|
| | | Value4:%d,
|
| | | Value5:%d,
|
| | | Value6:%d,
|
| | | UseDataLen:%d,
|
| | | UseData:%s
|
| | | '''\
|
| | | %(
|
| | | self.Time,
|
| | | self.NameLen,
|
| | | self.Name,
|
| | | self.Value1,
|
| | | self.Value2,
|
| | | self.Value3,
|
| | | self.Value4,
|
| | | self.Value5,
|
| | | self.Value6,
|
| | | self.UseDataLen,
|
| | | self.UseData
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagMCFamilyActionInfo(Structure):
|
| | | Head = tagHead()
|
| | | FamilyID = 0 #(DWORD FamilyID)//家族ID
|
| | | ActionType = 0 #(BYTE ActionType)//类型
|
| | | Count = 0 #(WORD Count)//数量
|
| | | FamilyActionList = list() #(vector<tagMCFamilyAction> FamilyActionList)//size = Count |
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xA5
|
| | | self.Head.SubCmd = 0x13
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.FamilyID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.ActionType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | for i in range(self.Count):
|
| | | temFamilyActionList = tagMCFamilyAction()
|
| | | _pos = temFamilyActionList.ReadData(_lpData, _pos)
|
| | | self.FamilyActionList.append(temFamilyActionList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xA5
|
| | | self.Head.SubCmd = 0x13
|
| | | self.FamilyID = 0
|
| | | self.ActionType = 0
|
| | | self.Count = 0
|
| | | self.FamilyActionList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 2
|
| | | for i in range(self.Count):
|
| | | length += self.FamilyActionList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.FamilyID)
|
| | | data = CommFunc.WriteBYTE(data, self.ActionType)
|
| | | data = CommFunc.WriteWORD(data, self.Count)
|
| | | for i in range(self.Count):
|
| | | data = CommFunc.WriteString(data, self.FamilyActionList[i].GetLength(), self.FamilyActionList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | FamilyID:%d,
|
| | | ActionType:%d,
|
| | | Count:%d,
|
| | | FamilyActionList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.FamilyID,
|
| | | self.ActionType,
|
| | | self.Count,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCFamilyActionInfo=tagMCFamilyActionInfo()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFamilyActionInfo.Head.Cmd,m_NAtagMCFamilyActionInfo.Head.SubCmd))] = m_NAtagMCFamilyActionInfo
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # A5 02 家族活跃令兑换结果 #tagMCFamilyActivityExchangeResult
|
| | |
|
| | | class tagMCFamilyActivityExchangeResult(Structure):
|