00001 """autogenerated by genmsg_py from TestInfoArray.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import pr2_self_test_msgs.msg
00006
00007 class TestInfoArray(roslib.message.Message):
00008 _md5sum = "1ed4c76da9520649c668cc322d33542a"
00009 _type = "pr2_self_test_msgs/TestInfoArray"
00010 _has_header = False
00011 _full_text = """TestInfo[] data
00012 ================================================================================
00013 MSG: pr2_self_test_msgs/TestInfo
00014 string serial
00015 string test_name
00016 byte test_status # 127, not launched, 0, ok; 1, warn; 2, error; 3, stale
00017 string bay_name
00018 string machine
00019 int32 board
00020 int32 breaker
00021 string power_status
00022 byte estop # 0, off; 1, on
00023 int32 elapsed
00024 string status_msg
00025 """
00026 __slots__ = ['data']
00027 _slot_types = ['pr2_self_test_msgs/TestInfo[]']
00028
00029 def __init__(self, *args, **kwds):
00030 """
00031 Constructor. Any message fields that are implicitly/explicitly
00032 set to None will be assigned a default value. The recommend
00033 use is keyword arguments as this is more robust to future message
00034 changes. You cannot mix in-order arguments and keyword arguments.
00035
00036 The available fields are:
00037 data
00038
00039 @param args: complete set of field values, in .msg order
00040 @param kwds: use keyword arguments corresponding to message field names
00041 to set specific fields.
00042 """
00043 if args or kwds:
00044 super(TestInfoArray, self).__init__(*args, **kwds)
00045
00046 if self.data is None:
00047 self.data = []
00048 else:
00049 self.data = []
00050
00051 def _get_types(self):
00052 """
00053 internal API method
00054 """
00055 return self._slot_types
00056
00057 def serialize(self, buff):
00058 """
00059 serialize message into buffer
00060 @param buff: buffer
00061 @type buff: StringIO
00062 """
00063 try:
00064 length = len(self.data)
00065 buff.write(_struct_I.pack(length))
00066 for val1 in self.data:
00067 _x = val1.serial
00068 length = len(_x)
00069 buff.write(struct.pack('<I%ss'%length, length, _x))
00070 _x = val1.test_name
00071 length = len(_x)
00072 buff.write(struct.pack('<I%ss'%length, length, _x))
00073 buff.write(_struct_b.pack(val1.test_status))
00074 _x = val1.bay_name
00075 length = len(_x)
00076 buff.write(struct.pack('<I%ss'%length, length, _x))
00077 _x = val1.machine
00078 length = len(_x)
00079 buff.write(struct.pack('<I%ss'%length, length, _x))
00080 _x = val1
00081 buff.write(_struct_2i.pack(_x.board, _x.breaker))
00082 _x = val1.power_status
00083 length = len(_x)
00084 buff.write(struct.pack('<I%ss'%length, length, _x))
00085 _x = val1
00086 buff.write(_struct_bi.pack(_x.estop, _x.elapsed))
00087 _x = val1.status_msg
00088 length = len(_x)
00089 buff.write(struct.pack('<I%ss'%length, length, _x))
00090 except struct.error, se: self._check_types(se)
00091 except TypeError, te: self._check_types(te)
00092
00093 def deserialize(self, str):
00094 """
00095 unpack serialized message in str into this message instance
00096 @param str: byte array of serialized message
00097 @type str: str
00098 """
00099 try:
00100 end = 0
00101 start = end
00102 end += 4
00103 (length,) = _struct_I.unpack(str[start:end])
00104 self.data = []
00105 for i in xrange(0, length):
00106 val1 = pr2_self_test_msgs.msg.TestInfo()
00107 start = end
00108 end += 4
00109 (length,) = _struct_I.unpack(str[start:end])
00110 start = end
00111 end += length
00112 val1.serial = str[start:end]
00113 start = end
00114 end += 4
00115 (length,) = _struct_I.unpack(str[start:end])
00116 start = end
00117 end += length
00118 val1.test_name = str[start:end]
00119 start = end
00120 end += 1
00121 (val1.test_status,) = _struct_b.unpack(str[start:end])
00122 start = end
00123 end += 4
00124 (length,) = _struct_I.unpack(str[start:end])
00125 start = end
00126 end += length
00127 val1.bay_name = str[start:end]
00128 start = end
00129 end += 4
00130 (length,) = _struct_I.unpack(str[start:end])
00131 start = end
00132 end += length
00133 val1.machine = str[start:end]
00134 _x = val1
00135 start = end
00136 end += 8
00137 (_x.board, _x.breaker,) = _struct_2i.unpack(str[start:end])
00138 start = end
00139 end += 4
00140 (length,) = _struct_I.unpack(str[start:end])
00141 start = end
00142 end += length
00143 val1.power_status = str[start:end]
00144 _x = val1
00145 start = end
00146 end += 5
00147 (_x.estop, _x.elapsed,) = _struct_bi.unpack(str[start:end])
00148 start = end
00149 end += 4
00150 (length,) = _struct_I.unpack(str[start:end])
00151 start = end
00152 end += length
00153 val1.status_msg = str[start:end]
00154 self.data.append(val1)
00155 return self
00156 except struct.error, e:
00157 raise roslib.message.DeserializationError(e)
00158
00159
00160 def serialize_numpy(self, buff, numpy):
00161 """
00162 serialize message with numpy array types into buffer
00163 @param buff: buffer
00164 @type buff: StringIO
00165 @param numpy: numpy python module
00166 @type numpy module
00167 """
00168 try:
00169 length = len(self.data)
00170 buff.write(_struct_I.pack(length))
00171 for val1 in self.data:
00172 _x = val1.serial
00173 length = len(_x)
00174 buff.write(struct.pack('<I%ss'%length, length, _x))
00175 _x = val1.test_name
00176 length = len(_x)
00177 buff.write(struct.pack('<I%ss'%length, length, _x))
00178 buff.write(_struct_b.pack(val1.test_status))
00179 _x = val1.bay_name
00180 length = len(_x)
00181 buff.write(struct.pack('<I%ss'%length, length, _x))
00182 _x = val1.machine
00183 length = len(_x)
00184 buff.write(struct.pack('<I%ss'%length, length, _x))
00185 _x = val1
00186 buff.write(_struct_2i.pack(_x.board, _x.breaker))
00187 _x = val1.power_status
00188 length = len(_x)
00189 buff.write(struct.pack('<I%ss'%length, length, _x))
00190 _x = val1
00191 buff.write(_struct_bi.pack(_x.estop, _x.elapsed))
00192 _x = val1.status_msg
00193 length = len(_x)
00194 buff.write(struct.pack('<I%ss'%length, length, _x))
00195 except struct.error, se: self._check_types(se)
00196 except TypeError, te: self._check_types(te)
00197
00198 def deserialize_numpy(self, str, numpy):
00199 """
00200 unpack serialized message in str into this message instance using numpy for array types
00201 @param str: byte array of serialized message
00202 @type str: str
00203 @param numpy: numpy python module
00204 @type numpy: module
00205 """
00206 try:
00207 end = 0
00208 start = end
00209 end += 4
00210 (length,) = _struct_I.unpack(str[start:end])
00211 self.data = []
00212 for i in xrange(0, length):
00213 val1 = pr2_self_test_msgs.msg.TestInfo()
00214 start = end
00215 end += 4
00216 (length,) = _struct_I.unpack(str[start:end])
00217 start = end
00218 end += length
00219 val1.serial = str[start:end]
00220 start = end
00221 end += 4
00222 (length,) = _struct_I.unpack(str[start:end])
00223 start = end
00224 end += length
00225 val1.test_name = str[start:end]
00226 start = end
00227 end += 1
00228 (val1.test_status,) = _struct_b.unpack(str[start:end])
00229 start = end
00230 end += 4
00231 (length,) = _struct_I.unpack(str[start:end])
00232 start = end
00233 end += length
00234 val1.bay_name = str[start:end]
00235 start = end
00236 end += 4
00237 (length,) = _struct_I.unpack(str[start:end])
00238 start = end
00239 end += length
00240 val1.machine = str[start:end]
00241 _x = val1
00242 start = end
00243 end += 8
00244 (_x.board, _x.breaker,) = _struct_2i.unpack(str[start:end])
00245 start = end
00246 end += 4
00247 (length,) = _struct_I.unpack(str[start:end])
00248 start = end
00249 end += length
00250 val1.power_status = str[start:end]
00251 _x = val1
00252 start = end
00253 end += 5
00254 (_x.estop, _x.elapsed,) = _struct_bi.unpack(str[start:end])
00255 start = end
00256 end += 4
00257 (length,) = _struct_I.unpack(str[start:end])
00258 start = end
00259 end += length
00260 val1.status_msg = str[start:end]
00261 self.data.append(val1)
00262 return self
00263 except struct.error, e:
00264 raise roslib.message.DeserializationError(e)
00265
00266 _struct_I = roslib.message.struct_I
00267 _struct_b = struct.Struct("<b")
00268 _struct_2i = struct.Struct("<2i")
00269 _struct_bi = struct.Struct("<bi")