00001 """autogenerated by genpy from ethercat_hardware/SoftProcessorFirmwareWriteRequest.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 SoftProcessorFirmwareWriteRequest(genpy.Message):
00009 _md5sum = "5234f035d5f911e880df479ac901a6e0"
00010 _type = "ethercat_hardware/SoftProcessorFirmwareWriteRequest"
00011 _has_header = False
00012 _full_text = """string actuator_name
00013 string processor_name
00014
00015 uint32[] instructions
00016
00017
00018
00019 """
00020 __slots__ = ['actuator_name','processor_name','instructions']
00021 _slot_types = ['string','string','uint32[]']
00022
00023 def __init__(self, *args, **kwds):
00024 """
00025 Constructor. Any message fields that are implicitly/explicitly
00026 set to None will be assigned a default value. The recommend
00027 use is keyword arguments as this is more robust to future message
00028 changes. You cannot mix in-order arguments and keyword arguments.
00029
00030 The available fields are:
00031 actuator_name,processor_name,instructions
00032
00033 :param args: complete set of field values, in .msg order
00034 :param kwds: use keyword arguments corresponding to message field names
00035 to set specific fields.
00036 """
00037 if args or kwds:
00038 super(SoftProcessorFirmwareWriteRequest, self).__init__(*args, **kwds)
00039
00040 if self.actuator_name is None:
00041 self.actuator_name = ''
00042 if self.processor_name is None:
00043 self.processor_name = ''
00044 if self.instructions is None:
00045 self.instructions = []
00046 else:
00047 self.actuator_name = ''
00048 self.processor_name = ''
00049 self.instructions = []
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, ``StringIO``
00061 """
00062 try:
00063 _x = self.actuator_name
00064 length = len(_x)
00065 if python3 or type(_x) == unicode:
00066 _x = _x.encode('utf-8')
00067 length = len(_x)
00068 buff.write(struct.pack('<I%ss'%length, length, _x))
00069 _x = self.processor_name
00070 length = len(_x)
00071 if python3 or type(_x) == unicode:
00072 _x = _x.encode('utf-8')
00073 length = len(_x)
00074 buff.write(struct.pack('<I%ss'%length, length, _x))
00075 length = len(self.instructions)
00076 buff.write(_struct_I.pack(length))
00077 pattern = '<%sI'%length
00078 buff.write(struct.pack(pattern, *self.instructions))
00079 except struct.error as se: self._check_types(se)
00080 except TypeError as te: self._check_types(te)
00081
00082 def deserialize(self, str):
00083 """
00084 unpack serialized message in str into this message instance
00085 :param str: byte array of serialized message, ``str``
00086 """
00087 try:
00088 end = 0
00089 start = end
00090 end += 4
00091 (length,) = _struct_I.unpack(str[start:end])
00092 start = end
00093 end += length
00094 if python3:
00095 self.actuator_name = str[start:end].decode('utf-8')
00096 else:
00097 self.actuator_name = 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.processor_name = str[start:end].decode('utf-8')
00105 else:
00106 self.processor_name = str[start:end]
00107 start = end
00108 end += 4
00109 (length,) = _struct_I.unpack(str[start:end])
00110 pattern = '<%sI'%length
00111 start = end
00112 end += struct.calcsize(pattern)
00113 self.instructions = struct.unpack(pattern, str[start:end])
00114 return self
00115 except struct.error as e:
00116 raise genpy.DeserializationError(e)
00117
00118
00119 def serialize_numpy(self, buff, numpy):
00120 """
00121 serialize message with numpy array types into buffer
00122 :param buff: buffer, ``StringIO``
00123 :param numpy: numpy python module
00124 """
00125 try:
00126 _x = self.actuator_name
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 _x = self.processor_name
00133 length = len(_x)
00134 if python3 or type(_x) == unicode:
00135 _x = _x.encode('utf-8')
00136 length = len(_x)
00137 buff.write(struct.pack('<I%ss'%length, length, _x))
00138 length = len(self.instructions)
00139 buff.write(_struct_I.pack(length))
00140 pattern = '<%sI'%length
00141 buff.write(self.instructions.tostring())
00142 except struct.error as se: self._check_types(se)
00143 except TypeError as te: self._check_types(te)
00144
00145 def deserialize_numpy(self, str, numpy):
00146 """
00147 unpack serialized message in str into this message instance using numpy for array types
00148 :param str: byte array of serialized message, ``str``
00149 :param numpy: numpy python module
00150 """
00151 try:
00152 end = 0
00153 start = end
00154 end += 4
00155 (length,) = _struct_I.unpack(str[start:end])
00156 start = end
00157 end += length
00158 if python3:
00159 self.actuator_name = str[start:end].decode('utf-8')
00160 else:
00161 self.actuator_name = str[start:end]
00162 start = end
00163 end += 4
00164 (length,) = _struct_I.unpack(str[start:end])
00165 start = end
00166 end += length
00167 if python3:
00168 self.processor_name = str[start:end].decode('utf-8')
00169 else:
00170 self.processor_name = str[start:end]
00171 start = end
00172 end += 4
00173 (length,) = _struct_I.unpack(str[start:end])
00174 pattern = '<%sI'%length
00175 start = end
00176 end += struct.calcsize(pattern)
00177 self.instructions = numpy.frombuffer(str[start:end], dtype=numpy.uint32, count=length)
00178 return self
00179 except struct.error as e:
00180 raise genpy.DeserializationError(e)
00181
00182 _struct_I = genpy.struct_I
00183 """autogenerated by genpy from ethercat_hardware/SoftProcessorFirmwareWriteResponse.msg. Do not edit."""
00184 import sys
00185 python3 = True if sys.hexversion > 0x03000000 else False
00186 import genpy
00187 import struct
00188
00189
00190 class SoftProcessorFirmwareWriteResponse(genpy.Message):
00191 _md5sum = "d006c48be24db1173a071ca9af4c8179"
00192 _type = "ethercat_hardware/SoftProcessorFirmwareWriteResponse"
00193 _has_header = False
00194 _full_text = """bool success
00195 string error_msg
00196
00197
00198 """
00199 __slots__ = ['success','error_msg']
00200 _slot_types = ['bool','string']
00201
00202 def __init__(self, *args, **kwds):
00203 """
00204 Constructor. Any message fields that are implicitly/explicitly
00205 set to None will be assigned a default value. The recommend
00206 use is keyword arguments as this is more robust to future message
00207 changes. You cannot mix in-order arguments and keyword arguments.
00208
00209 The available fields are:
00210 success,error_msg
00211
00212 :param args: complete set of field values, in .msg order
00213 :param kwds: use keyword arguments corresponding to message field names
00214 to set specific fields.
00215 """
00216 if args or kwds:
00217 super(SoftProcessorFirmwareWriteResponse, self).__init__(*args, **kwds)
00218
00219 if self.success is None:
00220 self.success = False
00221 if self.error_msg is None:
00222 self.error_msg = ''
00223 else:
00224 self.success = False
00225 self.error_msg = ''
00226
00227 def _get_types(self):
00228 """
00229 internal API method
00230 """
00231 return self._slot_types
00232
00233 def serialize(self, buff):
00234 """
00235 serialize message into buffer
00236 :param buff: buffer, ``StringIO``
00237 """
00238 try:
00239 buff.write(_struct_B.pack(self.success))
00240 _x = self.error_msg
00241 length = len(_x)
00242 if python3 or type(_x) == unicode:
00243 _x = _x.encode('utf-8')
00244 length = len(_x)
00245 buff.write(struct.pack('<I%ss'%length, length, _x))
00246 except struct.error as se: self._check_types(se)
00247 except TypeError as te: self._check_types(te)
00248
00249 def deserialize(self, str):
00250 """
00251 unpack serialized message in str into this message instance
00252 :param str: byte array of serialized message, ``str``
00253 """
00254 try:
00255 end = 0
00256 start = end
00257 end += 1
00258 (self.success,) = _struct_B.unpack(str[start:end])
00259 self.success = bool(self.success)
00260 start = end
00261 end += 4
00262 (length,) = _struct_I.unpack(str[start:end])
00263 start = end
00264 end += length
00265 if python3:
00266 self.error_msg = str[start:end].decode('utf-8')
00267 else:
00268 self.error_msg = str[start:end]
00269 return self
00270 except struct.error as e:
00271 raise genpy.DeserializationError(e)
00272
00273
00274 def serialize_numpy(self, buff, numpy):
00275 """
00276 serialize message with numpy array types into buffer
00277 :param buff: buffer, ``StringIO``
00278 :param numpy: numpy python module
00279 """
00280 try:
00281 buff.write(_struct_B.pack(self.success))
00282 _x = self.error_msg
00283 length = len(_x)
00284 if python3 or type(_x) == unicode:
00285 _x = _x.encode('utf-8')
00286 length = len(_x)
00287 buff.write(struct.pack('<I%ss'%length, length, _x))
00288 except struct.error as se: self._check_types(se)
00289 except TypeError as te: self._check_types(te)
00290
00291 def deserialize_numpy(self, str, numpy):
00292 """
00293 unpack serialized message in str into this message instance using numpy for array types
00294 :param str: byte array of serialized message, ``str``
00295 :param numpy: numpy python module
00296 """
00297 try:
00298 end = 0
00299 start = end
00300 end += 1
00301 (self.success,) = _struct_B.unpack(str[start:end])
00302 self.success = bool(self.success)
00303 start = end
00304 end += 4
00305 (length,) = _struct_I.unpack(str[start:end])
00306 start = end
00307 end += length
00308 if python3:
00309 self.error_msg = str[start:end].decode('utf-8')
00310 else:
00311 self.error_msg = str[start:end]
00312 return self
00313 except struct.error as e:
00314 raise genpy.DeserializationError(e)
00315
00316 _struct_I = genpy.struct_I
00317 _struct_B = struct.Struct("<B")
00318 class SoftProcessorFirmwareWrite(object):
00319 _type = 'ethercat_hardware/SoftProcessorFirmwareWrite'
00320 _md5sum = '4505835b16c43769db7131458325563c'
00321 _request_class = SoftProcessorFirmwareWriteRequest
00322 _response_class = SoftProcessorFirmwareWriteResponse