Go to the documentation of this file.00001 __author__ = 'tom1231'
00002 import struct
00003 from BAL.Header.RiCHeader import RiCHeader
00004
00005 ID_LEN = 7
00006 STATUS_LEN = 8
00007
00008 class SwitchResponse(RiCHeader):
00009 def __init__(self):
00010 RiCHeader.__init__(self)
00011 self._switchNum = 0
00012 self._status = 0
00013
00014 def buildRequest(self, data):
00015 RiCHeader.buildRequest(self, data)
00016 bytes = bytearray()
00017 while self.index < ID_LEN:
00018 bytes.append(data[self.index])
00019 self.index += 1
00020 self._switchNum = struct.unpack('<B', bytes)[0]
00021
00022 bytes = bytearray()
00023 while self.index < STATUS_LEN:
00024 bytes.append(data[self.index])
00025 self.index += 1
00026 self._status = struct.unpack('<?', bytes)[0]
00027
00028 def getSwitchNum(self):
00029 return self._switchNum
00030
00031 def getStatus(self):
00032 return self._status == 1
00033
00034