00001 """autogenerated by genpy from telekyb_msgs/MKValue.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import genpy
00008
00009 class MKValue(genpy.Message):
00010 _md5sum = "24bb7f40c63825102e156502fdb934eb"
00011 _type = "telekyb_msgs/MKValue"
00012 _has_header = False
00013 _full_text = """#
00014 # Copyright 2011 Antonio Franchi and Martin Riedel
00015 #
00016 # This file is part of TeleKyb.
00017 #
00018 # TeleKyb is free software: you can redistribute it and/or modify
00019 # it under the terms of the GNU General Public License as published by
00020 # the Free Software Foundation, either version 3 of the License, or
00021 # (at your option) any later version.
00022 #
00023 # TeleKyb is distributed in the hope that it will be useful,
00024 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00025 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00026 # GNU General Public License for more details.
00027 #
00028 # You should have received a copy of the GNU General Public License
00029 # along with TeleKyb. If not, see <http://www.gnu.org/licenses/>.
00030
00031 string name
00032 time stamp
00033 int16 id
00034 int16 value
00035
00036 #
00037 #
00038 """
00039 __slots__ = ['name','stamp','id','value']
00040 _slot_types = ['string','time','int16','int16']
00041
00042 def __init__(self, *args, **kwds):
00043 """
00044 Constructor. Any message fields that are implicitly/explicitly
00045 set to None will be assigned a default value. The recommend
00046 use is keyword arguments as this is more robust to future message
00047 changes. You cannot mix in-order arguments and keyword arguments.
00048
00049 The available fields are:
00050 name,stamp,id,value
00051
00052 :param args: complete set of field values, in .msg order
00053 :param kwds: use keyword arguments corresponding to message field names
00054 to set specific fields.
00055 """
00056 if args or kwds:
00057 super(MKValue, self).__init__(*args, **kwds)
00058
00059 if self.name is None:
00060 self.name = ''
00061 if self.stamp is None:
00062 self.stamp = genpy.Time()
00063 if self.id is None:
00064 self.id = 0
00065 if self.value is None:
00066 self.value = 0
00067 else:
00068 self.name = ''
00069 self.stamp = genpy.Time()
00070 self.id = 0
00071 self.value = 0
00072
00073 def _get_types(self):
00074 """
00075 internal API method
00076 """
00077 return self._slot_types
00078
00079 def serialize(self, buff):
00080 """
00081 serialize message into buffer
00082 :param buff: buffer, ``StringIO``
00083 """
00084 try:
00085 _x = self.name
00086 length = len(_x)
00087 if python3 or type(_x) == unicode:
00088 _x = _x.encode('utf-8')
00089 length = len(_x)
00090 buff.write(struct.pack('<I%ss'%length, length, _x))
00091 _x = self
00092 buff.write(_struct_2I2h.pack(_x.stamp.secs, _x.stamp.nsecs, _x.id, _x.value))
00093 except struct.error as se: self._check_types(se)
00094 except TypeError as te: self._check_types(te)
00095
00096 def deserialize(self, str):
00097 """
00098 unpack serialized message in str into this message instance
00099 :param str: byte array of serialized message, ``str``
00100 """
00101 try:
00102 if self.stamp is None:
00103 self.stamp = genpy.Time()
00104 end = 0
00105 start = end
00106 end += 4
00107 (length,) = _struct_I.unpack(str[start:end])
00108 start = end
00109 end += length
00110 if python3:
00111 self.name = str[start:end].decode('utf-8')
00112 else:
00113 self.name = str[start:end]
00114 _x = self
00115 start = end
00116 end += 12
00117 (_x.stamp.secs, _x.stamp.nsecs, _x.id, _x.value,) = _struct_2I2h.unpack(str[start:end])
00118 self.stamp.canon()
00119 return self
00120 except struct.error as e:
00121 raise genpy.DeserializationError(e)
00122
00123
00124 def serialize_numpy(self, buff, numpy):
00125 """
00126 serialize message with numpy array types into buffer
00127 :param buff: buffer, ``StringIO``
00128 :param numpy: numpy python module
00129 """
00130 try:
00131 _x = self.name
00132 length = len(_x)
00133 if python3 or type(_x) == unicode:
00134 _x = _x.encode('utf-8')
00135 length = len(_x)
00136 buff.write(struct.pack('<I%ss'%length, length, _x))
00137 _x = self
00138 buff.write(_struct_2I2h.pack(_x.stamp.secs, _x.stamp.nsecs, _x.id, _x.value))
00139 except struct.error as se: self._check_types(se)
00140 except TypeError as te: self._check_types(te)
00141
00142 def deserialize_numpy(self, str, numpy):
00143 """
00144 unpack serialized message in str into this message instance using numpy for array types
00145 :param str: byte array of serialized message, ``str``
00146 :param numpy: numpy python module
00147 """
00148 try:
00149 if self.stamp is None:
00150 self.stamp = genpy.Time()
00151 end = 0
00152 start = end
00153 end += 4
00154 (length,) = _struct_I.unpack(str[start:end])
00155 start = end
00156 end += length
00157 if python3:
00158 self.name = str[start:end].decode('utf-8')
00159 else:
00160 self.name = str[start:end]
00161 _x = self
00162 start = end
00163 end += 12
00164 (_x.stamp.secs, _x.stamp.nsecs, _x.id, _x.value,) = _struct_2I2h.unpack(str[start:end])
00165 self.stamp.canon()
00166 return self
00167 except struct.error as e:
00168 raise genpy.DeserializationError(e)
00169
00170 _struct_I = genpy.struct_I
00171 _struct_2I2h = struct.Struct("<2I2h")