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


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