$search
00001 """autogenerated by genmsg_py from NetworkList.msg. Do not edit.""" 00002 import roslib.message 00003 import struct 00004 00005 import wpa_supplicant_node.msg 00006 00007 class NetworkList(roslib.message.Message): 00008 _md5sum = "87beb766062d9c7233cf489c11ade2e1" 00009 _type = "wpa_supplicant_node/NetworkList" 00010 _has_header = False #flag to mark the presence of a Header object 00011 _full_text = """wpa_supplicant_node/Network[] networks 00012 00013 ================================================================================ 00014 MSG: wpa_supplicant_node/Network 00015 int32 network_id 00016 bool enabled 00017 NetworkParameter[] parameters 00018 00019 ================================================================================ 00020 MSG: wpa_supplicant_node/NetworkParameter 00021 string key 00022 string value 00023 00024 """ 00025 __slots__ = ['networks'] 00026 _slot_types = ['wpa_supplicant_node/Network[]'] 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 networks 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(NetworkList, self).__init__(*args, **kwds) 00044 #message fields cannot be None, assign default values for those that are 00045 if self.networks is None: 00046 self.networks = [] 00047 else: 00048 self.networks = [] 00049 00050 def _get_types(self): 00051 """ 00052 internal API method 00053 """ 00054 return self._slot_types 00055 00056 def serialize(self, buff): 00057 """ 00058 serialize message into buffer 00059 @param buff: buffer 00060 @type buff: StringIO 00061 """ 00062 try: 00063 length = len(self.networks) 00064 buff.write(_struct_I.pack(length)) 00065 for val1 in self.networks: 00066 _x = val1 00067 buff.write(_struct_iB.pack(_x.network_id, _x.enabled)) 00068 length = len(val1.parameters) 00069 buff.write(_struct_I.pack(length)) 00070 for val2 in val1.parameters: 00071 _x = val2.key 00072 length = len(_x) 00073 buff.write(struct.pack('<I%ss'%length, length, _x)) 00074 _x = val2.value 00075 length = len(_x) 00076 buff.write(struct.pack('<I%ss'%length, length, _x)) 00077 except struct.error as se: self._check_types(se) 00078 except TypeError as te: self._check_types(te) 00079 00080 def deserialize(self, str): 00081 """ 00082 unpack serialized message in str into this message instance 00083 @param str: byte array of serialized message 00084 @type str: str 00085 """ 00086 try: 00087 end = 0 00088 start = end 00089 end += 4 00090 (length,) = _struct_I.unpack(str[start:end]) 00091 self.networks = [] 00092 for i in range(0, length): 00093 val1 = wpa_supplicant_node.msg.Network() 00094 _x = val1 00095 start = end 00096 end += 5 00097 (_x.network_id, _x.enabled,) = _struct_iB.unpack(str[start:end]) 00098 val1.enabled = bool(val1.enabled) 00099 start = end 00100 end += 4 00101 (length,) = _struct_I.unpack(str[start:end]) 00102 val1.parameters = [] 00103 for i in range(0, length): 00104 val2 = wpa_supplicant_node.msg.NetworkParameter() 00105 start = end 00106 end += 4 00107 (length,) = _struct_I.unpack(str[start:end]) 00108 start = end 00109 end += length 00110 val2.key = str[start:end] 00111 start = end 00112 end += 4 00113 (length,) = _struct_I.unpack(str[start:end]) 00114 start = end 00115 end += length 00116 val2.value = str[start:end] 00117 val1.parameters.append(val2) 00118 self.networks.append(val1) 00119 return self 00120 except struct.error as e: 00121 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00122 00123 00124 def serialize_numpy(self, buff, numpy): 00125 """ 00126 serialize message with numpy array types into buffer 00127 @param buff: buffer 00128 @type buff: StringIO 00129 @param numpy: numpy python module 00130 @type numpy module 00131 """ 00132 try: 00133 length = len(self.networks) 00134 buff.write(_struct_I.pack(length)) 00135 for val1 in self.networks: 00136 _x = val1 00137 buff.write(_struct_iB.pack(_x.network_id, _x.enabled)) 00138 length = len(val1.parameters) 00139 buff.write(_struct_I.pack(length)) 00140 for val2 in val1.parameters: 00141 _x = val2.key 00142 length = len(_x) 00143 buff.write(struct.pack('<I%ss'%length, length, _x)) 00144 _x = val2.value 00145 length = len(_x) 00146 buff.write(struct.pack('<I%ss'%length, length, _x)) 00147 except struct.error as se: self._check_types(se) 00148 except TypeError as te: self._check_types(te) 00149 00150 def deserialize_numpy(self, str, numpy): 00151 """ 00152 unpack serialized message in str into this message instance using numpy for array types 00153 @param str: byte array of serialized message 00154 @type str: str 00155 @param numpy: numpy python module 00156 @type numpy: module 00157 """ 00158 try: 00159 end = 0 00160 start = end 00161 end += 4 00162 (length,) = _struct_I.unpack(str[start:end]) 00163 self.networks = [] 00164 for i in range(0, length): 00165 val1 = wpa_supplicant_node.msg.Network() 00166 _x = val1 00167 start = end 00168 end += 5 00169 (_x.network_id, _x.enabled,) = _struct_iB.unpack(str[start:end]) 00170 val1.enabled = bool(val1.enabled) 00171 start = end 00172 end += 4 00173 (length,) = _struct_I.unpack(str[start:end]) 00174 val1.parameters = [] 00175 for i in range(0, length): 00176 val2 = wpa_supplicant_node.msg.NetworkParameter() 00177 start = end 00178 end += 4 00179 (length,) = _struct_I.unpack(str[start:end]) 00180 start = end 00181 end += length 00182 val2.key = str[start:end] 00183 start = end 00184 end += 4 00185 (length,) = _struct_I.unpack(str[start:end]) 00186 start = end 00187 end += length 00188 val2.value = str[start:end] 00189 val1.parameters.append(val2) 00190 self.networks.append(val1) 00191 return self 00192 except struct.error as e: 00193 raise roslib.message.DeserializationError(e) #most likely buffer underfill 00194 00195 _struct_I = roslib.message.struct_I 00196 _struct_iB = struct.Struct("<iB")