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


wifi_ddwrt
Author(s): Scott Hassan/hassan@willowgarage.com, Eitan Marder-Eppstein/eitan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:36:08