00001 """autogenerated by genmsg_py from ScanGoal.msg. Do not edit."""
00002 import roslib.message
00003 import struct
00004
00005
00006 class ScanGoal(roslib.message.Message):
00007 _md5sum = "ba2593d2dce6a457221cb3434fea1def"
00008 _type = "wpa_supplicant_node/ScanGoal"
00009 _has_header = False
00010 _full_text = """# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======
00011 string[] ssids # Ssids to scan
00012 int32[] frequencies # Channels to scan in MHz
00013
00014 """
00015 __slots__ = ['ssids','frequencies']
00016 _slot_types = ['string[]','int32[]']
00017
00018 def __init__(self, *args, **kwds):
00019 """
00020 Constructor. Any message fields that are implicitly/explicitly
00021 set to None will be assigned a default value. The recommend
00022 use is keyword arguments as this is more robust to future message
00023 changes. You cannot mix in-order arguments and keyword arguments.
00024
00025 The available fields are:
00026 ssids,frequencies
00027
00028 @param args: complete set of field values, in .msg order
00029 @param kwds: use keyword arguments corresponding to message field names
00030 to set specific fields.
00031 """
00032 if args or kwds:
00033 super(ScanGoal, self).__init__(*args, **kwds)
00034
00035 if self.ssids is None:
00036 self.ssids = []
00037 if self.frequencies is None:
00038 self.frequencies = []
00039 else:
00040 self.ssids = []
00041 self.frequencies = []
00042
00043 def _get_types(self):
00044 """
00045 internal API method
00046 """
00047 return self._slot_types
00048
00049 def serialize(self, buff):
00050 """
00051 serialize message into buffer
00052 @param buff: buffer
00053 @type buff: StringIO
00054 """
00055 try:
00056 length = len(self.ssids)
00057 buff.write(_struct_I.pack(length))
00058 for val1 in self.ssids:
00059 length = len(val1)
00060 buff.write(struct.pack('<I%ss'%length, length, val1))
00061 length = len(self.frequencies)
00062 buff.write(_struct_I.pack(length))
00063 pattern = '<%si'%length
00064 buff.write(struct.pack(pattern, *self.frequencies))
00065 except struct.error, se: self._check_types(se)
00066 except TypeError, te: self._check_types(te)
00067
00068 def deserialize(self, str):
00069 """
00070 unpack serialized message in str into this message instance
00071 @param str: byte array of serialized message
00072 @type str: str
00073 """
00074 try:
00075 end = 0
00076 start = end
00077 end += 4
00078 (length,) = _struct_I.unpack(str[start:end])
00079 self.ssids = []
00080 for i in xrange(0, length):
00081 start = end
00082 end += 4
00083 (length,) = _struct_I.unpack(str[start:end])
00084 start = end
00085 end += length
00086 val1 = str[start:end]
00087 self.ssids.append(val1)
00088 start = end
00089 end += 4
00090 (length,) = _struct_I.unpack(str[start:end])
00091 pattern = '<%si'%length
00092 start = end
00093 end += struct.calcsize(pattern)
00094 self.frequencies = struct.unpack(pattern, str[start:end])
00095 return self
00096 except struct.error, e:
00097 raise roslib.message.DeserializationError(e)
00098
00099
00100 def serialize_numpy(self, buff, numpy):
00101 """
00102 serialize message with numpy array types into buffer
00103 @param buff: buffer
00104 @type buff: StringIO
00105 @param numpy: numpy python module
00106 @type numpy module
00107 """
00108 try:
00109 length = len(self.ssids)
00110 buff.write(_struct_I.pack(length))
00111 for val1 in self.ssids:
00112 length = len(val1)
00113 buff.write(struct.pack('<I%ss'%length, length, val1))
00114 length = len(self.frequencies)
00115 buff.write(_struct_I.pack(length))
00116 pattern = '<%si'%length
00117 buff.write(self.frequencies.tostring())
00118 except struct.error, se: self._check_types(se)
00119 except TypeError, te: self._check_types(te)
00120
00121 def deserialize_numpy(self, str, numpy):
00122 """
00123 unpack serialized message in str into this message instance using numpy for array types
00124 @param str: byte array of serialized message
00125 @type str: str
00126 @param numpy: numpy python module
00127 @type numpy: module
00128 """
00129 try:
00130 end = 0
00131 start = end
00132 end += 4
00133 (length,) = _struct_I.unpack(str[start:end])
00134 self.ssids = []
00135 for i in xrange(0, length):
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 val1 = str[start:end]
00142 self.ssids.append(val1)
00143 start = end
00144 end += 4
00145 (length,) = _struct_I.unpack(str[start:end])
00146 pattern = '<%si'%length
00147 start = end
00148 end += struct.calcsize(pattern)
00149 self.frequencies = numpy.frombuffer(str[start:end], dtype=numpy.int32, count=length)
00150 return self
00151 except struct.error, e:
00152 raise roslib.message.DeserializationError(e)
00153
00154 _struct_I = roslib.message.struct_I