1 """autogenerated by genpy from master_discovery_fkie/MasterState.msg. Do not edit."""
2 import sys
3 python3 = True if sys.hexversion > 0x03000000 else False
4 import genpy
5 import struct
6
7 import master_discovery_fkie.msg
8
10 _md5sum = "80884072ff659ac99555a763e9ba0b23"
11 _type = "master_discovery_fkie/MasterState"
12 _has_header = False
13 _full_text = """string state
14 master_discovery_fkie/ROSMaster master
15
16 string STATE_NEW='new'
17 string STATE_REMOVED='removed'
18 string STATE_CHANGED='changed'
19
20 ================================================================================
21 MSG: master_discovery_fkie/ROSMaster
22 string name
23 # ROS Master URI
24 string uri
25 # The timestamp of the state of the remoter ROS master
26 float64 timestamp
27 # The timestamp of the state of the remoter ROS master, without the changes maked while a synchronization.
28 float64 timestamp_local
29 bool online
30 string discoverer_name
31 string monitoruri
32 """
33
34 STATE_NEW = r"'new'"
35 STATE_REMOVED = r"'removed'"
36 STATE_CHANGED = r"'changed'"
37
38 __slots__ = ['state','master']
39 _slot_types = ['string','master_discovery_fkie/ROSMaster']
40
42 """
43 Constructor. Any message fields that are implicitly/explicitly
44 set to None will be assigned a default value. The recommend
45 use is keyword arguments as this is more robust to future message
46 changes. You cannot mix in-order arguments and keyword arguments.
47
48 The available fields are:
49 state,master
50
51 :param args: complete set of field values, in .msg order
52 :param kwds: use keyword arguments corresponding to message field names
53 to set specific fields.
54 """
55 if args or kwds:
56 super(MasterState, self).__init__(*args, **kwds)
57
58 if self.state is None:
59 self.state = ''
60 if self.master is None:
61 self.master = master_discovery_fkie.msg.ROSMaster()
62 else:
63 self.state = ''
64 self.master = master_discovery_fkie.msg.ROSMaster()
65
67 """
68 internal API method
69 """
70 return self._slot_types
71
73 """
74 serialize message into buffer
75 :param buff: buffer, ``StringIO``
76 """
77 try:
78 _x = self.state
79 length = len(_x)
80 if python3 or type(_x) == unicode:
81 _x = _x.encode('utf-8')
82 length = len(_x)
83 buff.write(struct.pack('<I%ss'%length, length, _x))
84 _x = self.master.name
85 length = len(_x)
86 if python3 or type(_x) == unicode:
87 _x = _x.encode('utf-8')
88 length = len(_x)
89 buff.write(struct.pack('<I%ss'%length, length, _x))
90 _x = self.master.uri
91 length = len(_x)
92 if python3 or type(_x) == unicode:
93 _x = _x.encode('utf-8')
94 length = len(_x)
95 buff.write(struct.pack('<I%ss'%length, length, _x))
96 _x = self
97 buff.write(_struct_2dB.pack(_x.master.timestamp, _x.master.timestamp_local, _x.master.online))
98 _x = self.master.discoverer_name
99 length = len(_x)
100 if python3 or type(_x) == unicode:
101 _x = _x.encode('utf-8')
102 length = len(_x)
103 buff.write(struct.pack('<I%ss'%length, length, _x))
104 _x = self.master.monitoruri
105 length = len(_x)
106 if python3 or type(_x) == unicode:
107 _x = _x.encode('utf-8')
108 length = len(_x)
109 buff.write(struct.pack('<I%ss'%length, length, _x))
110 except struct.error as se: self._check_types(se)
111 except TypeError as te: self._check_types(te)
112
114 """
115 unpack serialized message in str into this message instance
116 :param str: byte array of serialized message, ``str``
117 """
118 try:
119 if self.master is None:
120 self.master = master_discovery_fkie.msg.ROSMaster()
121 end = 0
122 start = end
123 end += 4
124 (length,) = _struct_I.unpack(str[start:end])
125 start = end
126 end += length
127 if python3:
128 self.state = str[start:end].decode('utf-8')
129 else:
130 self.state = str[start:end]
131 start = end
132 end += 4
133 (length,) = _struct_I.unpack(str[start:end])
134 start = end
135 end += length
136 if python3:
137 self.master.name = str[start:end].decode('utf-8')
138 else:
139 self.master.name = str[start:end]
140 start = end
141 end += 4
142 (length,) = _struct_I.unpack(str[start:end])
143 start = end
144 end += length
145 if python3:
146 self.master.uri = str[start:end].decode('utf-8')
147 else:
148 self.master.uri = str[start:end]
149 _x = self
150 start = end
151 end += 17
152 (_x.master.timestamp, _x.master.timestamp_local, _x.master.online,) = _struct_2dB.unpack(str[start:end])
153 self.master.online = bool(self.master.online)
154 start = end
155 end += 4
156 (length,) = _struct_I.unpack(str[start:end])
157 start = end
158 end += length
159 if python3:
160 self.master.discoverer_name = str[start:end].decode('utf-8')
161 else:
162 self.master.discoverer_name = str[start:end]
163 start = end
164 end += 4
165 (length,) = _struct_I.unpack(str[start:end])
166 start = end
167 end += length
168 if python3:
169 self.master.monitoruri = str[start:end].decode('utf-8')
170 else:
171 self.master.monitoruri = str[start:end]
172 return self
173 except struct.error as e:
174 raise genpy.DeserializationError(e)
175
176
178 """
179 serialize message with numpy array types into buffer
180 :param buff: buffer, ``StringIO``
181 :param numpy: numpy python module
182 """
183 try:
184 _x = self.state
185 length = len(_x)
186 if python3 or type(_x) == unicode:
187 _x = _x.encode('utf-8')
188 length = len(_x)
189 buff.write(struct.pack('<I%ss'%length, length, _x))
190 _x = self.master.name
191 length = len(_x)
192 if python3 or type(_x) == unicode:
193 _x = _x.encode('utf-8')
194 length = len(_x)
195 buff.write(struct.pack('<I%ss'%length, length, _x))
196 _x = self.master.uri
197 length = len(_x)
198 if python3 or type(_x) == unicode:
199 _x = _x.encode('utf-8')
200 length = len(_x)
201 buff.write(struct.pack('<I%ss'%length, length, _x))
202 _x = self
203 buff.write(_struct_2dB.pack(_x.master.timestamp, _x.master.timestamp_local, _x.master.online))
204 _x = self.master.discoverer_name
205 length = len(_x)
206 if python3 or type(_x) == unicode:
207 _x = _x.encode('utf-8')
208 length = len(_x)
209 buff.write(struct.pack('<I%ss'%length, length, _x))
210 _x = self.master.monitoruri
211 length = len(_x)
212 if python3 or type(_x) == unicode:
213 _x = _x.encode('utf-8')
214 length = len(_x)
215 buff.write(struct.pack('<I%ss'%length, length, _x))
216 except struct.error as se: self._check_types(se)
217 except TypeError as te: self._check_types(te)
218
220 """
221 unpack serialized message in str into this message instance using numpy for array types
222 :param str: byte array of serialized message, ``str``
223 :param numpy: numpy python module
224 """
225 try:
226 if self.master is None:
227 self.master = master_discovery_fkie.msg.ROSMaster()
228 end = 0
229 start = end
230 end += 4
231 (length,) = _struct_I.unpack(str[start:end])
232 start = end
233 end += length
234 if python3:
235 self.state = str[start:end].decode('utf-8')
236 else:
237 self.state = str[start:end]
238 start = end
239 end += 4
240 (length,) = _struct_I.unpack(str[start:end])
241 start = end
242 end += length
243 if python3:
244 self.master.name = str[start:end].decode('utf-8')
245 else:
246 self.master.name = str[start:end]
247 start = end
248 end += 4
249 (length,) = _struct_I.unpack(str[start:end])
250 start = end
251 end += length
252 if python3:
253 self.master.uri = str[start:end].decode('utf-8')
254 else:
255 self.master.uri = str[start:end]
256 _x = self
257 start = end
258 end += 17
259 (_x.master.timestamp, _x.master.timestamp_local, _x.master.online,) = _struct_2dB.unpack(str[start:end])
260 self.master.online = bool(self.master.online)
261 start = end
262 end += 4
263 (length,) = _struct_I.unpack(str[start:end])
264 start = end
265 end += length
266 if python3:
267 self.master.discoverer_name = str[start:end].decode('utf-8')
268 else:
269 self.master.discoverer_name = str[start:end]
270 start = end
271 end += 4
272 (length,) = _struct_I.unpack(str[start:end])
273 start = end
274 end += length
275 if python3:
276 self.master.monitoruri = str[start:end].decode('utf-8')
277 else:
278 self.master.monitoruri = str[start:end]
279 return self
280 except struct.error as e:
281 raise genpy.DeserializationError(e)
282
283 _struct_I = genpy.struct_I
284 _struct_2dB = struct.Struct("<2dB")
285