_Flush.py
Go to the documentation of this file.
00001 """autogenerated by genpy from shared_serial/Flush.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 Flush(genpy.Message):
00009   _md5sum = "998caebd95b1820bc38f9812484a09de"
00010   _type = "shared_serial/Flush"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# Flush serial port.
00013 
00014 # Eeither 0 (connectionless) or an unexpired socket identifier
00015 # from an earlier communication.
00016 uint32 socket
00017 
00018 # Number of seconds to keep the port locked after this communication.
00019 float32 timeout
00020 
00021 """
00022   __slots__ = ['socket','timeout']
00023   _slot_types = ['uint32','float32']
00024 
00025   def __init__(self, *args, **kwds):
00026     """
00027     Constructor. Any message fields that are implicitly/explicitly
00028     set to None will be assigned a default value. The recommend
00029     use is keyword arguments as this is more robust to future message
00030     changes.  You cannot mix in-order arguments and keyword arguments.
00031 
00032     The available fields are:
00033        socket,timeout
00034 
00035     :param args: complete set of field values, in .msg order
00036     :param kwds: use keyword arguments corresponding to message field names
00037     to set specific fields.
00038     """
00039     if args or kwds:
00040       super(Flush, self).__init__(*args, **kwds)
00041       #message fields cannot be None, assign default values for those that are
00042       if self.socket is None:
00043         self.socket = 0
00044       if self.timeout is None:
00045         self.timeout = 0.
00046     else:
00047       self.socket = 0
00048       self.timeout = 0.
00049 
00050   def _get_types(self):
00051     """
00052     internal API method
00053     """
00054     return self._slot_types
00055 
00056   def serialize(self, buff):
00057     """
00058     serialize message into buffer
00059     :param buff: buffer, ``StringIO``
00060     """
00061     try:
00062       _x = self
00063       buff.write(_struct_If.pack(_x.socket, _x.timeout))
00064     except struct.error as se: self._check_types(se)
00065     except TypeError as te: self._check_types(te)
00066 
00067   def deserialize(self, str):
00068     """
00069     unpack serialized message in str into this message instance
00070     :param str: byte array of serialized message, ``str``
00071     """
00072     try:
00073       end = 0
00074       _x = self
00075       start = end
00076       end += 8
00077       (_x.socket, _x.timeout,) = _struct_If.unpack(str[start:end])
00078       return self
00079     except struct.error as e:
00080       raise genpy.DeserializationError(e) #most likely buffer underfill
00081 
00082 
00083   def serialize_numpy(self, buff, numpy):
00084     """
00085     serialize message with numpy array types into buffer
00086     :param buff: buffer, ``StringIO``
00087     :param numpy: numpy python module
00088     """
00089     try:
00090       _x = self
00091       buff.write(_struct_If.pack(_x.socket, _x.timeout))
00092     except struct.error as se: self._check_types(se)
00093     except TypeError as te: self._check_types(te)
00094 
00095   def deserialize_numpy(self, str, numpy):
00096     """
00097     unpack serialized message in str into this message instance using numpy for array types
00098     :param str: byte array of serialized message, ``str``
00099     :param numpy: numpy python module
00100     """
00101     try:
00102       end = 0
00103       _x = self
00104       start = end
00105       end += 8
00106       (_x.socket, _x.timeout,) = _struct_If.unpack(str[start:end])
00107       return self
00108     except struct.error as e:
00109       raise genpy.DeserializationError(e) #most likely buffer underfill
00110 
00111 _struct_I = genpy.struct_I
00112 _struct_If = struct.Struct("<If")


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