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


shared_serial
Author(s): Wouter Caarls
autogenerated on Sun Jan 5 2014 11:06:47