_ecstats.py
Go to the documentation of this file.
00001 """autogenerated by genpy from ectools/ecstats.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 ecstats(genpy.Message):
00009   _md5sum = "115cb9793e197c78f9d3809b3132b379"
00010   _type = "ectools/ecstats"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """bool    has_link
00013 int32   max_device_count
00014 int32   interval_min_device_count
00015 uint64  total_sent_packets
00016 uint64  interval_sent_packets
00017 uint64  total_dropped_packets
00018 uint64  interval_dropped_packets
00019 uint64  total_late_packets
00020 uint64  interval_late_packets
00021 float64 total_bandwidth_mbps
00022 float64 interval_bandwidth_mbps
00023 
00024 """
00025   __slots__ = ['has_link','max_device_count','interval_min_device_count','total_sent_packets','interval_sent_packets','total_dropped_packets','interval_dropped_packets','total_late_packets','interval_late_packets','total_bandwidth_mbps','interval_bandwidth_mbps']
00026   _slot_types = ['bool','int32','int32','uint64','uint64','uint64','uint64','uint64','uint64','float64','float64']
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        has_link,max_device_count,interval_min_device_count,total_sent_packets,interval_sent_packets,total_dropped_packets,interval_dropped_packets,total_late_packets,interval_late_packets,total_bandwidth_mbps,interval_bandwidth_mbps
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(ecstats, self).__init__(*args, **kwds)
00044       #message fields cannot be None, assign default values for those that are
00045       if self.has_link is None:
00046         self.has_link = False
00047       if self.max_device_count is None:
00048         self.max_device_count = 0
00049       if self.interval_min_device_count is None:
00050         self.interval_min_device_count = 0
00051       if self.total_sent_packets is None:
00052         self.total_sent_packets = 0
00053       if self.interval_sent_packets is None:
00054         self.interval_sent_packets = 0
00055       if self.total_dropped_packets is None:
00056         self.total_dropped_packets = 0
00057       if self.interval_dropped_packets is None:
00058         self.interval_dropped_packets = 0
00059       if self.total_late_packets is None:
00060         self.total_late_packets = 0
00061       if self.interval_late_packets is None:
00062         self.interval_late_packets = 0
00063       if self.total_bandwidth_mbps is None:
00064         self.total_bandwidth_mbps = 0.
00065       if self.interval_bandwidth_mbps is None:
00066         self.interval_bandwidth_mbps = 0.
00067     else:
00068       self.has_link = False
00069       self.max_device_count = 0
00070       self.interval_min_device_count = 0
00071       self.total_sent_packets = 0
00072       self.interval_sent_packets = 0
00073       self.total_dropped_packets = 0
00074       self.interval_dropped_packets = 0
00075       self.total_late_packets = 0
00076       self.interval_late_packets = 0
00077       self.total_bandwidth_mbps = 0.
00078       self.interval_bandwidth_mbps = 0.
00079 
00080   def _get_types(self):
00081     """
00082     internal API method
00083     """
00084     return self._slot_types
00085 
00086   def serialize(self, buff):
00087     """
00088     serialize message into buffer
00089     :param buff: buffer, ``StringIO``
00090     """
00091     try:
00092       _x = self
00093       buff.write(_struct_B2i6Q2d.pack(_x.has_link, _x.max_device_count, _x.interval_min_device_count, _x.total_sent_packets, _x.interval_sent_packets, _x.total_dropped_packets, _x.interval_dropped_packets, _x.total_late_packets, _x.interval_late_packets, _x.total_bandwidth_mbps, _x.interval_bandwidth_mbps))
00094     except struct.error as se: self._check_types(se)
00095     except TypeError as te: self._check_types(te)
00096 
00097   def deserialize(self, str):
00098     """
00099     unpack serialized message in str into this message instance
00100     :param str: byte array of serialized message, ``str``
00101     """
00102     try:
00103       end = 0
00104       _x = self
00105       start = end
00106       end += 73
00107       (_x.has_link, _x.max_device_count, _x.interval_min_device_count, _x.total_sent_packets, _x.interval_sent_packets, _x.total_dropped_packets, _x.interval_dropped_packets, _x.total_late_packets, _x.interval_late_packets, _x.total_bandwidth_mbps, _x.interval_bandwidth_mbps,) = _struct_B2i6Q2d.unpack(str[start:end])
00108       self.has_link = bool(self.has_link)
00109       return self
00110     except struct.error as e:
00111       raise genpy.DeserializationError(e) #most likely buffer underfill
00112 
00113 
00114   def serialize_numpy(self, buff, numpy):
00115     """
00116     serialize message with numpy array types into buffer
00117     :param buff: buffer, ``StringIO``
00118     :param numpy: numpy python module
00119     """
00120     try:
00121       _x = self
00122       buff.write(_struct_B2i6Q2d.pack(_x.has_link, _x.max_device_count, _x.interval_min_device_count, _x.total_sent_packets, _x.interval_sent_packets, _x.total_dropped_packets, _x.interval_dropped_packets, _x.total_late_packets, _x.interval_late_packets, _x.total_bandwidth_mbps, _x.interval_bandwidth_mbps))
00123     except struct.error as se: self._check_types(se)
00124     except TypeError as te: self._check_types(te)
00125 
00126   def deserialize_numpy(self, str, numpy):
00127     """
00128     unpack serialized message in str into this message instance using numpy for array types
00129     :param str: byte array of serialized message, ``str``
00130     :param numpy: numpy python module
00131     """
00132     try:
00133       end = 0
00134       _x = self
00135       start = end
00136       end += 73
00137       (_x.has_link, _x.max_device_count, _x.interval_min_device_count, _x.total_sent_packets, _x.interval_sent_packets, _x.total_dropped_packets, _x.interval_dropped_packets, _x.total_late_packets, _x.interval_late_packets, _x.total_bandwidth_mbps, _x.interval_bandwidth_mbps,) = _struct_B2i6Q2d.unpack(str[start:end])
00138       self.has_link = bool(self.has_link)
00139       return self
00140     except struct.error as e:
00141       raise genpy.DeserializationError(e) #most likely buffer underfill
00142 
00143 _struct_I = genpy.struct_I
00144 _struct_B2i6Q2d = struct.Struct("<B2i6Q2d")


ectools
Author(s): Derek King
autogenerated on Sat Dec 28 2013 17:52:56