$search
00001 """autogenerated by genmsg_py from TopicInfo.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class TopicInfo(roslib.message.Message): 00007 _md5sum = "63aa5e8f1bdd6f35c69fe1a1b9d28e9f" 00008 _type = "rosserial_msgs/TopicInfo" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """# special topic_ids 00011 uint16 ID_PUBLISHER=0 00012 uint16 ID_SUBSCRIBER=1 00013 uint16 ID_SERVICE_SERVER=2 00014 uint16 ID_SERVICE_CLIENT=4 00015 uint16 ID_PARAMETER_REQUEST=6 00016 uint16 ID_LOG=7 00017 uint16 ID_TIME=10 00018 00019 # The endpoint ID for this topic 00020 uint16 topic_id 00021 00022 string topic_name 00023 string message_type 00024 00025 # MD5 checksum for this message type 00026 string md5sum 00027 00028 # size of the buffer message must fit in 00029 int32 buffer_size 00030 00031 """ 00032 # Pseudo-constants 00033 ID_PUBLISHER = 0 00034 ID_SUBSCRIBER = 1 00035 ID_SERVICE_SERVER = 2 00036 ID_SERVICE_CLIENT = 4 00037 ID_PARAMETER_REQUEST = 6 00038 ID_LOG = 7 00039 ID_TIME = 10 00040 00041 __slots__ = ['topic_id','topic_name','message_type','md5sum','buffer_size'] 00042 _slot_types = ['uint16','string','string','string','int32'] 00043 00044 def __init__(self, *args, **kwds): 00045 """ 00046 Constructor. Any message fields that are implicitly/explicitly 00047 set to None will be assigned a default value. The recommend 00048 use is keyword arguments as this is more robust to future message 00049 changes. You cannot mix in-order arguments and keyword arguments. 00050 00051 The available fields are: 00052 topic_id,topic_name,message_type,md5sum,buffer_size 00053 00054 @param args: complete set of field values, in .msg order 00055 @param kwds: use keyword arguments corresponding to message field names 00056 to set specific fields. 00057 """ 00058 if args or kwds: 00059 super(TopicInfo, self).__init__(*args, **kwds) 00060 #message fields cannot be None, assign default values for those that are 00061 if self.topic_id is None: 00062 self.topic_id = 0 00063 if self.topic_name is None: 00064 self.topic_name = '' 00065 if self.message_type is None: 00066 self.message_type = '' 00067 if self.md5sum is None: 00068 self.md5sum = '' 00069 if self.buffer_size is None: 00070 self.buffer_size = 0 00071 else: 00072 self.topic_id = 0 00073 self.topic_name = '' 00074 self.message_type = '' 00075 self.md5sum = '' 00076 self.buffer_size = 0 00077 00078 def _get_types(self): 00079 """ 00080 internal API method 00081 """ 00082 return self._slot_types 00083 00084 def serialize(self, buff): 00085 """ 00086 serialize message into buffer 00087 @param buff: buffer 00088 @type buff: StringIO 00089 """ 00090 try: 00091 buff.write(_struct_H.pack(self.topic_id)) 00092 _x = self.topic_name 00093 length = len(_x) 00094 buff.write(struct.pack('<I%ss'%length, length, _x)) 00095 _x = self.message_type 00096 length = len(_x) 00097 buff.write(struct.pack('<I%ss'%length, length, _x)) 00098 _x = self.md5sum 00099 length = len(_x) 00100 buff.write(struct.pack('<I%ss'%length, length, _x)) 00101 buff.write(_struct_i.pack(self.buffer_size)) 00102 except struct.error as se: self._check_types(se) 00103 except TypeError as te: self._check_types(te) 00104 00105 def deserialize(self, str): 00106 """ 00107 unpack serialized message in str into this message instance 00108 @param str: byte array of serialized message 00109 @type str: str 00110 """ 00111 try: 00112 end = 0 00113 start = end 00114 end += 2 00115 (self.topic_id,) = _struct_H.unpack(str[start:end]) 00116 start = end 00117 end += 4 00118 (length,) = _struct_I.unpack(str[start:end]) 00119 start = end 00120 end += length 00121 self.topic_name = str[start:end] 00122 start = end 00123 end += 4 00124 (length,) = _struct_I.unpack(str[start:end]) 00125 start = end 00126 end += length 00127 self.message_type = 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.md5sum = str[start:end] 00134 start = end 00135 end += 4 00136 (self.buffer_size,) = _struct_i.unpack(str[start:end]) 00137 return self 00138 except struct.error as e: 00139 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00140 00141 00142 def serialize_numpy(self, buff, numpy): 00143 """ 00144 serialize message with numpy array types into buffer 00145 @param buff: buffer 00146 @type buff: StringIO 00147 @param numpy: numpy python module 00148 @type numpy module 00149 """ 00150 try: 00151 buff.write(_struct_H.pack(self.topic_id)) 00152 _x = self.topic_name 00153 length = len(_x) 00154 buff.write(struct.pack('<I%ss'%length, length, _x)) 00155 _x = self.message_type 00156 length = len(_x) 00157 buff.write(struct.pack('<I%ss'%length, length, _x)) 00158 _x = self.md5sum 00159 length = len(_x) 00160 buff.write(struct.pack('<I%ss'%length, length, _x)) 00161 buff.write(_struct_i.pack(self.buffer_size)) 00162 except struct.error as se: self._check_types(se) 00163 except TypeError as te: self._check_types(te) 00164 00165 def deserialize_numpy(self, str, numpy): 00166 """ 00167 unpack serialized message in str into this message instance using numpy for array types 00168 @param str: byte array of serialized message 00169 @type str: str 00170 @param numpy: numpy python module 00171 @type numpy: module 00172 """ 00173 try: 00174 end = 0 00175 start = end 00176 end += 2 00177 (self.topic_id,) = _struct_H.unpack(str[start:end]) 00178 start = end 00179 end += 4 00180 (length,) = _struct_I.unpack(str[start:end]) 00181 start = end 00182 end += length 00183 self.topic_name = str[start:end] 00184 start = end 00185 end += 4 00186 (length,) = _struct_I.unpack(str[start:end]) 00187 start = end 00188 end += length 00189 self.message_type = str[start:end] 00190 start = end 00191 end += 4 00192 (length,) = _struct_I.unpack(str[start:end]) 00193 start = end 00194 end += length 00195 self.md5sum = str[start:end] 00196 start = end 00197 end += 4 00198 (self.buffer_size,) = _struct_i.unpack(str[start:end]) 00199 return self 00200 except struct.error as e: 00201 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00202 00203 _struct_I = roslib.message.struct_I 00204 _struct_i = struct.Struct("<i") 00205 _struct_H = struct.Struct("<H")