Go to the documentation of this file.00001 __author__ = 'tom1231'
00002 import struct
00003 from BAL.Header.RiCHeader import RiCHeader
00004
00005 CHANNEL_1 = 10
00006 CHANNEL_2 = 14
00007 CHANNEL_3 = 18
00008 CHANNEL_4 = 22
00009 CHANNEL_5 = 26
00010 CHANNEL_6 = 30
00011 CHANNEL_7 = 34
00012 CHANNEL_8 = 38
00013
00014
00015 class PPMPublishResponse(RiCHeader):
00016 def __init__(self):
00017 RiCHeader.__init__(self)
00018 self._ch1 = 0.0
00019 self._ch2 = 0.0
00020 self._ch3 = 0.0
00021 self._ch4 = 0.0
00022 self._ch5 = 0.0
00023 self._ch6 = 0.0
00024 self._ch7 = 0.0
00025 self._ch8 = 0.0
00026
00027 def getChannels(self):
00028 return [self._ch1, self._ch2, self._ch3, self._ch4, self._ch5, self._ch6, self._ch7, self._ch8]
00029
00030 def buildRequest(self, data):
00031 RiCHeader.buildRequest(self, data)
00032 bytes = bytearray()
00033 while self.index < CHANNEL_1:
00034 bytes.append(data[self.index])
00035 self.index += 1
00036 self._ch1 = struct.unpack('<f', bytes)[0]
00037 bytes = bytearray()
00038 while self.index < CHANNEL_2:
00039 bytes.append(data[self.index])
00040 self.index += 1
00041 self._ch2 = struct.unpack('<f', bytes)[0]
00042 bytes = bytearray()
00043 while self.index < CHANNEL_3:
00044 bytes.append(data[self.index])
00045 self.index += 1
00046 self._ch3 = struct.unpack('<f', bytes)[0]
00047 bytes = bytearray()
00048 while self.index < CHANNEL_4:
00049 bytes.append(data[self.index])
00050 self.index += 1
00051 self._ch4 = struct.unpack('<f', bytes)[0]
00052 bytes = bytearray()
00053 while self.index < CHANNEL_5:
00054 bytes.append(data[self.index])
00055 self.index += 1
00056 self._ch5 = struct.unpack('<f', bytes)[0]
00057 bytes = bytearray()
00058 while self.index < CHANNEL_6:
00059 bytes.append(data[self.index])
00060 self.index += 1
00061 self._ch6 = struct.unpack('<f', bytes)[0]
00062 bytes = bytearray()
00063 while self.index < CHANNEL_7:
00064 bytes.append(data[self.index])
00065 self.index += 1
00066 self._ch7 = struct.unpack('<f', bytes)[0]
00067 bytes = bytearray()
00068 while self.index < CHANNEL_8:
00069 bytes.append(data[self.index])
00070 self.index += 1
00071 self._ch8 = struct.unpack('<f', bytes)[0]