00001 """autogenerated by genpy from industrial_msgs/DeviceInfo.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 DeviceInfo(genpy.Message):
00009 _md5sum = "373ed7fa0fac92d443be9cd5198e80f0"
00010 _type = "industrial_msgs/DeviceInfo"
00011 _has_header = False
00012 _full_text = """# Device info captures device agnostic information about a piece of hardware.
00013 # This message is meant as a generic as possible. Items that don't apply should
00014 # be left blank. This message is not meant to replace diagnostic messages, but
00015 # rather provide a standard service message that can be used to populate standard
00016 # components (like a GUI for example)
00017
00018 string model
00019 string serial_number
00020 string hw_version
00021 string sw_version
00022 string address
00023
00024 """
00025 __slots__ = ['model','serial_number','hw_version','sw_version','address']
00026 _slot_types = ['string','string','string','string','string']
00027
00028 def __init__(self, *args, **kwds):
00029 """
00030 Constructor. Any message fields that are implicitly/explicitly
00031 set to None will be assigned a default value. The recommend
00032 use is keyword arguments as this is more robust to future message
00033 changes. You cannot mix in-order arguments and keyword arguments.
00034
00035 The available fields are:
00036 model,serial_number,hw_version,sw_version,address
00037
00038 :param args: complete set of field values, in .msg order
00039 :param kwds: use keyword arguments corresponding to message field names
00040 to set specific fields.
00041 """
00042 if args or kwds:
00043 super(DeviceInfo, self).__init__(*args, **kwds)
00044
00045 if self.model is None:
00046 self.model = ''
00047 if self.serial_number is None:
00048 self.serial_number = ''
00049 if self.hw_version is None:
00050 self.hw_version = ''
00051 if self.sw_version is None:
00052 self.sw_version = ''
00053 if self.address is None:
00054 self.address = ''
00055 else:
00056 self.model = ''
00057 self.serial_number = ''
00058 self.hw_version = ''
00059 self.sw_version = ''
00060 self.address = ''
00061
00062 def _get_types(self):
00063 """
00064 internal API method
00065 """
00066 return self._slot_types
00067
00068 def serialize(self, buff):
00069 """
00070 serialize message into buffer
00071 :param buff: buffer, ``StringIO``
00072 """
00073 try:
00074 _x = self.model
00075 length = len(_x)
00076 if python3 or type(_x) == unicode:
00077 _x = _x.encode('utf-8')
00078 length = len(_x)
00079 buff.write(struct.pack('<I%ss'%length, length, _x))
00080 _x = self.serial_number
00081 length = len(_x)
00082 if python3 or type(_x) == unicode:
00083 _x = _x.encode('utf-8')
00084 length = len(_x)
00085 buff.write(struct.pack('<I%ss'%length, length, _x))
00086 _x = self.hw_version
00087 length = len(_x)
00088 if python3 or type(_x) == unicode:
00089 _x = _x.encode('utf-8')
00090 length = len(_x)
00091 buff.write(struct.pack('<I%ss'%length, length, _x))
00092 _x = self.sw_version
00093 length = len(_x)
00094 if python3 or type(_x) == unicode:
00095 _x = _x.encode('utf-8')
00096 length = len(_x)
00097 buff.write(struct.pack('<I%ss'%length, length, _x))
00098 _x = self.address
00099 length = len(_x)
00100 if python3 or type(_x) == unicode:
00101 _x = _x.encode('utf-8')
00102 length = len(_x)
00103 buff.write(struct.pack('<I%ss'%length, length, _x))
00104 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00105 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
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 end = 0
00114 start = end
00115 end += 4
00116 (length,) = _struct_I.unpack(str[start:end])
00117 start = end
00118 end += length
00119 if python3:
00120 self.model = str[start:end].decode('utf-8')
00121 else:
00122 self.model = str[start:end]
00123 start = end
00124 end += 4
00125 (length,) = _struct_I.unpack(str[start:end])
00126 start = end
00127 end += length
00128 if python3:
00129 self.serial_number = str[start:end].decode('utf-8')
00130 else:
00131 self.serial_number = str[start:end]
00132 start = end
00133 end += 4
00134 (length,) = _struct_I.unpack(str[start:end])
00135 start = end
00136 end += length
00137 if python3:
00138 self.hw_version = str[start:end].decode('utf-8')
00139 else:
00140 self.hw_version = str[start:end]
00141 start = end
00142 end += 4
00143 (length,) = _struct_I.unpack(str[start:end])
00144 start = end
00145 end += length
00146 if python3:
00147 self.sw_version = str[start:end].decode('utf-8')
00148 else:
00149 self.sw_version = str[start:end]
00150 start = end
00151 end += 4
00152 (length,) = _struct_I.unpack(str[start:end])
00153 start = end
00154 end += length
00155 if python3:
00156 self.address = str[start:end].decode('utf-8')
00157 else:
00158 self.address = str[start:end]
00159 return self
00160 except struct.error as e:
00161 raise genpy.DeserializationError(e)
00162
00163
00164 def serialize_numpy(self, buff, numpy):
00165 """
00166 serialize message with numpy array types into buffer
00167 :param buff: buffer, ``StringIO``
00168 :param numpy: numpy python module
00169 """
00170 try:
00171 _x = self.model
00172 length = len(_x)
00173 if python3 or type(_x) == unicode:
00174 _x = _x.encode('utf-8')
00175 length = len(_x)
00176 buff.write(struct.pack('<I%ss'%length, length, _x))
00177 _x = self.serial_number
00178 length = len(_x)
00179 if python3 or type(_x) == unicode:
00180 _x = _x.encode('utf-8')
00181 length = len(_x)
00182 buff.write(struct.pack('<I%ss'%length, length, _x))
00183 _x = self.hw_version
00184 length = len(_x)
00185 if python3 or type(_x) == unicode:
00186 _x = _x.encode('utf-8')
00187 length = len(_x)
00188 buff.write(struct.pack('<I%ss'%length, length, _x))
00189 _x = self.sw_version
00190 length = len(_x)
00191 if python3 or type(_x) == unicode:
00192 _x = _x.encode('utf-8')
00193 length = len(_x)
00194 buff.write(struct.pack('<I%ss'%length, length, _x))
00195 _x = self.address
00196 length = len(_x)
00197 if python3 or type(_x) == unicode:
00198 _x = _x.encode('utf-8')
00199 length = len(_x)
00200 buff.write(struct.pack('<I%ss'%length, length, _x))
00201 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00202 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00203
00204 def deserialize_numpy(self, str, numpy):
00205 """
00206 unpack serialized message in str into this message instance using numpy for array types
00207 :param str: byte array of serialized message, ``str``
00208 :param numpy: numpy python module
00209 """
00210 try:
00211 end = 0
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.model = str[start:end].decode('utf-8')
00219 else:
00220 self.model = str[start:end]
00221 start = end
00222 end += 4
00223 (length,) = _struct_I.unpack(str[start:end])
00224 start = end
00225 end += length
00226 if python3:
00227 self.serial_number = str[start:end].decode('utf-8')
00228 else:
00229 self.serial_number = str[start:end]
00230 start = end
00231 end += 4
00232 (length,) = _struct_I.unpack(str[start:end])
00233 start = end
00234 end += length
00235 if python3:
00236 self.hw_version = str[start:end].decode('utf-8')
00237 else:
00238 self.hw_version = str[start:end]
00239 start = end
00240 end += 4
00241 (length,) = _struct_I.unpack(str[start:end])
00242 start = end
00243 end += length
00244 if python3:
00245 self.sw_version = str[start:end].decode('utf-8')
00246 else:
00247 self.sw_version = str[start:end]
00248 start = end
00249 end += 4
00250 (length,) = _struct_I.unpack(str[start:end])
00251 start = end
00252 end += length
00253 if python3:
00254 self.address = str[start:end].decode('utf-8')
00255 else:
00256 self.address = str[start:end]
00257 return self
00258 except struct.error as e:
00259 raise genpy.DeserializationError(e)
00260
00261 _struct_I = genpy.struct_I