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