00001 """autogenerated by genmsg_py from Network.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005 import wpa_supplicant_node.msg
00006
00007 class Network(roslib.message.Message):
00008 _md5sum = "daf87d6e9247d1f494a66a6eb210e85d"
00009 _type = "wpa_supplicant_node/Network"
00010 _has_header = False
00011 _full_text = """int32 network_id
00012 bool enabled
00013 NetworkParameter[] parameters
00014
00015 ================================================================================
00016 MSG: wpa_supplicant_node/NetworkParameter
00017 string key
00018 string value
00019
00020 """
00021 __slots__ = ['network_id','enabled','parameters']
00022 _slot_types = ['int32','bool','wpa_supplicant_node/NetworkParameter[]']
00023
00024 def __init__(self, *args, **kwds):
00025 """
00026 Constructor. Any message fields that are implicitly/explicitly
00027 set to None will be assigned a default value. The recommend
00028 use is keyword arguments as this is more robust to future message
00029 changes. You cannot mix in-order arguments and keyword arguments.
00030
00031 The available fields are:
00032 network_id,enabled,parameters
00033
00034 @param args: complete set of field values, in .msg order
00035 @param kwds: use keyword arguments corresponding to message field names
00036 to set specific fields.
00037 """
00038 if args or kwds:
00039 super(Network, self).__init__(*args, **kwds)
00040
00041 if self.network_id is None:
00042 self.network_id = 0
00043 if self.enabled is None:
00044 self.enabled = False
00045 if self.parameters is None:
00046 self.parameters = []
00047 else:
00048 self.network_id = 0
00049 self.enabled = False
00050 self.parameters = []
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
00062 @type buff: StringIO
00063 """
00064 try:
00065 _x = self
00066 buff.write(_struct_iB.pack(_x.network_id, _x.enabled))
00067 length = len(self.parameters)
00068 buff.write(_struct_I.pack(length))
00069 for val1 in self.parameters:
00070 _x = val1.key
00071 length = len(_x)
00072 buff.write(struct.pack('<I%ss'%length, length, _x))
00073 _x = val1.value
00074 length = len(_x)
00075 buff.write(struct.pack('<I%ss'%length, length, _x))
00076 except struct.error, se: self._check_types(se)
00077 except TypeError, te: self._check_types(te)
00078
00079 def deserialize(self, str):
00080 """
00081 unpack serialized message in str into this message instance
00082 @param str: byte array of serialized message
00083 @type str: str
00084 """
00085 try:
00086 end = 0
00087 _x = self
00088 start = end
00089 end += 5
00090 (_x.network_id, _x.enabled,) = _struct_iB.unpack(str[start:end])
00091 self.enabled = bool(self.enabled)
00092 start = end
00093 end += 4
00094 (length,) = _struct_I.unpack(str[start:end])
00095 self.parameters = []
00096 for i in xrange(0, length):
00097 val1 = wpa_supplicant_node.msg.NetworkParameter()
00098 start = end
00099 end += 4
00100 (length,) = _struct_I.unpack(str[start:end])
00101 start = end
00102 end += length
00103 val1.key = str[start:end]
00104 start = end
00105 end += 4
00106 (length,) = _struct_I.unpack(str[start:end])
00107 start = end
00108 end += length
00109 val1.value = str[start:end]
00110 self.parameters.append(val1)
00111 return self
00112 except struct.error, e:
00113 raise roslib.message.DeserializationError(e)
00114
00115
00116 def serialize_numpy(self, buff, numpy):
00117 """
00118 serialize message with numpy array types into buffer
00119 @param buff: buffer
00120 @type buff: StringIO
00121 @param numpy: numpy python module
00122 @type numpy module
00123 """
00124 try:
00125 _x = self
00126 buff.write(_struct_iB.pack(_x.network_id, _x.enabled))
00127 length = len(self.parameters)
00128 buff.write(_struct_I.pack(length))
00129 for val1 in self.parameters:
00130 _x = val1.key
00131 length = len(_x)
00132 buff.write(struct.pack('<I%ss'%length, length, _x))
00133 _x = val1.value
00134 length = len(_x)
00135 buff.write(struct.pack('<I%ss'%length, length, _x))
00136 except struct.error, se: self._check_types(se)
00137 except TypeError, te: self._check_types(te)
00138
00139 def deserialize_numpy(self, str, numpy):
00140 """
00141 unpack serialized message in str into this message instance using numpy for array types
00142 @param str: byte array of serialized message
00143 @type str: str
00144 @param numpy: numpy python module
00145 @type numpy: module
00146 """
00147 try:
00148 end = 0
00149 _x = self
00150 start = end
00151 end += 5
00152 (_x.network_id, _x.enabled,) = _struct_iB.unpack(str[start:end])
00153 self.enabled = bool(self.enabled)
00154 start = end
00155 end += 4
00156 (length,) = _struct_I.unpack(str[start:end])
00157 self.parameters = []
00158 for i in xrange(0, length):
00159 val1 = wpa_supplicant_node.msg.NetworkParameter()
00160 start = end
00161 end += 4
00162 (length,) = _struct_I.unpack(str[start:end])
00163 start = end
00164 end += length
00165 val1.key = str[start:end]
00166 start = end
00167 end += 4
00168 (length,) = _struct_I.unpack(str[start:end])
00169 start = end
00170 end += length
00171 val1.value = str[start:end]
00172 self.parameters.append(val1)
00173 return self
00174 except struct.error, e:
00175 raise roslib.message.DeserializationError(e)
00176
00177 _struct_I = roslib.message.struct_I
00178 _struct_iB = struct.Struct("<iB")