00001 """autogenerated by genpy from adc_sub20/sub20_ADC_meas.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class sub20_ADC_meas(genpy.Message):
00010 _md5sum = "e5a875ce6bb2d936bd7c1ae33b9699ad"
00011 _type = "adc_sub20/sub20_ADC_meas"
00012 _has_header = True
00013 _full_text = """Header header
00014 string strIdSubDev
00015 uint16[] uiRaw
00016 float64[] fVolts
00017 ================================================================================
00018 MSG: std_msgs/Header
00019 # Standard metadata for higher-level stamped data types.
00020 # This is generally used to communicate timestamped data
00021 # in a particular coordinate frame.
00022 #
00023 # sequence ID: consecutively increasing ID
00024 uint32 seq
00025 #Two-integer timestamp that is expressed as:
00026 # * stamp.secs: seconds (stamp_secs) since epoch
00027 # * stamp.nsecs: nanoseconds since stamp_secs
00028 # time-handling sugar is provided by the client library
00029 time stamp
00030 #Frame this data is associated with
00031 # 0: no frame
00032 # 1: global frame
00033 string frame_id
00034
00035 """
00036 __slots__ = ['header','strIdSubDev','uiRaw','fVolts']
00037 _slot_types = ['std_msgs/Header','string','uint16[]','float64[]']
00038
00039 def __init__(self, *args, **kwds):
00040 """
00041 Constructor. Any message fields that are implicitly/explicitly
00042 set to None will be assigned a default value. The recommend
00043 use is keyword arguments as this is more robust to future message
00044 changes. You cannot mix in-order arguments and keyword arguments.
00045
00046 The available fields are:
00047 header,strIdSubDev,uiRaw,fVolts
00048
00049 :param args: complete set of field values, in .msg order
00050 :param kwds: use keyword arguments corresponding to message field names
00051 to set specific fields.
00052 """
00053 if args or kwds:
00054 super(sub20_ADC_meas, self).__init__(*args, **kwds)
00055
00056 if self.header is None:
00057 self.header = std_msgs.msg.Header()
00058 if self.strIdSubDev is None:
00059 self.strIdSubDev = ''
00060 if self.uiRaw is None:
00061 self.uiRaw = []
00062 if self.fVolts is None:
00063 self.fVolts = []
00064 else:
00065 self.header = std_msgs.msg.Header()
00066 self.strIdSubDev = ''
00067 self.uiRaw = []
00068 self.fVolts = []
00069
00070 def _get_types(self):
00071 """
00072 internal API method
00073 """
00074 return self._slot_types
00075
00076 def serialize(self, buff):
00077 """
00078 serialize message into buffer
00079 :param buff: buffer, ``StringIO``
00080 """
00081 try:
00082 _x = self
00083 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00084 _x = self.header.frame_id
00085 length = len(_x)
00086 if python3 or type(_x) == unicode:
00087 _x = _x.encode('utf-8')
00088 length = len(_x)
00089 buff.write(struct.pack('<I%ss'%length, length, _x))
00090 _x = self.strIdSubDev
00091 length = len(_x)
00092 if python3 or type(_x) == unicode:
00093 _x = _x.encode('utf-8')
00094 length = len(_x)
00095 buff.write(struct.pack('<I%ss'%length, length, _x))
00096 length = len(self.uiRaw)
00097 buff.write(_struct_I.pack(length))
00098 pattern = '<%sH'%length
00099 buff.write(struct.pack(pattern, *self.uiRaw))
00100 length = len(self.fVolts)
00101 buff.write(_struct_I.pack(length))
00102 pattern = '<%sd'%length
00103 buff.write(struct.pack(pattern, *self.fVolts))
00104 except struct.error as se: self._check_types(se)
00105 except TypeError as te: self._check_types(te)
00106
00107 def deserialize(self, str):
00108 """
00109 unpack serialized message in str into this message instance
00110 :param str: byte array of serialized message, ``str``
00111 """
00112 try:
00113 if self.header is None:
00114 self.header = std_msgs.msg.Header()
00115 end = 0
00116 _x = self
00117 start = end
00118 end += 12
00119 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00120 start = end
00121 end += 4
00122 (length,) = _struct_I.unpack(str[start:end])
00123 start = end
00124 end += length
00125 if python3:
00126 self.header.frame_id = str[start:end].decode('utf-8')
00127 else:
00128 self.header.frame_id = str[start:end]
00129 start = end
00130 end += 4
00131 (length,) = _struct_I.unpack(str[start:end])
00132 start = end
00133 end += length
00134 if python3:
00135 self.strIdSubDev = str[start:end].decode('utf-8')
00136 else:
00137 self.strIdSubDev = str[start:end]
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 pattern = '<%sH'%length
00142 start = end
00143 end += struct.calcsize(pattern)
00144 self.uiRaw = struct.unpack(pattern, str[start:end])
00145 start = end
00146 end += 4
00147 (length,) = _struct_I.unpack(str[start:end])
00148 pattern = '<%sd'%length
00149 start = end
00150 end += struct.calcsize(pattern)
00151 self.fVolts = struct.unpack(pattern, str[start:end])
00152 return self
00153 except struct.error as e:
00154 raise genpy.DeserializationError(e)
00155
00156
00157 def serialize_numpy(self, buff, numpy):
00158 """
00159 serialize message with numpy array types into buffer
00160 :param buff: buffer, ``StringIO``
00161 :param numpy: numpy python module
00162 """
00163 try:
00164 _x = self
00165 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00166 _x = self.header.frame_id
00167 length = len(_x)
00168 if python3 or type(_x) == unicode:
00169 _x = _x.encode('utf-8')
00170 length = len(_x)
00171 buff.write(struct.pack('<I%ss'%length, length, _x))
00172 _x = self.strIdSubDev
00173 length = len(_x)
00174 if python3 or type(_x) == unicode:
00175 _x = _x.encode('utf-8')
00176 length = len(_x)
00177 buff.write(struct.pack('<I%ss'%length, length, _x))
00178 length = len(self.uiRaw)
00179 buff.write(_struct_I.pack(length))
00180 pattern = '<%sH'%length
00181 buff.write(self.uiRaw.tostring())
00182 length = len(self.fVolts)
00183 buff.write(_struct_I.pack(length))
00184 pattern = '<%sd'%length
00185 buff.write(self.fVolts.tostring())
00186 except struct.error as se: self._check_types(se)
00187 except TypeError as te: self._check_types(te)
00188
00189 def deserialize_numpy(self, str, numpy):
00190 """
00191 unpack serialized message in str into this message instance using numpy for array types
00192 :param str: byte array of serialized message, ``str``
00193 :param numpy: numpy python module
00194 """
00195 try:
00196 if self.header is None:
00197 self.header = std_msgs.msg.Header()
00198 end = 0
00199 _x = self
00200 start = end
00201 end += 12
00202 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00203 start = end
00204 end += 4
00205 (length,) = _struct_I.unpack(str[start:end])
00206 start = end
00207 end += length
00208 if python3:
00209 self.header.frame_id = str[start:end].decode('utf-8')
00210 else:
00211 self.header.frame_id = str[start:end]
00212 start = end
00213 end += 4
00214 (length,) = _struct_I.unpack(str[start:end])
00215 start = end
00216 end += length
00217 if python3:
00218 self.strIdSubDev = str[start:end].decode('utf-8')
00219 else:
00220 self.strIdSubDev = str[start:end]
00221 start = end
00222 end += 4
00223 (length,) = _struct_I.unpack(str[start:end])
00224 pattern = '<%sH'%length
00225 start = end
00226 end += struct.calcsize(pattern)
00227 self.uiRaw = numpy.frombuffer(str[start:end], dtype=numpy.uint16, count=length)
00228 start = end
00229 end += 4
00230 (length,) = _struct_I.unpack(str[start:end])
00231 pattern = '<%sd'%length
00232 start = end
00233 end += struct.calcsize(pattern)
00234 self.fVolts = numpy.frombuffer(str[start:end], dtype=numpy.float64, count=length)
00235 return self
00236 except struct.error as e:
00237 raise genpy.DeserializationError(e)
00238
00239 _struct_I = genpy.struct_I
00240 _struct_3I = struct.Struct("<3I")