$search
00001 """autogenerated by genmsg_py from ShellCommandResult.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 00006 class ShellCommandResult(roslib.message.Message): 00007 _md5sum = "ab1da367af6c5039cad88143b7611458" 00008 _type = "shell_execution_action_server/ShellCommandResult" 00009 _has_header = False #flag to mark the presence of a Header object 00010 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ====== 00011 #Result (accumulated output from start to end) 00012 string stdout 00013 string stderr 00014 uint8 exit_code 00015 00016 """ 00017 __slots__ = ['stdout','stderr','exit_code'] 00018 _slot_types = ['string','string','uint8'] 00019 00020 def __init__(self, *args, **kwds): 00021 """ 00022 Constructor. Any message fields that are implicitly/explicitly 00023 set to None will be assigned a default value. The recommend 00024 use is keyword arguments as this is more robust to future message 00025 changes. You cannot mix in-order arguments and keyword arguments. 00026 00027 The available fields are: 00028 stdout,stderr,exit_code 00029 00030 @param args: complete set of field values, in .msg order 00031 @param kwds: use keyword arguments corresponding to message field names 00032 to set specific fields. 00033 """ 00034 if args or kwds: 00035 super(ShellCommandResult, self).__init__(*args, **kwds) 00036 #message fields cannot be None, assign default values for those that are 00037 if self.stdout is None: 00038 self.stdout = '' 00039 if self.stderr is None: 00040 self.stderr = '' 00041 if self.exit_code is None: 00042 self.exit_code = 0 00043 else: 00044 self.stdout = '' 00045 self.stderr = '' 00046 self.exit_code = 0 00047 00048 def _get_types(self): 00049 """ 00050 internal API method 00051 """ 00052 return self._slot_types 00053 00054 def serialize(self, buff): 00055 """ 00056 serialize message into buffer 00057 @param buff: buffer 00058 @type buff: StringIO 00059 """ 00060 try: 00061 _x = self.stdout 00062 length = len(_x) 00063 buff.write(struct.pack('<I%ss'%length, length, _x)) 00064 _x = self.stderr 00065 length = len(_x) 00066 buff.write(struct.pack('<I%ss'%length, length, _x)) 00067 buff.write(_struct_B.pack(self.exit_code)) 00068 except struct.error as se: self._check_types(se) 00069 except TypeError as te: self._check_types(te) 00070 00071 def deserialize(self, str): 00072 """ 00073 unpack serialized message in str into this message instance 00074 @param str: byte array of serialized message 00075 @type str: str 00076 """ 00077 try: 00078 end = 0 00079 start = end 00080 end += 4 00081 (length,) = _struct_I.unpack(str[start:end]) 00082 start = end 00083 end += length 00084 self.stdout = str[start:end] 00085 start = end 00086 end += 4 00087 (length,) = _struct_I.unpack(str[start:end]) 00088 start = end 00089 end += length 00090 self.stderr = str[start:end] 00091 start = end 00092 end += 1 00093 (self.exit_code,) = _struct_B.unpack(str[start:end]) 00094 return self 00095 except struct.error as e: 00096 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00097 00098 00099 def serialize_numpy(self, buff, numpy): 00100 """ 00101 serialize message with numpy array types into buffer 00102 @param buff: buffer 00103 @type buff: StringIO 00104 @param numpy: numpy python module 00105 @type numpy module 00106 """ 00107 try: 00108 _x = self.stdout 00109 length = len(_x) 00110 buff.write(struct.pack('<I%ss'%length, length, _x)) 00111 _x = self.stderr 00112 length = len(_x) 00113 buff.write(struct.pack('<I%ss'%length, length, _x)) 00114 buff.write(_struct_B.pack(self.exit_code)) 00115 except struct.error as se: self._check_types(se) 00116 except TypeError as te: self._check_types(te) 00117 00118 def deserialize_numpy(self, str, numpy): 00119 """ 00120 unpack serialized message in str into this message instance using numpy for array types 00121 @param str: byte array of serialized message 00122 @type str: str 00123 @param numpy: numpy python module 00124 @type numpy: module 00125 """ 00126 try: 00127 end = 0 00128 start = end 00129 end += 4 00130 (length,) = _struct_I.unpack(str[start:end]) 00131 start = end 00132 end += length 00133 self.stdout = str[start:end] 00134 start = end 00135 end += 4 00136 (length,) = _struct_I.unpack(str[start:end]) 00137 start = end 00138 end += length 00139 self.stderr = str[start:end] 00140 start = end 00141 end += 1 00142 (self.exit_code,) = _struct_B.unpack(str[start:end]) 00143 return self 00144 except struct.error as e: 00145 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00146 00147 _struct_I = roslib.message.struct_I 00148 _struct_B = struct.Struct("<B")