| | |
| | | #------------------------------------------------------
|
| | | # B2 17 古宝升星 #tagCMGubaoStarUp
|
| | |
|
| | | class tagCMGubaoStarUp(Structure):
|
| | | class tagCMGubaoPieceUse(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("GubaoID", c_ushort), |
| | | ("GubaoID", c_ushort), # 通用碎片古宝ID
|
| | | ("PieceCount", c_ushort), # 使用碎片个数
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x17
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | |
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB2
|
| | | self.SubCmd = 0x17
|
| | | self.GubaoID = 0
|
| | | self.PieceCount = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMGubaoStarUp)
|
| | | return sizeof(tagCMGubaoPieceUse)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B2 17 古宝升星 //tagCMGubaoStarUp:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | GubaoID:%d
|
| | | GubaoID:%d,
|
| | | PieceCount:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.GubaoID
|
| | | self.GubaoID,
|
| | | self.PieceCount
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | class tagCMGubaoStarUp(Structure):
|
| | | Head = tagHead()
|
| | | GubaoID = 0 #(WORD GubaoID)
|
| | | PieceSelectCount = 0 #(BYTE PieceSelectCount)
|
| | | CommPieceUseList = list() #(vector<tagCMGubaoPieceUse> CommPieceUseList)// 通用古宝碎片使用列表
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB2
|
| | | self.Head.SubCmd = 0x17
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.GubaoID,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.PieceSelectCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.PieceSelectCount):
|
| | | temCommPieceUseList = tagCMGubaoPieceUse()
|
| | | _pos = temCommPieceUseList.ReadData(_lpData, _pos)
|
| | | self.CommPieceUseList.append(temCommPieceUseList)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB2
|
| | | self.Head.SubCmd = 0x17
|
| | | self.GubaoID = 0
|
| | | self.PieceSelectCount = 0
|
| | | self.CommPieceUseList = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 2
|
| | | length += 1
|
| | | for i in range(self.PieceSelectCount):
|
| | | length += self.CommPieceUseList[i].GetLength()
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteWORD(data, self.GubaoID)
|
| | | data = CommFunc.WriteBYTE(data, self.PieceSelectCount)
|
| | | for i in range(self.PieceSelectCount):
|
| | | data = CommFunc.WriteString(data, self.CommPieceUseList[i].GetLength(), self.CommPieceUseList[i].GetBuffer())
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | GubaoID:%d,
|
| | | PieceSelectCount:%d,
|
| | | CommPieceUseList:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.GubaoID,
|
| | | self.PieceSelectCount,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMGubaoStarUp=tagCMGubaoStarUp()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Cmd,m_NAtagCMGubaoStarUp.SubCmd))] = m_NAtagCMGubaoStarUp
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMGubaoStarUp.Head.Cmd,m_NAtagCMGubaoStarUp.Head.SubCmd))] = m_NAtagCMGubaoStarUp
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|