00001 """autogenerated by genpy from jsk_gui_msgs/DeviceSensor.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 DeviceSensor(genpy.Message):
00009 _md5sum = "d3861ba768b988b4c249337d4dc6552d"
00010 _type = "jsk_gui_msgs/DeviceSensor"
00011 _has_header = False
00012 _full_text = """float64 temperature
00013 float64 relative_humidity
00014 float64 light
00015 float64 pressure
00016 float64 proximity
00017
00018
00019
00020
00021 """
00022 __slots__ = ['temperature','relative_humidity','light','pressure','proximity']
00023 _slot_types = ['float64','float64','float64','float64','float64']
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 temperature,relative_humidity,light,pressure,proximity
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(DeviceSensor, self).__init__(*args, **kwds)
00041
00042 if self.temperature is None:
00043 self.temperature = 0.
00044 if self.relative_humidity is None:
00045 self.relative_humidity = 0.
00046 if self.light is None:
00047 self.light = 0.
00048 if self.pressure is None:
00049 self.pressure = 0.
00050 if self.proximity is None:
00051 self.proximity = 0.
00052 else:
00053 self.temperature = 0.
00054 self.relative_humidity = 0.
00055 self.light = 0.
00056 self.pressure = 0.
00057 self.proximity = 0.
00058
00059 def _get_types(self):
00060 """
00061 internal API method
00062 """
00063 return self._slot_types
00064
00065 def serialize(self, buff):
00066 """
00067 serialize message into buffer
00068 :param buff: buffer, ``StringIO``
00069 """
00070 try:
00071 _x = self
00072 buff.write(_struct_5d.pack(_x.temperature, _x.relative_humidity, _x.light, _x.pressure, _x.proximity))
00073 except struct.error as se: self._check_types(se)
00074 except TypeError as te: self._check_types(te)
00075
00076 def deserialize(self, str):
00077 """
00078 unpack serialized message in str into this message instance
00079 :param str: byte array of serialized message, ``str``
00080 """
00081 try:
00082 end = 0
00083 _x = self
00084 start = end
00085 end += 40
00086 (_x.temperature, _x.relative_humidity, _x.light, _x.pressure, _x.proximity,) = _struct_5d.unpack(str[start:end])
00087 return self
00088 except struct.error as e:
00089 raise genpy.DeserializationError(e)
00090
00091
00092 def serialize_numpy(self, buff, numpy):
00093 """
00094 serialize message with numpy array types into buffer
00095 :param buff: buffer, ``StringIO``
00096 :param numpy: numpy python module
00097 """
00098 try:
00099 _x = self
00100 buff.write(_struct_5d.pack(_x.temperature, _x.relative_humidity, _x.light, _x.pressure, _x.proximity))
00101 except struct.error as se: self._check_types(se)
00102 except TypeError as te: self._check_types(te)
00103
00104 def deserialize_numpy(self, str, numpy):
00105 """
00106 unpack serialized message in str into this message instance using numpy for array types
00107 :param str: byte array of serialized message, ``str``
00108 :param numpy: numpy python module
00109 """
00110 try:
00111 end = 0
00112 _x = self
00113 start = end
00114 end += 40
00115 (_x.temperature, _x.relative_humidity, _x.light, _x.pressure, _x.proximity,) = _struct_5d.unpack(str[start:end])
00116 return self
00117 except struct.error as e:
00118 raise genpy.DeserializationError(e)
00119
00120 _struct_I = genpy.struct_I
00121 _struct_5d = struct.Struct("<5d")