_DBoardMeasurments.py
Go to the documentation of this file.
00001 """autogenerated by genpy from tug_ist_diagnosis_msgs/DBoardMeasurments.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 tug_ist_diagnosis_msgs.msg
00008 
00009 class DBoardMeasurments(genpy.Message):
00010   _md5sum = "4824daab1e9545346b582551fc8fa86b"
00011   _type = "tug_ist_diagnosis_msgs/DBoardMeasurments"
00012   _has_header = False #flag to mark the presence of a Header object
00013   _full_text = """float32 o_time
00014 Channel[] channel
00015 
00016 ================================================================================
00017 MSG: tug_ist_diagnosis_msgs/Channel
00018 int32 id
00019 string dev_connected
00020 int32 status
00021 float32 current
00022 float32 voltage
00023 
00024 """
00025   __slots__ = ['o_time','channel']
00026   _slot_types = ['float32','tug_ist_diagnosis_msgs/Channel[]']
00027 
00028   def __init__(self, *args, **kwds):
00029     """
00030     Constructor. Any message fields that are implicitly/explicitly
00031     set to None will be assigned a default value. The recommend
00032     use is keyword arguments as this is more robust to future message
00033     changes.  You cannot mix in-order arguments and keyword arguments.
00034 
00035     The available fields are:
00036        o_time,channel
00037 
00038     :param args: complete set of field values, in .msg order
00039     :param kwds: use keyword arguments corresponding to message field names
00040     to set specific fields.
00041     """
00042     if args or kwds:
00043       super(DBoardMeasurments, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.o_time is None:
00046         self.o_time = 0.
00047       if self.channel is None:
00048         self.channel = []
00049     else:
00050       self.o_time = 0.
00051       self.channel = []
00052 
00053   def _get_types(self):
00054     """
00055     internal API method
00056     """
00057     return self._slot_types
00058 
00059   def serialize(self, buff):
00060     """
00061     serialize message into buffer
00062     :param buff: buffer, ``StringIO``
00063     """
00064     try:
00065       buff.write(_struct_f.pack(self.o_time))
00066       length = len(self.channel)
00067       buff.write(_struct_I.pack(length))
00068       for val1 in self.channel:
00069         buff.write(_struct_i.pack(val1.id))
00070         _x = val1.dev_connected
00071         length = len(_x)
00072         if python3 or type(_x) == unicode:
00073           _x = _x.encode('utf-8')
00074           length = len(_x)
00075         buff.write(struct.pack('<I%ss'%length, length, _x))
00076         _x = val1
00077         buff.write(_struct_i2f.pack(_x.status, _x.current, _x.voltage))
00078     except struct.error as se: self._check_types(se)
00079     except TypeError as te: self._check_types(te)
00080 
00081   def deserialize(self, str):
00082     """
00083     unpack serialized message in str into this message instance
00084     :param str: byte array of serialized message, ``str``
00085     """
00086     try:
00087       if self.channel is None:
00088         self.channel = None
00089       end = 0
00090       start = end
00091       end += 4
00092       (self.o_time,) = _struct_f.unpack(str[start:end])
00093       start = end
00094       end += 4
00095       (length,) = _struct_I.unpack(str[start:end])
00096       self.channel = []
00097       for i in range(0, length):
00098         val1 = tug_ist_diagnosis_msgs.msg.Channel()
00099         start = end
00100         end += 4
00101         (val1.id,) = _struct_i.unpack(str[start:end])
00102         start = end
00103         end += 4
00104         (length,) = _struct_I.unpack(str[start:end])
00105         start = end
00106         end += length
00107         if python3:
00108           val1.dev_connected = str[start:end].decode('utf-8')
00109         else:
00110           val1.dev_connected = str[start:end]
00111         _x = val1
00112         start = end
00113         end += 12
00114         (_x.status, _x.current, _x.voltage,) = _struct_i2f.unpack(str[start:end])
00115         self.channel.append(val1)
00116       return self
00117     except struct.error as e:
00118       raise genpy.DeserializationError(e) #most likely buffer underfill
00119 
00120 
00121   def serialize_numpy(self, buff, numpy):
00122     """
00123     serialize message with numpy array types into buffer
00124     :param buff: buffer, ``StringIO``
00125     :param numpy: numpy python module
00126     """
00127     try:
00128       buff.write(_struct_f.pack(self.o_time))
00129       length = len(self.channel)
00130       buff.write(_struct_I.pack(length))
00131       for val1 in self.channel:
00132         buff.write(_struct_i.pack(val1.id))
00133         _x = val1.dev_connected
00134         length = len(_x)
00135         if python3 or type(_x) == unicode:
00136           _x = _x.encode('utf-8')
00137           length = len(_x)
00138         buff.write(struct.pack('<I%ss'%length, length, _x))
00139         _x = val1
00140         buff.write(_struct_i2f.pack(_x.status, _x.current, _x.voltage))
00141     except struct.error as se: self._check_types(se)
00142     except TypeError as te: self._check_types(te)
00143 
00144   def deserialize_numpy(self, str, numpy):
00145     """
00146     unpack serialized message in str into this message instance using numpy for array types
00147     :param str: byte array of serialized message, ``str``
00148     :param numpy: numpy python module
00149     """
00150     try:
00151       if self.channel is None:
00152         self.channel = None
00153       end = 0
00154       start = end
00155       end += 4
00156       (self.o_time,) = _struct_f.unpack(str[start:end])
00157       start = end
00158       end += 4
00159       (length,) = _struct_I.unpack(str[start:end])
00160       self.channel = []
00161       for i in range(0, length):
00162         val1 = tug_ist_diagnosis_msgs.msg.Channel()
00163         start = end
00164         end += 4
00165         (val1.id,) = _struct_i.unpack(str[start:end])
00166         start = end
00167         end += 4
00168         (length,) = _struct_I.unpack(str[start:end])
00169         start = end
00170         end += length
00171         if python3:
00172           val1.dev_connected = str[start:end].decode('utf-8')
00173         else:
00174           val1.dev_connected = str[start:end]
00175         _x = val1
00176         start = end
00177         end += 12
00178         (_x.status, _x.current, _x.voltage,) = _struct_i2f.unpack(str[start:end])
00179         self.channel.append(val1)
00180       return self
00181     except struct.error as e:
00182       raise genpy.DeserializationError(e) #most likely buffer underfill
00183 
00184 _struct_I = genpy.struct_I
00185 _struct_i = struct.Struct("<i")
00186 _struct_i2f = struct.Struct("<i2f")
00187 _struct_f = struct.Struct("<f")


tug_ist_diagnosis_msgs
Author(s): Safdar Zaman, Gerald Steinbauer
autogenerated on Mon Jan 6 2014 11:51:02