Go to the documentation of this file.00001 """autogenerated by genpy from wpa_supplicant_node/ScanGoal.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 ScanGoal(genpy.Message):
00009 _md5sum = "ba2593d2dce6a457221cb3434fea1def"
00010 _type = "wpa_supplicant_node/ScanGoal"
00011 _has_header = False
00012 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00013 string[] ssids # Ssids to scan
00014 int32[] frequencies # Channels to scan in MHz
00015
00016 """
00017 __slots__ = ['ssids','frequencies']
00018 _slot_types = ['string[]','int32[]']
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 ssids,frequencies
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(ScanGoal, self).__init__(*args, **kwds)
00036
00037 if self.ssids is None:
00038 self.ssids = []
00039 if self.frequencies is None:
00040 self.frequencies = []
00041 else:
00042 self.ssids = []
00043 self.frequencies = []
00044
00045 def _get_types(self):
00046 """
00047 internal API method
00048 """
00049 return self._slot_types
00050
00051 def serialize(self, buff):
00052 """
00053 serialize message into buffer
00054 :param buff: buffer, ``StringIO``
00055 """
00056 try:
00057 length = len(self.ssids)
00058 buff.write(_struct_I.pack(length))
00059 for val1 in self.ssids:
00060 length = len(val1)
00061 if python3 or type(val1) == unicode:
00062 val1 = val1.encode('utf-8')
00063 length = len(val1)
00064 buff.write(struct.pack('<I%ss'%length, length, val1))
00065 length = len(self.frequencies)
00066 buff.write(_struct_I.pack(length))
00067 pattern = '<%si'%length
00068 buff.write(struct.pack(pattern, *self.frequencies))
00069 except struct.error as se: self._check_types(se)
00070 except TypeError as te: self._check_types(te)
00071
00072 def deserialize(self, str):
00073 """
00074 unpack serialized message in str into this message instance
00075 :param str: byte array of serialized message, ``str``
00076 """
00077 try:
00078 end = 0
00079 start = end
00080 end += 4
00081 (length,) = _struct_I.unpack(str[start:end])
00082 self.ssids = []
00083 for i in range(0, length):
00084 start = end
00085 end += 4
00086 (length,) = _struct_I.unpack(str[start:end])
00087 start = end
00088 end += length
00089 if python3:
00090 val1 = str[start:end].decode('utf-8')
00091 else:
00092 val1 = str[start:end]
00093 self.ssids.append(val1)
00094 start = end
00095 end += 4
00096 (length,) = _struct_I.unpack(str[start:end])
00097 pattern = '<%si'%length
00098 start = end
00099 end += struct.calcsize(pattern)
00100 self.frequencies = struct.unpack(pattern, str[start:end])
00101 return self
00102 except struct.error as e:
00103 raise genpy.DeserializationError(e)
00104
00105
00106 def serialize_numpy(self, buff, numpy):
00107 """
00108 serialize message with numpy array types into buffer
00109 :param buff: buffer, ``StringIO``
00110 :param numpy: numpy python module
00111 """
00112 try:
00113 length = len(self.ssids)
00114 buff.write(_struct_I.pack(length))
00115 for val1 in self.ssids:
00116 length = len(val1)
00117 if python3 or type(val1) == unicode:
00118 val1 = val1.encode('utf-8')
00119 length = len(val1)
00120 buff.write(struct.pack('<I%ss'%length, length, val1))
00121 length = len(self.frequencies)
00122 buff.write(_struct_I.pack(length))
00123 pattern = '<%si'%length
00124 buff.write(self.frequencies.tostring())
00125 except struct.error as se: self._check_types(se)
00126 except TypeError as te: self._check_types(te)
00127
00128 def deserialize_numpy(self, str, numpy):
00129 """
00130 unpack serialized message in str into this message instance using numpy for array types
00131 :param str: byte array of serialized message, ``str``
00132 :param numpy: numpy python module
00133 """
00134 try:
00135 end = 0
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 self.ssids = []
00140 for i in range(0, length):
00141 start = end
00142 end += 4
00143 (length,) = _struct_I.unpack(str[start:end])
00144 start = end
00145 end += length
00146 if python3:
00147 val1 = str[start:end].decode('utf-8')
00148 else:
00149 val1 = str[start:end]
00150 self.ssids.append(val1)
00151 start = end
00152 end += 4
00153 (length,) = _struct_I.unpack(str[start:end])
00154 pattern = '<%si'%length
00155 start = end
00156 end += struct.calcsize(pattern)
00157 self.frequencies = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00158 return self
00159 except struct.error as e:
00160 raise genpy.DeserializationError(e)
00161
00162 _struct_I = genpy.struct_I