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