_TriState.py
Go to the documentation of this file.
00001 """autogenerated by genpy from industrial_msgs/TriState.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 TriState(genpy.Message):
00009   _md5sum = "deb03829f3c2d0f1b647fa38d7087952"
00010   _type = "industrial_msgs/TriState"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# The tri-state captures boolean values with the additional state of unknown
00013 
00014 int8 val
00015 
00016 # enumerated values
00017 
00018 # Unknown or unavailable 
00019 int8 UNKNOWN=-1  
00020 
00021 # High state                       
00022 int8 TRUE=1
00023 int8 ON=1
00024 int8 ENABLED=1
00025 int8 HIGH=1
00026 int8 CLOSED=1
00027 
00028 # Low state
00029 int8 FALSE=0
00030 int8 OFF=0
00031 int8 DISABLED=0
00032 int8 LOW=0
00033 int8 OPEN=0
00034 
00035 
00036 """
00037   # Pseudo-constants
00038   UNKNOWN = -1
00039   TRUE = 1
00040   ON = 1
00041   ENABLED = 1
00042   HIGH = 1
00043   CLOSED = 1
00044   FALSE = 0
00045   OFF = 0
00046   DISABLED = 0
00047   LOW = 0
00048   OPEN = 0
00049 
00050   __slots__ = ['val']
00051   _slot_types = ['int8']
00052 
00053   def __init__(self, *args, **kwds):
00054     """
00055     Constructor. Any message fields that are implicitly/explicitly
00056     set to None will be assigned a default value. The recommend
00057     use is keyword arguments as this is more robust to future message
00058     changes.  You cannot mix in-order arguments and keyword arguments.
00059 
00060     The available fields are:
00061        val
00062 
00063     :param args: complete set of field values, in .msg order
00064     :param kwds: use keyword arguments corresponding to message field names
00065     to set specific fields.
00066     """
00067     if args or kwds:
00068       super(TriState, self).__init__(*args, **kwds)
00069       #message fields cannot be None, assign default values for those that are
00070       if self.val is None:
00071         self.val = 0
00072     else:
00073       self.val = 0
00074 
00075   def _get_types(self):
00076     """
00077     internal API method
00078     """
00079     return self._slot_types
00080 
00081   def serialize(self, buff):
00082     """
00083     serialize message into buffer
00084     :param buff: buffer, ``StringIO``
00085     """
00086     try:
00087       buff.write(_struct_b.pack(self.val))
00088     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00089     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00090 
00091   def deserialize(self, str):
00092     """
00093     unpack serialized message in str into this message instance
00094     :param str: byte array of serialized message, ``str``
00095     """
00096     try:
00097       end = 0
00098       start = end
00099       end += 1
00100       (self.val,) = _struct_b.unpack(str[start:end])
00101       return self
00102     except struct.error as e:
00103       raise genpy.DeserializationError(e) #most likely buffer underfill
00104 
00105 
00106   def serialize_numpy(self, buff, numpy):
00107     """
00108     serialize message with numpy array types into buffer
00109     :param buff: buffer, ``StringIO``
00110     :param numpy: numpy python module
00111     """
00112     try:
00113       buff.write(_struct_b.pack(self.val))
00114     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00115     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00116 
00117   def deserialize_numpy(self, str, numpy):
00118     """
00119     unpack serialized message in str into this message instance using numpy for array types
00120     :param str: byte array of serialized message, ``str``
00121     :param numpy: numpy python module
00122     """
00123     try:
00124       end = 0
00125       start = end
00126       end += 1
00127       (self.val,) = _struct_b.unpack(str[start:end])
00128       return self
00129     except struct.error as e:
00130       raise genpy.DeserializationError(e) #most likely buffer underfill
00131 
00132 _struct_I = genpy.struct_I
00133 _struct_b = struct.Struct("<b")


industrial_msgs
Author(s): Shaun M. Edwards
autogenerated on Mon Oct 6 2014 00:53:40