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


wpa_supplicant_node
Author(s): Package maintained by Blaise Gassend
autogenerated on Thu Jan 2 2014 11:25:12