Go to the documentation of this file.00001 """autogenerated by genpy from continuous_ops_msgs/ChargeStatus.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 ChargeStatus(genpy.Message):
00009 _md5sum = "e45642af2ff8b37fd2f04277141299c7"
00010 _type = "continuous_ops_msgs/ChargeStatus"
00011 _has_header = False
00012 _full_text = """uint8 HAPPY = 0
00013 uint8 HUNGRY = 1
00014 uint8 STUFFED = 2
00015 uint8 battery_status
00016
00017 uint8 UNPLUGGED = 0
00018 uint8 CHARGING = 1
00019 uint8 charge_status
00020
00021 """
00022
00023 HAPPY = 0
00024 HUNGRY = 1
00025 STUFFED = 2
00026 UNPLUGGED = 0
00027 CHARGING = 1
00028
00029 __slots__ = ['battery_status','charge_status']
00030 _slot_types = ['uint8','uint8']
00031
00032 def __init__(self, *args, **kwds):
00033 """
00034 Constructor. Any message fields that are implicitly/explicitly
00035 set to None will be assigned a default value. The recommend
00036 use is keyword arguments as this is more robust to future message
00037 changes. You cannot mix in-order arguments and keyword arguments.
00038
00039 The available fields are:
00040 battery_status,charge_status
00041
00042 :param args: complete set of field values, in .msg order
00043 :param kwds: use keyword arguments corresponding to message field names
00044 to set specific fields.
00045 """
00046 if args or kwds:
00047 super(ChargeStatus, self).__init__(*args, **kwds)
00048
00049 if self.battery_status is None:
00050 self.battery_status = 0
00051 if self.charge_status is None:
00052 self.charge_status = 0
00053 else:
00054 self.battery_status = 0
00055 self.charge_status = 0
00056
00057 def _get_types(self):
00058 """
00059 internal API method
00060 """
00061 return self._slot_types
00062
00063 def serialize(self, buff):
00064 """
00065 serialize message into buffer
00066 :param buff: buffer, ``StringIO``
00067 """
00068 try:
00069 _x = self
00070 buff.write(_struct_2B.pack(_x.battery_status, _x.charge_status))
00071 except struct.error as se: self._check_types(se)
00072 except TypeError as te: self._check_types(te)
00073
00074 def deserialize(self, str):
00075 """
00076 unpack serialized message in str into this message instance
00077 :param str: byte array of serialized message, ``str``
00078 """
00079 try:
00080 end = 0
00081 _x = self
00082 start = end
00083 end += 2
00084 (_x.battery_status, _x.charge_status,) = _struct_2B.unpack(str[start:end])
00085 return self
00086 except struct.error as e:
00087 raise genpy.DeserializationError(e)
00088
00089
00090 def serialize_numpy(self, buff, numpy):
00091 """
00092 serialize message with numpy array types into buffer
00093 :param buff: buffer, ``StringIO``
00094 :param numpy: numpy python module
00095 """
00096 try:
00097 _x = self
00098 buff.write(_struct_2B.pack(_x.battery_status, _x.charge_status))
00099 except struct.error as se: self._check_types(se)
00100 except TypeError as te: self._check_types(te)
00101
00102 def deserialize_numpy(self, str, numpy):
00103 """
00104 unpack serialized message in str into this message instance using numpy for array types
00105 :param str: byte array of serialized message, ``str``
00106 :param numpy: numpy python module
00107 """
00108 try:
00109 end = 0
00110 _x = self
00111 start = end
00112 end += 2
00113 (_x.battery_status, _x.charge_status,) = _struct_2B.unpack(str[start:end])
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118 _struct_I = genpy.struct_I
00119 _struct_2B = struct.Struct("<2B")