Go to the documentation of this file.00001 """autogenerated by genpy from srs_msgs/DM_UIcom.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 DM_UIcom(genpy.Message):
00009 _md5sum = "9fdc3806df41868867572f18d50a7c34"
00010 _type = "srs_msgs/DM_UIcom"
00011 _has_header = False
00012 _full_text = """string command
00013 string message
00014 uint32 requestID
00015
00016 """
00017 __slots__ = ['command','message','requestID']
00018 _slot_types = ['string','string','uint32']
00019
00020 def __init__(self, *args, **kwds):
00021 """
00022 Constructor. Any message fields that are implicitly/explicitly
00023 set to None will be assigned a default value. The recommend
00024 use is keyword arguments as this is more robust to future message
00025 changes. You cannot mix in-order arguments and keyword arguments.
00026
00027 The available fields are:
00028 command,message,requestID
00029
00030 :param args: complete set of field values, in .msg order
00031 :param kwds: use keyword arguments corresponding to message field names
00032 to set specific fields.
00033 """
00034 if args or kwds:
00035 super(DM_UIcom, self).__init__(*args, **kwds)
00036
00037 if self.command is None:
00038 self.command = ''
00039 if self.message is None:
00040 self.message = ''
00041 if self.requestID is None:
00042 self.requestID = 0
00043 else:
00044 self.command = ''
00045 self.message = ''
00046 self.requestID = 0
00047
00048 def _get_types(self):
00049 """
00050 internal API method
00051 """
00052 return self._slot_types
00053
00054 def serialize(self, buff):
00055 """
00056 serialize message into buffer
00057 :param buff: buffer, ``StringIO``
00058 """
00059 try:
00060 _x = self.command
00061 length = len(_x)
00062 if python3 or type(_x) == unicode:
00063 _x = _x.encode('utf-8')
00064 length = len(_x)
00065 buff.write(struct.pack('<I%ss'%length, length, _x))
00066 _x = self.message
00067 length = len(_x)
00068 if python3 or type(_x) == unicode:
00069 _x = _x.encode('utf-8')
00070 length = len(_x)
00071 buff.write(struct.pack('<I%ss'%length, length, _x))
00072 buff.write(_struct_I.pack(self.requestID))
00073 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00074 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00075
00076 def deserialize(self, str):
00077 """
00078 unpack serialized message in str into this message instance
00079 :param str: byte array of serialized message, ``str``
00080 """
00081 try:
00082 end = 0
00083 start = end
00084 end += 4
00085 (length,) = _struct_I.unpack(str[start:end])
00086 start = end
00087 end += length
00088 if python3:
00089 self.command = str[start:end].decode('utf-8')
00090 else:
00091 self.command = str[start:end]
00092 start = end
00093 end += 4
00094 (length,) = _struct_I.unpack(str[start:end])
00095 start = end
00096 end += length
00097 if python3:
00098 self.message = str[start:end].decode('utf-8')
00099 else:
00100 self.message = str[start:end]
00101 start = end
00102 end += 4
00103 (self.requestID,) = _struct_I.unpack(str[start:end])
00104 return self
00105 except struct.error as e:
00106 raise genpy.DeserializationError(e)
00107
00108
00109 def serialize_numpy(self, buff, numpy):
00110 """
00111 serialize message with numpy array types into buffer
00112 :param buff: buffer, ``StringIO``
00113 :param numpy: numpy python module
00114 """
00115 try:
00116 _x = self.command
00117 length = len(_x)
00118 if python3 or type(_x) == unicode:
00119 _x = _x.encode('utf-8')
00120 length = len(_x)
00121 buff.write(struct.pack('<I%ss'%length, length, _x))
00122 _x = self.message
00123 length = len(_x)
00124 if python3 or type(_x) == unicode:
00125 _x = _x.encode('utf-8')
00126 length = len(_x)
00127 buff.write(struct.pack('<I%ss'%length, length, _x))
00128 buff.write(_struct_I.pack(self.requestID))
00129 except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00130 except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00131
00132 def deserialize_numpy(self, str, numpy):
00133 """
00134 unpack serialized message in str into this message instance using numpy for array types
00135 :param str: byte array of serialized message, ``str``
00136 :param numpy: numpy python module
00137 """
00138 try:
00139 end = 0
00140 start = end
00141 end += 4
00142 (length,) = _struct_I.unpack(str[start:end])
00143 start = end
00144 end += length
00145 if python3:
00146 self.command = str[start:end].decode('utf-8')
00147 else:
00148 self.command = str[start:end]
00149 start = end
00150 end += 4
00151 (length,) = _struct_I.unpack(str[start:end])
00152 start = end
00153 end += length
00154 if python3:
00155 self.message = str[start:end].decode('utf-8')
00156 else:
00157 self.message = str[start:end]
00158 start = end
00159 end += 4
00160 (self.requestID,) = _struct_I.unpack(str[start:end])
00161 return self
00162 except struct.error as e:
00163 raise genpy.DeserializationError(e)
00164
00165 _struct_I = genpy.struct_I