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


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