Go to the documentation of this file.00001 __author__ = 'tom1231'
00002 import struct
00003 from BAL.Header.RiCHeader import RiCHeader
00004 from BAL.Handlers.incomingHandler import PSET_REQ
00005
00006 MSG_LEN = 13
00007
00008 class SetParamRequest(RiCHeader):
00009 def __init__(self, devId, devType, fieldNum, val):
00010 RiCHeader.__init__(self)
00011
00012 self._id = PSET_REQ
00013 self._length = MSG_LEN
00014 self._des = 0x1001
00015 self._checkSum = 0
00016
00017 self._devId = devId
00018 self._devType = devType
00019 self._fieldNum = fieldNum
00020 self._val = val
00021
00022 self._checkSum = self.calCheckSum(self.dataTosend())
00023
00024 def dataTosend(self):
00025 return RiCHeader.dataTosend(self) \
00026 + struct.pack('<B', self._devId) \
00027 + struct.pack('<B', self._devType)\
00028 + struct.pack('<B', self._fieldNum)\
00029 + struct.pack('<f', self._val)
00030
00031