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


nasa_r2_common_msgs
Author(s): Paul Dinh. Maintained by Jennifer Turner
autogenerated on Mon Oct 6 2014 02:42:34