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