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


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