00001 """autogenerated by genpy from tug_ist_diagnosis_msgs/Channel.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 Channel(genpy.Message):
00009 _md5sum = "a892da4b04bb1ee7a9c52668e370ec76"
00010 _type = "tug_ist_diagnosis_msgs/Channel"
00011 _has_header = False
00012 _full_text = """int32 id
00013 string dev_connected
00014 int32 status
00015 float32 current
00016 float32 voltage
00017
00018 """
00019 __slots__ = ['id','dev_connected','status','current','voltage']
00020 _slot_types = ['int32','string','int32','float32','float32']
00021
00022 def __init__(self, *args, **kwds):
00023 """
00024 Constructor. Any message fields that are implicitly/explicitly
00025 set to None will be assigned a default value. The recommend
00026 use is keyword arguments as this is more robust to future message
00027 changes. You cannot mix in-order arguments and keyword arguments.
00028
00029 The available fields are:
00030 id,dev_connected,status,current,voltage
00031
00032 :param args: complete set of field values, in .msg order
00033 :param kwds: use keyword arguments corresponding to message field names
00034 to set specific fields.
00035 """
00036 if args or kwds:
00037 super(Channel, self).__init__(*args, **kwds)
00038
00039 if self.id is None:
00040 self.id = 0
00041 if self.dev_connected is None:
00042 self.dev_connected = ''
00043 if self.status is None:
00044 self.status = 0
00045 if self.current is None:
00046 self.current = 0.
00047 if self.voltage is None:
00048 self.voltage = 0.
00049 else:
00050 self.id = 0
00051 self.dev_connected = ''
00052 self.status = 0
00053 self.current = 0.
00054 self.voltage = 0.
00055
00056 def _get_types(self):
00057 """
00058 internal API method
00059 """
00060 return self._slot_types
00061
00062 def serialize(self, buff):
00063 """
00064 serialize message into buffer
00065 :param buff: buffer, ``StringIO``
00066 """
00067 try:
00068 buff.write(_struct_i.pack(self.id))
00069 _x = self.dev_connected
00070 length = len(_x)
00071 if python3 or type(_x) == unicode:
00072 _x = _x.encode('utf-8')
00073 length = len(_x)
00074 buff.write(struct.pack('<I%ss'%length, length, _x))
00075 _x = self
00076 buff.write(_struct_i2f.pack(_x.status, _x.current, _x.voltage))
00077 except struct.error as se: self._check_types(se)
00078 except TypeError as te: self._check_types(te)
00079
00080 def deserialize(self, str):
00081 """
00082 unpack serialized message in str into this message instance
00083 :param str: byte array of serialized message, ``str``
00084 """
00085 try:
00086 end = 0
00087 start = end
00088 end += 4
00089 (self.id,) = _struct_i.unpack(str[start:end])
00090 start = end
00091 end += 4
00092 (length,) = _struct_I.unpack(str[start:end])
00093 start = end
00094 end += length
00095 if python3:
00096 self.dev_connected = str[start:end].decode('utf-8')
00097 else:
00098 self.dev_connected = str[start:end]
00099 _x = self
00100 start = end
00101 end += 12
00102 (_x.status, _x.current, _x.voltage,) = _struct_i2f.unpack(str[start:end])
00103 return self
00104 except struct.error as e:
00105 raise genpy.DeserializationError(e)
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.id))
00116 _x = self.dev_connected
00117 length = len(_x)
00118 if python3 or type(_x) == unicode:
00119 _x = _x.encode('utf-8')
00120 length = len(_x)
00121 buff.write(struct.pack('<I%ss'%length, length, _x))
00122 _x = self
00123 buff.write(_struct_i2f.pack(_x.status, _x.current, _x.voltage))
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.id,) = _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.dev_connected = str[start:end].decode('utf-8')
00145 else:
00146 self.dev_connected = str[start:end]
00147 _x = self
00148 start = end
00149 end += 12
00150 (_x.status, _x.current, _x.voltage,) = _struct_i2f.unpack(str[start:end])
00151 return self
00152 except struct.error as e:
00153 raise genpy.DeserializationError(e)
00154
00155 _struct_I = genpy.struct_I
00156 _struct_i = struct.Struct("<i")
00157 _struct_i2f = struct.Struct("<i2f")