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


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