_AssociateGoal.py
Go to the documentation of this file.
00001 """autogenerated by genpy from wpa_supplicant_node/AssociateGoal.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 AssociateGoal(genpy.Message):
00009   _md5sum = "c38a1e6906f8c27b31959e0b0a44e536"
00010   _type = "wpa_supplicant_node/AssociateGoal"
00011   _has_header = False #flag to mark the presence of a Header object
00012   _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 string ssid
00014 uint8[6] bssid
00015 #Bss bss
00016 
00017 """
00018   __slots__ = ['ssid','bssid']
00019   _slot_types = ['string','uint8[6]']
00020 
00021   def __init__(self, *args, **kwds):
00022     """
00023     Constructor. Any message fields that are implicitly/explicitly
00024     set to None will be assigned a default value. The recommend
00025     use is keyword arguments as this is more robust to future message
00026     changes.  You cannot mix in-order arguments and keyword arguments.
00027 
00028     The available fields are:
00029        ssid,bssid
00030 
00031     :param args: complete set of field values, in .msg order
00032     :param kwds: use keyword arguments corresponding to message field names
00033     to set specific fields.
00034     """
00035     if args or kwds:
00036       super(AssociateGoal, self).__init__(*args, **kwds)
00037       #message fields cannot be None, assign default values for those that are
00038       if self.ssid is None:
00039         self.ssid = ''
00040       if self.bssid is None:
00041         self.bssid = chr(0)*6
00042     else:
00043       self.ssid = ''
00044       self.bssid = chr(0)*6
00045 
00046   def _get_types(self):
00047     """
00048     internal API method
00049     """
00050     return self._slot_types
00051 
00052   def serialize(self, buff):
00053     """
00054     serialize message into buffer
00055     :param buff: buffer, ``StringIO``
00056     """
00057     try:
00058       _x = self.ssid
00059       length = len(_x)
00060       if python3 or type(_x) == unicode:
00061         _x = _x.encode('utf-8')
00062         length = len(_x)
00063       buff.write(struct.pack('<I%ss'%length, length, _x))
00064       _x = self.bssid
00065       # - if encoded as a list instead, serialize as bytes instead of string
00066       if type(_x) in [list, tuple]:
00067         buff.write(_struct_6B.pack(*_x))
00068       else:
00069         buff.write(_struct_6s.pack(_x))
00070     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00071     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00072 
00073   def deserialize(self, str):
00074     """
00075     unpack serialized message in str into this message instance
00076     :param str: byte array of serialized message, ``str``
00077     """
00078     try:
00079       end = 0
00080       start = end
00081       end += 4
00082       (length,) = _struct_I.unpack(str[start:end])
00083       start = end
00084       end += length
00085       if python3:
00086         self.ssid = str[start:end].decode('utf-8')
00087       else:
00088         self.ssid = str[start:end]
00089       start = end
00090       end += 6
00091       self.bssid = str[start:end]
00092       return self
00093     except struct.error as e:
00094       raise genpy.DeserializationError(e) #most likely buffer underfill
00095 
00096 
00097   def serialize_numpy(self, buff, numpy):
00098     """
00099     serialize message with numpy array types into buffer
00100     :param buff: buffer, ``StringIO``
00101     :param numpy: numpy python module
00102     """
00103     try:
00104       _x = self.ssid
00105       length = len(_x)
00106       if python3 or type(_x) == unicode:
00107         _x = _x.encode('utf-8')
00108         length = len(_x)
00109       buff.write(struct.pack('<I%ss'%length, length, _x))
00110       _x = self.bssid
00111       # - if encoded as a list instead, serialize as bytes instead of string
00112       if type(_x) in [list, tuple]:
00113         buff.write(_struct_6B.pack(*_x))
00114       else:
00115         buff.write(_struct_6s.pack(_x))
00116     except struct.error as se: self._check_types(struct.error("%s: '%s' when writing '%s'" % (type(se), str(se), str(_x))))
00117     except TypeError as te: self._check_types(ValueError("%s: '%s' when writing '%s'" % (type(te), str(te), str(_x))))
00118 
00119   def deserialize_numpy(self, str, numpy):
00120     """
00121     unpack serialized message in str into this message instance using numpy for array types
00122     :param str: byte array of serialized message, ``str``
00123     :param numpy: numpy python module
00124     """
00125     try:
00126       end = 0
00127       start = end
00128       end += 4
00129       (length,) = _struct_I.unpack(str[start:end])
00130       start = end
00131       end += length
00132       if python3:
00133         self.ssid = str[start:end].decode('utf-8')
00134       else:
00135         self.ssid = str[start:end]
00136       start = end
00137       end += 6
00138       self.bssid = str[start:end]
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_6B = struct.Struct("<6B")
00145 _struct_6s = struct.Struct("<6s")


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Apr 24 2014 15:33:19