_TestInfo.py
Go to the documentation of this file.
00001 """autogenerated by genpy from pr2_self_test_msgs/TestInfo.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 TestInfo(genpy.Message):
00009   _md5sum = "594219b720ecaee963aa0b601d38b8f2"
00010   _type = "pr2_self_test_msgs/TestInfo"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """string serial
00013 string test_name
00014 byte test_status # 127, not launched, 0, ok; 1, warn; 2, error; 3, stale
00015 string bay_name
00016 string machine
00017 int32 board
00018 int32 breaker
00019 string power_status
00020 byte estop # 0, off; 1, on
00021 int32 elapsed
00022 string status_msg
00023 """
00024   __slots__ = ['serial','test_name','test_status','bay_name','machine','board','breaker','power_status','estop','elapsed','status_msg']
00025   _slot_types = ['string','string','byte','string','string','int32','int32','string','byte','int32','string']
00026 
00027   def __init__(self, *args, **kwds):
00028     """
00029     Constructor. Any message fields that are implicitly/explicitly
00030     set to None will be assigned a default value. The recommend
00031     use is keyword arguments as this is more robust to future message
00032     changes.  You cannot mix in-order arguments and keyword arguments.
00033 
00034     The available fields are:
00035        serial,test_name,test_status,bay_name,machine,board,breaker,power_status,estop,elapsed,status_msg
00036 
00037     :param args: complete set of field values, in .msg order
00038     :param kwds: use keyword arguments corresponding to message field names
00039     to set specific fields.
00040     """
00041     if args or kwds:
00042       super(TestInfo, self).__init__(*args, **kwds)
00043       #message fields cannot be None, assign default values for those that are
00044       if self.serial is None:
00045         self.serial = ''
00046       if self.test_name is None:
00047         self.test_name = ''
00048       if self.test_status is None:
00049         self.test_status = 0
00050       if self.bay_name is None:
00051         self.bay_name = ''
00052       if self.machine is None:
00053         self.machine = ''
00054       if self.board is None:
00055         self.board = 0
00056       if self.breaker is None:
00057         self.breaker = 0
00058       if self.power_status is None:
00059         self.power_status = ''
00060       if self.estop is None:
00061         self.estop = 0
00062       if self.elapsed is None:
00063         self.elapsed = 0
00064       if self.status_msg is None:
00065         self.status_msg = ''
00066     else:
00067       self.serial = ''
00068       self.test_name = ''
00069       self.test_status = 0
00070       self.bay_name = ''
00071       self.machine = ''
00072       self.board = 0
00073       self.breaker = 0
00074       self.power_status = ''
00075       self.estop = 0
00076       self.elapsed = 0
00077       self.status_msg = ''
00078 
00079   def _get_types(self):
00080     """
00081     internal API method
00082     """
00083     return self._slot_types
00084 
00085   def serialize(self, buff):
00086     """
00087     serialize message into buffer
00088     :param buff: buffer, ``StringIO``
00089     """
00090     try:
00091       _x = self.serial
00092       length = len(_x)
00093       if python3 or type(_x) == unicode:
00094         _x = _x.encode('utf-8')
00095         length = len(_x)
00096       buff.write(struct.pack('<I%ss'%length, length, _x))
00097       _x = self.test_name
00098       length = len(_x)
00099       if python3 or type(_x) == unicode:
00100         _x = _x.encode('utf-8')
00101         length = len(_x)
00102       buff.write(struct.pack('<I%ss'%length, length, _x))
00103       buff.write(_struct_b.pack(self.test_status))
00104       _x = self.bay_name
00105       length = len(_x)
00106       if python3 or type(_x) == unicode:
00107         _x = _x.encode('utf-8')
00108         length = len(_x)
00109       buff.write(struct.pack('<I%ss'%length, length, _x))
00110       _x = self.machine
00111       length = len(_x)
00112       if python3 or type(_x) == unicode:
00113         _x = _x.encode('utf-8')
00114         length = len(_x)
00115       buff.write(struct.pack('<I%ss'%length, length, _x))
00116       _x = self
00117       buff.write(_struct_2i.pack(_x.board, _x.breaker))
00118       _x = self.power_status
00119       length = len(_x)
00120       if python3 or type(_x) == unicode:
00121         _x = _x.encode('utf-8')
00122         length = len(_x)
00123       buff.write(struct.pack('<I%ss'%length, length, _x))
00124       _x = self
00125       buff.write(_struct_bi.pack(_x.estop, _x.elapsed))
00126       _x = self.status_msg
00127       length = len(_x)
00128       if python3 or type(_x) == unicode:
00129         _x = _x.encode('utf-8')
00130         length = len(_x)
00131       buff.write(struct.pack('<I%ss'%length, length, _x))
00132     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00133     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00134 
00135   def deserialize(self, str):
00136     """
00137     unpack serialized message in str into this message instance
00138     :param str: byte array of serialized message, ``str``
00139     """
00140     try:
00141       end = 0
00142       start = end
00143       end += 4
00144       (length,) = _struct_I.unpack(str[start:end])
00145       start = end
00146       end += length
00147       if python3:
00148         self.serial = str[start:end].decode('utf-8')
00149       else:
00150         self.serial = str[start:end]
00151       start = end
00152       end += 4
00153       (length,) = _struct_I.unpack(str[start:end])
00154       start = end
00155       end += length
00156       if python3:
00157         self.test_name = str[start:end].decode('utf-8')
00158       else:
00159         self.test_name = str[start:end]
00160       start = end
00161       end += 1
00162       (self.test_status,) = _struct_b.unpack(str[start:end])
00163       start = end
00164       end += 4
00165       (length,) = _struct_I.unpack(str[start:end])
00166       start = end
00167       end += length
00168       if python3:
00169         self.bay_name = str[start:end].decode('utf-8')
00170       else:
00171         self.bay_name = str[start:end]
00172       start = end
00173       end += 4
00174       (length,) = _struct_I.unpack(str[start:end])
00175       start = end
00176       end += length
00177       if python3:
00178         self.machine = str[start:end].decode('utf-8')
00179       else:
00180         self.machine = str[start:end]
00181       _x = self
00182       start = end
00183       end += 8
00184       (_x.board, _x.breaker,) = _struct_2i.unpack(str[start:end])
00185       start = end
00186       end += 4
00187       (length,) = _struct_I.unpack(str[start:end])
00188       start = end
00189       end += length
00190       if python3:
00191         self.power_status = str[start:end].decode('utf-8')
00192       else:
00193         self.power_status = str[start:end]
00194       _x = self
00195       start = end
00196       end += 5
00197       (_x.estop, _x.elapsed,) = _struct_bi.unpack(str[start:end])
00198       start = end
00199       end += 4
00200       (length,) = _struct_I.unpack(str[start:end])
00201       start = end
00202       end += length
00203       if python3:
00204         self.status_msg = str[start:end].decode('utf-8')
00205       else:
00206         self.status_msg = str[start:end]
00207       return self
00208     except struct.error as e:
00209       raise genpy.DeserializationError(e) #most likely buffer underfill
00210 
00211 
00212   def serialize_numpy(self, buff, numpy):
00213     """
00214     serialize message with numpy array types into buffer
00215     :param buff: buffer, ``StringIO``
00216     :param numpy: numpy python module
00217     """
00218     try:
00219       _x = self.serial
00220       length = len(_x)
00221       if python3 or type(_x) == unicode:
00222         _x = _x.encode('utf-8')
00223         length = len(_x)
00224       buff.write(struct.pack('<I%ss'%length, length, _x))
00225       _x = self.test_name
00226       length = len(_x)
00227       if python3 or type(_x) == unicode:
00228         _x = _x.encode('utf-8')
00229         length = len(_x)
00230       buff.write(struct.pack('<I%ss'%length, length, _x))
00231       buff.write(_struct_b.pack(self.test_status))
00232       _x = self.bay_name
00233       length = len(_x)
00234       if python3 or type(_x) == unicode:
00235         _x = _x.encode('utf-8')
00236         length = len(_x)
00237       buff.write(struct.pack('<I%ss'%length, length, _x))
00238       _x = self.machine
00239       length = len(_x)
00240       if python3 or type(_x) == unicode:
00241         _x = _x.encode('utf-8')
00242         length = len(_x)
00243       buff.write(struct.pack('<I%ss'%length, length, _x))
00244       _x = self
00245       buff.write(_struct_2i.pack(_x.board, _x.breaker))
00246       _x = self.power_status
00247       length = len(_x)
00248       if python3 or type(_x) == unicode:
00249         _x = _x.encode('utf-8')
00250         length = len(_x)
00251       buff.write(struct.pack('<I%ss'%length, length, _x))
00252       _x = self
00253       buff.write(_struct_bi.pack(_x.estop, _x.elapsed))
00254       _x = self.status_msg
00255       length = len(_x)
00256       if python3 or type(_x) == unicode:
00257         _x = _x.encode('utf-8')
00258         length = len(_x)
00259       buff.write(struct.pack('<I%ss'%length, length, _x))
00260     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00261     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00262 
00263   def deserialize_numpy(self, str, numpy):
00264     """
00265     unpack serialized message in str into this message instance using numpy for array types
00266     :param str: byte array of serialized message, ``str``
00267     :param numpy: numpy python module
00268     """
00269     try:
00270       end = 0
00271       start = end
00272       end += 4
00273       (length,) = _struct_I.unpack(str[start:end])
00274       start = end
00275       end += length
00276       if python3:
00277         self.serial = str[start:end].decode('utf-8')
00278       else:
00279         self.serial = str[start:end]
00280       start = end
00281       end += 4
00282       (length,) = _struct_I.unpack(str[start:end])
00283       start = end
00284       end += length
00285       if python3:
00286         self.test_name = str[start:end].decode('utf-8')
00287       else:
00288         self.test_name = str[start:end]
00289       start = end
00290       end += 1
00291       (self.test_status,) = _struct_b.unpack(str[start:end])
00292       start = end
00293       end += 4
00294       (length,) = _struct_I.unpack(str[start:end])
00295       start = end
00296       end += length
00297       if python3:
00298         self.bay_name = str[start:end].decode('utf-8')
00299       else:
00300         self.bay_name = str[start:end]
00301       start = end
00302       end += 4
00303       (length,) = _struct_I.unpack(str[start:end])
00304       start = end
00305       end += length
00306       if python3:
00307         self.machine = str[start:end].decode('utf-8')
00308       else:
00309         self.machine = str[start:end]
00310       _x = self
00311       start = end
00312       end += 8
00313       (_x.board, _x.breaker,) = _struct_2i.unpack(str[start:end])
00314       start = end
00315       end += 4
00316       (length,) = _struct_I.unpack(str[start:end])
00317       start = end
00318       end += length
00319       if python3:
00320         self.power_status = str[start:end].decode('utf-8')
00321       else:
00322         self.power_status = str[start:end]
00323       _x = self
00324       start = end
00325       end += 5
00326       (_x.estop, _x.elapsed,) = _struct_bi.unpack(str[start:end])
00327       start = end
00328       end += 4
00329       (length,) = _struct_I.unpack(str[start:end])
00330       start = end
00331       end += length
00332       if python3:
00333         self.status_msg = str[start:end].decode('utf-8')
00334       else:
00335         self.status_msg = str[start:end]
00336       return self
00337     except struct.error as e:
00338       raise genpy.DeserializationError(e) #most likely buffer underfill
00339 
00340 _struct_I = genpy.struct_I
00341 _struct_b = struct.Struct("<b")
00342 _struct_2i = struct.Struct("<2i")
00343 _struct_bi = struct.Struct("<bi")


pr2_self_test_msgs
Author(s): Kevin Watts
autogenerated on Tue Apr 22 2014 19:38:25