1 """autogenerated by genpy from master_discovery_fkie/LinkState.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7
9 _md5sum = "d3fe0aab52336c0bd0bfea55b131c66e"
10 _type = "master_discovery_fkie/LinkState"
11 _has_header = False
12 _full_text = """string destination
13 float32 quality
14 """
15 __slots__ = ['destination','quality']
16 _slot_types = ['string','float32']
17
19 """
20 Constructor. Any message fields that are implicitly/explicitly
21 set to None will be assigned a default value. The recommend
22 use is keyword arguments as this is more robust to future message
23 changes. You cannot mix in-order arguments and keyword arguments.
24
25 The available fields are:
26 destination,quality
27
28 :param args: complete set of field values, in .msg order
29 :param kwds: use keyword arguments corresponding to message field names
30 to set specific fields.
31 """
32 if args or kwds:
33 super(LinkState, self).__init__(*args, **kwds)
34
35 if self.destination is None:
36 self.destination = ''
37 if self.quality is None:
38 self.quality = 0.
39 else:
40 self.destination = ''
41 self.quality = 0.
42
44 """
45 internal API method
46 """
47 return self._slot_types
48
50 """
51 serialize message into buffer
52 :param buff: buffer, ``StringIO``
53 """
54 try:
55 _x = self.destination
56 length = len(_x)
57 if python3 or type(_x) == unicode:
58 _x = _x.encode('utf-8')
59 length = len(_x)
60 buff.write(struct.pack('<I%ss'%length, length, _x))
61 buff.write(_struct_f.pack(self.quality))
62 except struct.error as se: self._check_types(se)
63 except TypeError as te: self._check_types(te)
64
66 """
67 unpack serialized message in str into this message instance
68 :param str: byte array of serialized message, ``str``
69 """
70 try:
71 end = 0
72 start = end
73 end += 4
74 (length,) = _struct_I.unpack(str[start:end])
75 start = end
76 end += length
77 if python3:
78 self.destination = str[start:end].decode('utf-8')
79 else:
80 self.destination = str[start:end]
81 start = end
82 end += 4
83 (self.quality,) = _struct_f.unpack(str[start:end])
84 return self
85 except struct.error as e:
86 raise genpy.DeserializationError(e)
87
88
90 """
91 serialize message with numpy array types into buffer
92 :param buff: buffer, ``StringIO``
93 :param numpy: numpy python module
94 """
95 try:
96 _x = self.destination
97 length = len(_x)
98 if python3 or type(_x) == unicode:
99 _x = _x.encode('utf-8')
100 length = len(_x)
101 buff.write(struct.pack('<I%ss'%length, length, _x))
102 buff.write(_struct_f.pack(self.quality))
103 except struct.error as se: self._check_types(se)
104 except TypeError as te: self._check_types(te)
105
107 """
108 unpack serialized message in str into this message instance using numpy for array types
109 :param str: byte array of serialized message, ``str``
110 :param numpy: numpy python module
111 """
112 try:
113 end = 0
114 start = end
115 end += 4
116 (length,) = _struct_I.unpack(str[start:end])
117 start = end
118 end += length
119 if python3:
120 self.destination = str[start:end].decode('utf-8')
121 else:
122 self.destination = str[start:end]
123 start = end
124 end += 4
125 (self.quality,) = _struct_f.unpack(str[start:end])
126 return self
127 except struct.error as e:
128 raise genpy.DeserializationError(e)
129
130 _struct_I = genpy.struct_I
131 _struct_f = struct.Struct("<f")
132