00001 """autogenerated by genpy from tibi_dabo_msgs/battery_status.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007
00008 class battery_status(genpy.Message):
00009 _md5sum = "9cc10a535f6582725be65cc15269919b"
00010 _type = "tibi_dabo_msgs/battery_status"
00011 _has_header = False
00012 _full_text = """float64 voltage
00013 float64 temperature
00014 uint8 status
00015 float64 input_current
00016 float64 output_current
00017 float64 remaining_capacity
00018 float64 time_to_charged
00019 float64 time_to_discharged
00020
00021 """
00022 __slots__ = ['voltage','temperature','status','input_current','output_current','remaining_capacity','time_to_charged','time_to_discharged']
00023 _slot_types = ['float64','float64','uint8','float64','float64','float64','float64','float64']
00024
00025 def __init__(self, *args, **kwds):
00026 """
00027 Constructor. Any message fields that are implicitly/explicitly
00028 set to None will be assigned a default value. The recommend
00029 use is keyword arguments as this is more robust to future message
00030 changes. You cannot mix in-order arguments and keyword arguments.
00031
00032 The available fields are:
00033 voltage,temperature,status,input_current,output_current,remaining_capacity,time_to_charged,time_to_discharged
00034
00035 :param args: complete set of field values, in .msg order
00036 :param kwds: use keyword arguments corresponding to message field names
00037 to set specific fields.
00038 """
00039 if args or kwds:
00040 super(battery_status, self).__init__(*args, **kwds)
00041
00042 if self.voltage is None:
00043 self.voltage = 0.
00044 if self.temperature is None:
00045 self.temperature = 0.
00046 if self.status is None:
00047 self.status = 0
00048 if self.input_current is None:
00049 self.input_current = 0.
00050 if self.output_current is None:
00051 self.output_current = 0.
00052 if self.remaining_capacity is None:
00053 self.remaining_capacity = 0.
00054 if self.time_to_charged is None:
00055 self.time_to_charged = 0.
00056 if self.time_to_discharged is None:
00057 self.time_to_discharged = 0.
00058 else:
00059 self.voltage = 0.
00060 self.temperature = 0.
00061 self.status = 0
00062 self.input_current = 0.
00063 self.output_current = 0.
00064 self.remaining_capacity = 0.
00065 self.time_to_charged = 0.
00066 self.time_to_discharged = 0.
00067
00068 def _get_types(self):
00069 """
00070 internal API method
00071 """
00072 return self._slot_types
00073
00074 def serialize(self, buff):
00075 """
00076 serialize message into buffer
00077 :param buff: buffer, ``StringIO``
00078 """
00079 try:
00080 _x = self
00081 buff.write(_struct_2dB5d.pack(_x.voltage, _x.temperature, _x.status, _x.input_current, _x.output_current, _x.remaining_capacity, _x.time_to_charged, _x.time_to_discharged))
00082 except struct.error as se: self._check_types(se)
00083 except TypeError as te: self._check_types(te)
00084
00085 def deserialize(self, str):
00086 """
00087 unpack serialized message in str into this message instance
00088 :param str: byte array of serialized message, ``str``
00089 """
00090 try:
00091 end = 0
00092 _x = self
00093 start = end
00094 end += 57
00095 (_x.voltage, _x.temperature, _x.status, _x.input_current, _x.output_current, _x.remaining_capacity, _x.time_to_charged, _x.time_to_discharged,) = _struct_2dB5d.unpack(str[start:end])
00096 return self
00097 except struct.error as e:
00098 raise genpy.DeserializationError(e)
00099
00100
00101 def serialize_numpy(self, buff, numpy):
00102 """
00103 serialize message with numpy array types into buffer
00104 :param buff: buffer, ``StringIO``
00105 :param numpy: numpy python module
00106 """
00107 try:
00108 _x = self
00109 buff.write(_struct_2dB5d.pack(_x.voltage, _x.temperature, _x.status, _x.input_current, _x.output_current, _x.remaining_capacity, _x.time_to_charged, _x.time_to_discharged))
00110 except struct.error as se: self._check_types(se)
00111 except TypeError as te: self._check_types(te)
00112
00113 def deserialize_numpy(self, str, numpy):
00114 """
00115 unpack serialized message in str into this message instance using numpy for array types
00116 :param str: byte array of serialized message, ``str``
00117 :param numpy: numpy python module
00118 """
00119 try:
00120 end = 0
00121 _x = self
00122 start = end
00123 end += 57
00124 (_x.voltage, _x.temperature, _x.status, _x.input_current, _x.output_current, _x.remaining_capacity, _x.time_to_charged, _x.time_to_discharged,) = _struct_2dB5d.unpack(str[start:end])
00125 return self
00126 except struct.error as e:
00127 raise genpy.DeserializationError(e)
00128
00129 _struct_I = genpy.struct_I
00130 _struct_2dB5d = struct.Struct("<2dB5d")