00001 from BAL.Header.Response.ParamBuildResponse import ParamBuildResponse, Battery 00002 import struct 00003 00004 __author__ = 'tom1231' 00005 00006 MSG_LEN = 18 00007 00008 class BatteryParamResponse(ParamBuildResponse): 00009 00010 def __init__(self, param): 00011 ParamBuildResponse.__init__(self, Battery, 0, param.getBatteryPubHz()) 00012 self._length = MSG_LEN 00013 self._checkSum = 0 00014 self._voltageDividerRatio = param.getBatteryVoltageDividerRatio() 00015 00016 self._checkSum = self.calCheckSum(self.dataTosend()) 00017 00018 def dataTosend(self): 00019 return ParamBuildResponse.dataTosend(self) \ 00020 + struct.pack('<f', self._voltageDividerRatio) 00021