Fawkes API  Fawkes Development Version
Roomba500Interface.cpp
1 
2 /***************************************************************************
3  * Roomba500Interface.cpp - Fawkes BlackBoard Interface - Roomba500Interface
4  *
5  * Templated created: Thu Oct 12 10:49:19 2006
6  * Copyright 2011 Tim Niemueller
7  *
8  ****************************************************************************/
9 
10 /* This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version. A runtime exception applies to
14  * this software (see LICENSE.GPL_WRE file mentioned below for details).
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Library General Public License for more details.
20  *
21  * Read the full text in the LICENSE.GPL_WRE file in the doc directory.
22  */
23 
24 #include <interfaces/Roomba500Interface.h>
25 
26 #include <core/exceptions/software.h>
27 
28 #include <cstring>
29 #include <cstdlib>
30 
31 namespace fawkes {
32 
33 /** @class Roomba500Interface <interfaces/Roomba500Interface.h>
34  * Roomba500Interface Fawkes BlackBoard Interface.
35  *
36  Roomba 500 hardware interface.
37 
38  * @ingroup FawkesInterfaces
39  */
40 
41 
42 
43 /** Constructor */
44 Roomba500Interface::Roomba500Interface() : Interface()
45 {
46  data_size = sizeof(Roomba500Interface_data_t);
47  data_ptr = malloc(data_size);
48  data = (Roomba500Interface_data_t *)data_ptr;
49  data_ts = (interface_data_ts_t *)data_ptr;
50  memset(data_ptr, 0, data_size);
51  add_fieldinfo(IFT_ENUM, "mode", 1, &data->mode);
52  add_fieldinfo(IFT_BOOL, "wheel_drop_left", 1, &data->wheel_drop_left, "");
53  add_fieldinfo(IFT_BOOL, "wheel_drop_right", 1, &data->wheel_drop_right, "");
54  add_fieldinfo(IFT_BOOL, "bump_left", 1, &data->bump_left, "");
55  add_fieldinfo(IFT_BOOL, "bump_right", 1, &data->bump_right, "");
56  add_fieldinfo(IFT_BOOL, "wall", 1, &data->wall, "");
57  add_fieldinfo(IFT_BOOL, "cliff_left", 1, &data->cliff_left, "");
58  add_fieldinfo(IFT_BOOL, "cliff_front_left", 1, &data->cliff_front_left, "");
59  add_fieldinfo(IFT_BOOL, "cliff_front_right", 1, &data->cliff_front_right, "");
60  add_fieldinfo(IFT_BOOL, "cliff_right", 1, &data->cliff_right, "");
61  add_fieldinfo(IFT_BOOL, "virtual_wall", 1, &data->virtual_wall, "");
62  add_fieldinfo(IFT_BOOL, "overcurrent_side_brush", 1, &data->overcurrent_side_brush, "");
63  add_fieldinfo(IFT_BOOL, "overcurrent_main_brush", 1, &data->overcurrent_main_brush, "");
64  add_fieldinfo(IFT_BOOL, "overcurrent_left_wheel", 1, &data->overcurrent_left_wheel, "");
65  add_fieldinfo(IFT_BOOL, "overcurrent_right_wheel", 1, &data->overcurrent_right_wheel, "");
66  add_fieldinfo(IFT_BOOL, "dirt_detect", 1, &data->dirt_detect, "");
67  add_fieldinfo(IFT_ENUM, "ir_opcode_omni", 1, &data->ir_opcode_omni);
68  add_fieldinfo(IFT_BOOL, "button_clean", 1, &data->button_clean, "");
69  add_fieldinfo(IFT_BOOL, "button_spot", 1, &data->button_spot, "");
70  add_fieldinfo(IFT_BOOL, "button_dock", 1, &data->button_dock, "");
71  add_fieldinfo(IFT_BOOL, "button_minute", 1, &data->button_minute, "");
72  add_fieldinfo(IFT_BOOL, "button_hour", 1, &data->button_hour, "");
73  add_fieldinfo(IFT_BOOL, "button_day", 1, &data->button_day, "");
74  add_fieldinfo(IFT_BOOL, "button_schedule", 1, &data->button_schedule, "");
75  add_fieldinfo(IFT_BOOL, "button_clock", 1, &data->button_clock, "");
76  add_fieldinfo(IFT_INT16, "distance", 1, &data->distance, "");
77  add_fieldinfo(IFT_INT16, "angle", 1, &data->angle, "");
78  add_fieldinfo(IFT_ENUM, "charging_state", 1, &data->charging_state);
79  add_fieldinfo(IFT_UINT16, "voltage", 1, &data->voltage, "");
80  add_fieldinfo(IFT_INT16, "current", 1, &data->current, "");
81  add_fieldinfo(IFT_INT8, "temperature", 1, &data->temperature, "");
82  add_fieldinfo(IFT_UINT16, "battery_charge", 1, &data->battery_charge, "");
83  add_fieldinfo(IFT_UINT16, "battery_capacity", 1, &data->battery_capacity, "");
84  add_fieldinfo(IFT_UINT16, "wall_signal", 1, &data->wall_signal, "");
85  add_fieldinfo(IFT_UINT16, "cliff_left_signal", 1, &data->cliff_left_signal, "");
86  add_fieldinfo(IFT_UINT16, "cliff_front_left_signal", 1, &data->cliff_front_left_signal, "");
87  add_fieldinfo(IFT_UINT16, "cliff_front_right_signal", 1, &data->cliff_front_right_signal, "");
88  add_fieldinfo(IFT_UINT16, "cliff_right_signal", 1, &data->cliff_right_signal, "");
89  add_fieldinfo(IFT_BOOL, "home_base_charger_available", 1, &data->home_base_charger_available, "");
90  add_fieldinfo(IFT_BOOL, "internal_charger_available", 1, &data->internal_charger_available, "");
91  add_fieldinfo(IFT_UINT8, "song_number", 1, &data->song_number, "");
92  add_fieldinfo(IFT_BOOL, "song_playing", 1, &data->song_playing, "");
93  add_fieldinfo(IFT_INT16, "velocity", 1, &data->velocity, "");
94  add_fieldinfo(IFT_INT16, "radius", 1, &data->radius, "");
95  add_fieldinfo(IFT_INT16, "velocity_right", 1, &data->velocity_right, "");
96  add_fieldinfo(IFT_INT16, "velocity_left", 1, &data->velocity_left, "");
97  add_fieldinfo(IFT_UINT16, "encoder_counts_left", 1, &data->encoder_counts_left, "");
98  add_fieldinfo(IFT_UINT16, "encoder_counts_right", 1, &data->encoder_counts_right, "");
99  add_fieldinfo(IFT_BOOL, "bumper_left", 1, &data->bumper_left, "");
100  add_fieldinfo(IFT_BOOL, "bumper_front_left", 1, &data->bumper_front_left, "");
101  add_fieldinfo(IFT_BOOL, "bumper_center_left", 1, &data->bumper_center_left, "");
102  add_fieldinfo(IFT_BOOL, "bumper_center_right", 1, &data->bumper_center_right, "");
103  add_fieldinfo(IFT_BOOL, "bumper_front_right", 1, &data->bumper_front_right, "");
104  add_fieldinfo(IFT_BOOL, "bumper_right", 1, &data->bumper_right, "");
105  add_fieldinfo(IFT_UINT16, "light_bump_left", 1, &data->light_bump_left, "");
106  add_fieldinfo(IFT_UINT16, "light_bump_front_left", 1, &data->light_bump_front_left, "");
107  add_fieldinfo(IFT_UINT16, "light_bump_center_left", 1, &data->light_bump_center_left, "");
108  add_fieldinfo(IFT_UINT16, "light_bump_center_right", 1, &data->light_bump_center_right, "");
109  add_fieldinfo(IFT_UINT16, "light_bump_front_right", 1, &data->light_bump_front_right, "");
110  add_fieldinfo(IFT_UINT16, "light_bump_right", 1, &data->light_bump_right, "");
111  add_fieldinfo(IFT_ENUM, "ir_opcode_left", 1, &data->ir_opcode_left);
112  add_fieldinfo(IFT_ENUM, "ir_opcode_right", 1, &data->ir_opcode_right);
113  add_fieldinfo(IFT_INT16, "left_motor_current", 1, &data->left_motor_current, "");
114  add_fieldinfo(IFT_INT16, "right_motor_current", 1, &data->right_motor_current, "");
115  add_fieldinfo(IFT_INT16, "main_brush_current", 1, &data->main_brush_current, "");
116  add_fieldinfo(IFT_INT16, "side_brush_current", 1, &data->side_brush_current, "");
117  add_fieldinfo(IFT_BOOL, "caster_stasis", 1, &data->caster_stasis, "");
118  add_messageinfo("StopMessage");
119  add_messageinfo("DockMessage");
120  add_messageinfo("SetModeMessage");
121  add_messageinfo("DriveStraightMessage");
122  add_messageinfo("DriveMessage");
123  add_messageinfo("SetMotorsMessage");
124  unsigned char tmp_hash[] = {0x60, 0xa1, 0x1e, 0x86, 0x89, 0x2, 0x20, 0x34, 0x89, 0x32, 0xdb, 0x69, 0xee, 0x12, 0x86, 0x43};
125  set_hash(tmp_hash);
126 }
127 
128 /** Destructor */
129 Roomba500Interface::~Roomba500Interface()
130 {
131  free(data_ptr);
132 }
133 /** Convert Mode constant to string.
134  * @param value value to convert to string
135  * @return constant value as string.
136  */
137 const char *
138 Roomba500Interface::tostring_Mode(Mode value) const
139 {
140  switch (value) {
141  case MODE_OFF: return "MODE_OFF";
142  case MODE_PASSIVE: return "MODE_PASSIVE";
143  case MODE_SAFE: return "MODE_SAFE";
144  case MODE_FULL: return "MODE_FULL";
145  default: return "UNKNOWN";
146  }
147 }
148 /** Convert InfraredCharacter constant to string.
149  * @param value value to convert to string
150  * @return constant value as string.
151  */
152 const char *
153 Roomba500Interface::tostring_InfraredCharacter(InfraredCharacter value) const
154 {
155  switch (value) {
156  case IR_NONE: return "IR_NONE";
157  case IR_REMOTE_LEFT: return "IR_REMOTE_LEFT";
158  case IR_REMOTE_FORWARD: return "IR_REMOTE_FORWARD";
159  case IR_REMOTE_RIGHT: return "IR_REMOTE_RIGHT";
160  case IR_REMOTE_SPOT: return "IR_REMOTE_SPOT";
161  case IR_REMOTE_MAX: return "IR_REMOTE_MAX";
162  case IR_REMOTE_SMALL: return "IR_REMOTE_SMALL";
163  case IR_REMOTE_MEDIUM: return "IR_REMOTE_MEDIUM";
164  case IR_REMOTE_LARGE_CLEAN: return "IR_REMOTE_LARGE_CLEAN";
165  case IR_REMOTE_STOP: return "IR_REMOTE_STOP";
166  case IR_REMOTE_POWER: return "IR_REMOTE_POWER";
167  case IR_REMOTE_ARC_LEFT: return "IR_REMOTE_ARC_LEFT";
168  case IR_REMOTE_ARC_RIGHT: return "IR_REMOTE_ARC_RIGHT";
169  case IR_REMOTE_STOP2: return "IR_REMOTE_STOP2";
170  case IR_SCHED_REMOTE_DOWNLOAD: return "IR_SCHED_REMOTE_DOWNLOAD";
171  case IR_SCHED_REMOTE_SEEK_DOCK: return "IR_SCHED_REMOTE_SEEK_DOCK";
172  case IR_DISC_DOCK_RESERVED: return "IR_DISC_DOCK_RESERVED";
173  case IR_DISC_DOCK_RED_BUOY: return "IR_DISC_DOCK_RED_BUOY";
174  case IR_DISC_DOCK_GREEN_BUOY: return "IR_DISC_DOCK_GREEN_BUOY";
175  case IR_DISC_DOCK_FORCE_FIELD: return "IR_DISC_DOCK_FORCE_FIELD";
176  case IR_DISC_DOCK_RED_GREEN_BUOY: return "IR_DISC_DOCK_RED_GREEN_BUOY";
177  case IR_DISC_DOCK_RED_BUOY_FORCE_FIELD: return "IR_DISC_DOCK_RED_BUOY_FORCE_FIELD";
178  case IR_DISC_DOCK_GREEN_BUOY_FORCE_FIELD: return "IR_DISC_DOCK_GREEN_BUOY_FORCE_FIELD";
179  case IR_DISC_DOCK_RED_GREEN_BUOY_FORCE_FIELD: return "IR_DISC_DOCK_RED_GREEN_BUOY_FORCE_FIELD";
180  case IR_DOCK_RESERVED: return "IR_DOCK_RESERVED";
181  case IR_DOCK_RED_BUOY: return "IR_DOCK_RED_BUOY";
182  case IR_DOCK_GREEN_BUOY: return "IR_DOCK_GREEN_BUOY";
183  case IR_DOCK_FORCE_FIELD: return "IR_DOCK_FORCE_FIELD";
184  case IR_DOCK_RED_GREEN_BUOY: return "IR_DOCK_RED_GREEN_BUOY";
185  case IR_DOCK_RED_BUOY_FORCE_FIELD: return "IR_DOCK_RED_BUOY_FORCE_FIELD";
186  case IR_DOCK_GREEN_BUOY_FORCE_FIELD: return "IR_DOCK_GREEN_BUOY_FORCE_FIELD";
187  case IR_DOCK_RED_GREEN_BUOY_FORCE_FIELD: return "IR_DOCK_RED_GREEN_BUOY_FORCE_FIELD";
188  case IR_VIRTUAL_WALL: return "IR_VIRTUAL_WALL";
189  default: return "UNKNOWN";
190  }
191 }
192 /** Convert ChargingState constant to string.
193  * @param value value to convert to string
194  * @return constant value as string.
195  */
196 const char *
197 Roomba500Interface::tostring_ChargingState(ChargingState value) const
198 {
199  switch (value) {
200  case CHARGING_NO: return "CHARGING_NO";
201  case CHARGING_RECONDITIONING: return "CHARGING_RECONDITIONING";
202  case CHARGING_FULL: return "CHARGING_FULL";
203  case CHARGING_TRICKLE: return "CHARGING_TRICKLE";
204  case CHARGING_WAITING: return "CHARGING_WAITING";
205  case CHARGING_ERROR: return "CHARGING_ERROR";
206  default: return "UNKNOWN";
207  }
208 }
209 /** Convert BrushState constant to string.
210  * @param value value to convert to string
211  * @return constant value as string.
212  */
213 const char *
214 Roomba500Interface::tostring_BrushState(BrushState value) const
215 {
216  switch (value) {
217  case BRUSHSTATE_OFF: return "BRUSHSTATE_OFF";
218  case BRUSHSTATE_FORWARD: return "BRUSHSTATE_FORWARD";
219  case BRUSHSTATE_BACKWARD: return "BRUSHSTATE_BACKWARD";
220  default: return "UNKNOWN";
221  }
222 }
223 /* Methods */
224 /** Get mode value.
225  * Open Interface mode.
226  * @return mode value
227  */
229 Roomba500Interface::mode() const
230 {
231  return (Roomba500Interface::Mode)data->mode;
232 }
233 
234 /** Get maximum length of mode value.
235  * @return length of mode value, can be length of the array or number of
236  * maximum number of characters for a string
237  */
238 size_t
239 Roomba500Interface::maxlenof_mode() const
240 {
241  return 1;
242 }
243 
244 /** Set mode value.
245  * Open Interface mode.
246  * @param new_mode new mode value
247  */
248 void
249 Roomba500Interface::set_mode(const Mode new_mode)
250 {
251  data->mode = new_mode;
252  data_changed = true;
253 }
254 
255 /** Get wheel_drop_left value.
256  * Left wheel drop sensor.
257  * @return wheel_drop_left value
258  */
259 bool
260 Roomba500Interface::is_wheel_drop_left() const
261 {
262  return data->wheel_drop_left;
263 }
264 
265 /** Get maximum length of wheel_drop_left value.
266  * @return length of wheel_drop_left value, can be length of the array or number of
267  * maximum number of characters for a string
268  */
269 size_t
270 Roomba500Interface::maxlenof_wheel_drop_left() const
271 {
272  return 1;
273 }
274 
275 /** Set wheel_drop_left value.
276  * Left wheel drop sensor.
277  * @param new_wheel_drop_left new wheel_drop_left value
278  */
279 void
280 Roomba500Interface::set_wheel_drop_left(const bool new_wheel_drop_left)
281 {
282  data->wheel_drop_left = new_wheel_drop_left;
283  data_changed = true;
284 }
285 
286 /** Get wheel_drop_right value.
287  * Right wheel drop sensor.
288  * @return wheel_drop_right value
289  */
290 bool
291 Roomba500Interface::is_wheel_drop_right() const
292 {
293  return data->wheel_drop_right;
294 }
295 
296 /** Get maximum length of wheel_drop_right value.
297  * @return length of wheel_drop_right value, can be length of the array or number of
298  * maximum number of characters for a string
299  */
300 size_t
301 Roomba500Interface::maxlenof_wheel_drop_right() const
302 {
303  return 1;
304 }
305 
306 /** Set wheel_drop_right value.
307  * Right wheel drop sensor.
308  * @param new_wheel_drop_right new wheel_drop_right value
309  */
310 void
311 Roomba500Interface::set_wheel_drop_right(const bool new_wheel_drop_right)
312 {
313  data->wheel_drop_right = new_wheel_drop_right;
314  data_changed = true;
315 }
316 
317 /** Get bump_left value.
318  * Bump on left.
319  * @return bump_left value
320  */
321 bool
322 Roomba500Interface::is_bump_left() const
323 {
324  return data->bump_left;
325 }
326 
327 /** Get maximum length of bump_left value.
328  * @return length of bump_left value, can be length of the array or number of
329  * maximum number of characters for a string
330  */
331 size_t
332 Roomba500Interface::maxlenof_bump_left() const
333 {
334  return 1;
335 }
336 
337 /** Set bump_left value.
338  * Bump on left.
339  * @param new_bump_left new bump_left value
340  */
341 void
342 Roomba500Interface::set_bump_left(const bool new_bump_left)
343 {
344  data->bump_left = new_bump_left;
345  data_changed = true;
346 }
347 
348 /** Get bump_right value.
349  * Bump on right.
350  * @return bump_right value
351  */
352 bool
353 Roomba500Interface::is_bump_right() const
354 {
355  return data->bump_right;
356 }
357 
358 /** Get maximum length of bump_right value.
359  * @return length of bump_right value, can be length of the array or number of
360  * maximum number of characters for a string
361  */
362 size_t
363 Roomba500Interface::maxlenof_bump_right() const
364 {
365  return 1;
366 }
367 
368 /** Set bump_right value.
369  * Bump on right.
370  * @param new_bump_right new bump_right value
371  */
372 void
373 Roomba500Interface::set_bump_right(const bool new_bump_right)
374 {
375  data->bump_right = new_bump_right;
376  data_changed = true;
377 }
378 
379 /** Get wall value.
380  * Wall sensor.
381  * @return wall value
382  */
383 bool
384 Roomba500Interface::is_wall() const
385 {
386  return data->wall;
387 }
388 
389 /** Get maximum length of wall value.
390  * @return length of wall value, can be length of the array or number of
391  * maximum number of characters for a string
392  */
393 size_t
394 Roomba500Interface::maxlenof_wall() const
395 {
396  return 1;
397 }
398 
399 /** Set wall value.
400  * Wall sensor.
401  * @param new_wall new wall value
402  */
403 void
404 Roomba500Interface::set_wall(const bool new_wall)
405 {
406  data->wall = new_wall;
407  data_changed = true;
408 }
409 
410 /** Get cliff_left value.
411  * Cliff detected left.
412  * @return cliff_left value
413  */
414 bool
415 Roomba500Interface::is_cliff_left() const
416 {
417  return data->cliff_left;
418 }
419 
420 /** Get maximum length of cliff_left value.
421  * @return length of cliff_left value, can be length of the array or number of
422  * maximum number of characters for a string
423  */
424 size_t
425 Roomba500Interface::maxlenof_cliff_left() const
426 {
427  return 1;
428 }
429 
430 /** Set cliff_left value.
431  * Cliff detected left.
432  * @param new_cliff_left new cliff_left value
433  */
434 void
435 Roomba500Interface::set_cliff_left(const bool new_cliff_left)
436 {
437  data->cliff_left = new_cliff_left;
438  data_changed = true;
439 }
440 
441 /** Get cliff_front_left value.
442  * Cliff detected front left.
443  * @return cliff_front_left value
444  */
445 bool
446 Roomba500Interface::is_cliff_front_left() const
447 {
448  return data->cliff_front_left;
449 }
450 
451 /** Get maximum length of cliff_front_left value.
452  * @return length of cliff_front_left value, can be length of the array or number of
453  * maximum number of characters for a string
454  */
455 size_t
456 Roomba500Interface::maxlenof_cliff_front_left() const
457 {
458  return 1;
459 }
460 
461 /** Set cliff_front_left value.
462  * Cliff detected front left.
463  * @param new_cliff_front_left new cliff_front_left value
464  */
465 void
466 Roomba500Interface::set_cliff_front_left(const bool new_cliff_front_left)
467 {
468  data->cliff_front_left = new_cliff_front_left;
469  data_changed = true;
470 }
471 
472 /** Get cliff_front_right value.
473  * Cliff detected front right.
474  * @return cliff_front_right value
475  */
476 bool
477 Roomba500Interface::is_cliff_front_right() const
478 {
479  return data->cliff_front_right;
480 }
481 
482 /** Get maximum length of cliff_front_right value.
483  * @return length of cliff_front_right value, can be length of the array or number of
484  * maximum number of characters for a string
485  */
486 size_t
487 Roomba500Interface::maxlenof_cliff_front_right() const
488 {
489  return 1;
490 }
491 
492 /** Set cliff_front_right value.
493  * Cliff detected front right.
494  * @param new_cliff_front_right new cliff_front_right value
495  */
496 void
497 Roomba500Interface::set_cliff_front_right(const bool new_cliff_front_right)
498 {
499  data->cliff_front_right = new_cliff_front_right;
500  data_changed = true;
501 }
502 
503 /** Get cliff_right value.
504  * Cliff detected right.
505  * @return cliff_right value
506  */
507 bool
508 Roomba500Interface::is_cliff_right() const
509 {
510  return data->cliff_right;
511 }
512 
513 /** Get maximum length of cliff_right value.
514  * @return length of cliff_right value, can be length of the array or number of
515  * maximum number of characters for a string
516  */
517 size_t
518 Roomba500Interface::maxlenof_cliff_right() const
519 {
520  return 1;
521 }
522 
523 /** Set cliff_right value.
524  * Cliff detected right.
525  * @param new_cliff_right new cliff_right value
526  */
527 void
528 Roomba500Interface::set_cliff_right(const bool new_cliff_right)
529 {
530  data->cliff_right = new_cliff_right;
531  data_changed = true;
532 }
533 
534 /** Get virtual_wall value.
535  * Virtual wall detected.
536  * @return virtual_wall value
537  */
538 bool
539 Roomba500Interface::is_virtual_wall() const
540 {
541  return data->virtual_wall;
542 }
543 
544 /** Get maximum length of virtual_wall value.
545  * @return length of virtual_wall value, can be length of the array or number of
546  * maximum number of characters for a string
547  */
548 size_t
549 Roomba500Interface::maxlenof_virtual_wall() const
550 {
551  return 1;
552 }
553 
554 /** Set virtual_wall value.
555  * Virtual wall detected.
556  * @param new_virtual_wall new virtual_wall value
557  */
558 void
559 Roomba500Interface::set_virtual_wall(const bool new_virtual_wall)
560 {
561  data->virtual_wall = new_virtual_wall;
562  data_changed = true;
563 }
564 
565 /** Get overcurrent_side_brush value.
566  * Overcurrent on side brush.
567  * @return overcurrent_side_brush value
568  */
569 bool
570 Roomba500Interface::is_overcurrent_side_brush() const
571 {
572  return data->overcurrent_side_brush;
573 }
574 
575 /** Get maximum length of overcurrent_side_brush value.
576  * @return length of overcurrent_side_brush value, can be length of the array or number of
577  * maximum number of characters for a string
578  */
579 size_t
580 Roomba500Interface::maxlenof_overcurrent_side_brush() const
581 {
582  return 1;
583 }
584 
585 /** Set overcurrent_side_brush value.
586  * Overcurrent on side brush.
587  * @param new_overcurrent_side_brush new overcurrent_side_brush value
588  */
589 void
590 Roomba500Interface::set_overcurrent_side_brush(const bool new_overcurrent_side_brush)
591 {
592  data->overcurrent_side_brush = new_overcurrent_side_brush;
593  data_changed = true;
594 }
595 
596 /** Get overcurrent_main_brush value.
597  * Overcurrent on main brush.
598  * @return overcurrent_main_brush value
599  */
600 bool
601 Roomba500Interface::is_overcurrent_main_brush() const
602 {
603  return data->overcurrent_main_brush;
604 }
605 
606 /** Get maximum length of overcurrent_main_brush value.
607  * @return length of overcurrent_main_brush value, can be length of the array or number of
608  * maximum number of characters for a string
609  */
610 size_t
611 Roomba500Interface::maxlenof_overcurrent_main_brush() const
612 {
613  return 1;
614 }
615 
616 /** Set overcurrent_main_brush value.
617  * Overcurrent on main brush.
618  * @param new_overcurrent_main_brush new overcurrent_main_brush value
619  */
620 void
621 Roomba500Interface::set_overcurrent_main_brush(const bool new_overcurrent_main_brush)
622 {
623  data->overcurrent_main_brush = new_overcurrent_main_brush;
624  data_changed = true;
625 }
626 
627 /** Get overcurrent_left_wheel value.
628  * Overcurrent on left wheel.
629  * @return overcurrent_left_wheel value
630  */
631 bool
632 Roomba500Interface::is_overcurrent_left_wheel() const
633 {
634  return data->overcurrent_left_wheel;
635 }
636 
637 /** Get maximum length of overcurrent_left_wheel value.
638  * @return length of overcurrent_left_wheel value, can be length of the array or number of
639  * maximum number of characters for a string
640  */
641 size_t
642 Roomba500Interface::maxlenof_overcurrent_left_wheel() const
643 {
644  return 1;
645 }
646 
647 /** Set overcurrent_left_wheel value.
648  * Overcurrent on left wheel.
649  * @param new_overcurrent_left_wheel new overcurrent_left_wheel value
650  */
651 void
652 Roomba500Interface::set_overcurrent_left_wheel(const bool new_overcurrent_left_wheel)
653 {
654  data->overcurrent_left_wheel = new_overcurrent_left_wheel;
655  data_changed = true;
656 }
657 
658 /** Get overcurrent_right_wheel value.
659  * Overcurrent on right wheel.
660  * @return overcurrent_right_wheel value
661  */
662 bool
663 Roomba500Interface::is_overcurrent_right_wheel() const
664 {
665  return data->overcurrent_right_wheel;
666 }
667 
668 /** Get maximum length of overcurrent_right_wheel value.
669  * @return length of overcurrent_right_wheel value, can be length of the array or number of
670  * maximum number of characters for a string
671  */
672 size_t
673 Roomba500Interface::maxlenof_overcurrent_right_wheel() const
674 {
675  return 1;
676 }
677 
678 /** Set overcurrent_right_wheel value.
679  * Overcurrent on right wheel.
680  * @param new_overcurrent_right_wheel new overcurrent_right_wheel value
681  */
682 void
683 Roomba500Interface::set_overcurrent_right_wheel(const bool new_overcurrent_right_wheel)
684 {
685  data->overcurrent_right_wheel = new_overcurrent_right_wheel;
686  data_changed = true;
687 }
688 
689 /** Get dirt_detect value.
690  * Dirt detected?
691  * @return dirt_detect value
692  */
693 bool
694 Roomba500Interface::is_dirt_detect() const
695 {
696  return data->dirt_detect;
697 }
698 
699 /** Get maximum length of dirt_detect value.
700  * @return length of dirt_detect value, can be length of the array or number of
701  * maximum number of characters for a string
702  */
703 size_t
704 Roomba500Interface::maxlenof_dirt_detect() const
705 {
706  return 1;
707 }
708 
709 /** Set dirt_detect value.
710  * Dirt detected?
711  * @param new_dirt_detect new dirt_detect value
712  */
713 void
714 Roomba500Interface::set_dirt_detect(const bool new_dirt_detect)
715 {
716  data->dirt_detect = new_dirt_detect;
717  data_changed = true;
718 }
719 
720 /** Get ir_opcode_omni value.
721  * Omni IR receiver code.
722  * @return ir_opcode_omni value
723  */
725 Roomba500Interface::ir_opcode_omni() const
726 {
727  return (Roomba500Interface::InfraredCharacter)data->ir_opcode_omni;
728 }
729 
730 /** Get maximum length of ir_opcode_omni value.
731  * @return length of ir_opcode_omni value, can be length of the array or number of
732  * maximum number of characters for a string
733  */
734 size_t
735 Roomba500Interface::maxlenof_ir_opcode_omni() const
736 {
737  return 1;
738 }
739 
740 /** Set ir_opcode_omni value.
741  * Omni IR receiver code.
742  * @param new_ir_opcode_omni new ir_opcode_omni value
743  */
744 void
745 Roomba500Interface::set_ir_opcode_omni(const InfraredCharacter new_ir_opcode_omni)
746 {
747  data->ir_opcode_omni = new_ir_opcode_omni;
748  data_changed = true;
749 }
750 
751 /** Get button_clean value.
752  * Clean button pressed.
753  * @return button_clean value
754  */
755 bool
756 Roomba500Interface::is_button_clean() const
757 {
758  return data->button_clean;
759 }
760 
761 /** Get maximum length of button_clean value.
762  * @return length of button_clean value, can be length of the array or number of
763  * maximum number of characters for a string
764  */
765 size_t
766 Roomba500Interface::maxlenof_button_clean() const
767 {
768  return 1;
769 }
770 
771 /** Set button_clean value.
772  * Clean button pressed.
773  * @param new_button_clean new button_clean value
774  */
775 void
776 Roomba500Interface::set_button_clean(const bool new_button_clean)
777 {
778  data->button_clean = new_button_clean;
779  data_changed = true;
780 }
781 
782 /** Get button_spot value.
783  * Spot button pressed.
784  * @return button_spot value
785  */
786 bool
787 Roomba500Interface::is_button_spot() const
788 {
789  return data->button_spot;
790 }
791 
792 /** Get maximum length of button_spot value.
793  * @return length of button_spot value, can be length of the array or number of
794  * maximum number of characters for a string
795  */
796 size_t
797 Roomba500Interface::maxlenof_button_spot() const
798 {
799  return 1;
800 }
801 
802 /** Set button_spot value.
803  * Spot button pressed.
804  * @param new_button_spot new button_spot value
805  */
806 void
807 Roomba500Interface::set_button_spot(const bool new_button_spot)
808 {
809  data->button_spot = new_button_spot;
810  data_changed = true;
811 }
812 
813 /** Get button_dock value.
814  * Dock button pressed.
815  * @return button_dock value
816  */
817 bool
818 Roomba500Interface::is_button_dock() const
819 {
820  return data->button_dock;
821 }
822 
823 /** Get maximum length of button_dock value.
824  * @return length of button_dock value, can be length of the array or number of
825  * maximum number of characters for a string
826  */
827 size_t
828 Roomba500Interface::maxlenof_button_dock() const
829 {
830  return 1;
831 }
832 
833 /** Set button_dock value.
834  * Dock button pressed.
835  * @param new_button_dock new button_dock value
836  */
837 void
838 Roomba500Interface::set_button_dock(const bool new_button_dock)
839 {
840  data->button_dock = new_button_dock;
841  data_changed = true;
842 }
843 
844 /** Get button_minute value.
845  * Minute button pressed.
846  * @return button_minute value
847  */
848 bool
849 Roomba500Interface::is_button_minute() const
850 {
851  return data->button_minute;
852 }
853 
854 /** Get maximum length of button_minute value.
855  * @return length of button_minute value, can be length of the array or number of
856  * maximum number of characters for a string
857  */
858 size_t
859 Roomba500Interface::maxlenof_button_minute() const
860 {
861  return 1;
862 }
863 
864 /** Set button_minute value.
865  * Minute button pressed.
866  * @param new_button_minute new button_minute value
867  */
868 void
869 Roomba500Interface::set_button_minute(const bool new_button_minute)
870 {
871  data->button_minute = new_button_minute;
872  data_changed = true;
873 }
874 
875 /** Get button_hour value.
876  * Hour button pressed.
877  * @return button_hour value
878  */
879 bool
880 Roomba500Interface::is_button_hour() const
881 {
882  return data->button_hour;
883 }
884 
885 /** Get maximum length of button_hour value.
886  * @return length of button_hour value, can be length of the array or number of
887  * maximum number of characters for a string
888  */
889 size_t
890 Roomba500Interface::maxlenof_button_hour() const
891 {
892  return 1;
893 }
894 
895 /** Set button_hour value.
896  * Hour button pressed.
897  * @param new_button_hour new button_hour value
898  */
899 void
900 Roomba500Interface::set_button_hour(const bool new_button_hour)
901 {
902  data->button_hour = new_button_hour;
903  data_changed = true;
904 }
905 
906 /** Get button_day value.
907  * Day button pressed.
908  * @return button_day value
909  */
910 bool
911 Roomba500Interface::is_button_day() const
912 {
913  return data->button_day;
914 }
915 
916 /** Get maximum length of button_day value.
917  * @return length of button_day value, can be length of the array or number of
918  * maximum number of characters for a string
919  */
920 size_t
921 Roomba500Interface::maxlenof_button_day() const
922 {
923  return 1;
924 }
925 
926 /** Set button_day value.
927  * Day button pressed.
928  * @param new_button_day new button_day value
929  */
930 void
931 Roomba500Interface::set_button_day(const bool new_button_day)
932 {
933  data->button_day = new_button_day;
934  data_changed = true;
935 }
936 
937 /** Get button_schedule value.
938  * Schedule button pressed.
939  * @return button_schedule value
940  */
941 bool
942 Roomba500Interface::is_button_schedule() const
943 {
944  return data->button_schedule;
945 }
946 
947 /** Get maximum length of button_schedule value.
948  * @return length of button_schedule value, can be length of the array or number of
949  * maximum number of characters for a string
950  */
951 size_t
952 Roomba500Interface::maxlenof_button_schedule() const
953 {
954  return 1;
955 }
956 
957 /** Set button_schedule value.
958  * Schedule button pressed.
959  * @param new_button_schedule new button_schedule value
960  */
961 void
962 Roomba500Interface::set_button_schedule(const bool new_button_schedule)
963 {
964  data->button_schedule = new_button_schedule;
965  data_changed = true;
966 }
967 
968 /** Get button_clock value.
969  * Clock button pressed.
970  * @return button_clock value
971  */
972 bool
973 Roomba500Interface::is_button_clock() const
974 {
975  return data->button_clock;
976 }
977 
978 /** Get maximum length of button_clock value.
979  * @return length of button_clock value, can be length of the array or number of
980  * maximum number of characters for a string
981  */
982 size_t
983 Roomba500Interface::maxlenof_button_clock() const
984 {
985  return 1;
986 }
987 
988 /** Set button_clock value.
989  * Clock button pressed.
990  * @param new_button_clock new button_clock value
991  */
992 void
993 Roomba500Interface::set_button_clock(const bool new_button_clock)
994 {
995  data->button_clock = new_button_clock;
996  data_changed = true;
997 }
998 
999 /** Get distance value.
1000  * Travelled distance in m.
1001  * @return distance value
1002  */
1003 int16_t
1004 Roomba500Interface::distance() const
1005 {
1006  return data->distance;
1007 }
1008 
1009 /** Get maximum length of distance value.
1010  * @return length of distance value, can be length of the array or number of
1011  * maximum number of characters for a string
1012  */
1013 size_t
1014 Roomba500Interface::maxlenof_distance() const
1015 {
1016  return 1;
1017 }
1018 
1019 /** Set distance value.
1020  * Travelled distance in m.
1021  * @param new_distance new distance value
1022  */
1023 void
1024 Roomba500Interface::set_distance(const int16_t new_distance)
1025 {
1026  data->distance = new_distance;
1027  data_changed = true;
1028 }
1029 
1030 /** Get angle value.
1031  * Turned angle in radians.
1032  * @return angle value
1033  */
1034 int16_t
1035 Roomba500Interface::angle() const
1036 {
1037  return data->angle;
1038 }
1039 
1040 /** Get maximum length of angle value.
1041  * @return length of angle value, can be length of the array or number of
1042  * maximum number of characters for a string
1043  */
1044 size_t
1045 Roomba500Interface::maxlenof_angle() const
1046 {
1047  return 1;
1048 }
1049 
1050 /** Set angle value.
1051  * Turned angle in radians.
1052  * @param new_angle new angle value
1053  */
1054 void
1055 Roomba500Interface::set_angle(const int16_t new_angle)
1056 {
1057  data->angle = new_angle;
1058  data_changed = true;
1059 }
1060 
1061 /** Get charging_state value.
1062  * Charging state.
1063  * @return charging_state value
1064  */
1066 Roomba500Interface::charging_state() const
1067 {
1068  return (Roomba500Interface::ChargingState)data->charging_state;
1069 }
1070 
1071 /** Get maximum length of charging_state value.
1072  * @return length of charging_state value, can be length of the array or number of
1073  * maximum number of characters for a string
1074  */
1075 size_t
1076 Roomba500Interface::maxlenof_charging_state() const
1077 {
1078  return 1;
1079 }
1080 
1081 /** Set charging_state value.
1082  * Charging state.
1083  * @param new_charging_state new charging_state value
1084  */
1085 void
1086 Roomba500Interface::set_charging_state(const ChargingState new_charging_state)
1087 {
1088  data->charging_state = new_charging_state;
1089  data_changed = true;
1090 }
1091 
1092 /** Get voltage value.
1093  * Voltage in mV.
1094  * @return voltage value
1095  */
1096 uint16_t
1097 Roomba500Interface::voltage() const
1098 {
1099  return data->voltage;
1100 }
1101 
1102 /** Get maximum length of voltage value.
1103  * @return length of voltage value, can be length of the array or number of
1104  * maximum number of characters for a string
1105  */
1106 size_t
1107 Roomba500Interface::maxlenof_voltage() const
1108 {
1109  return 1;
1110 }
1111 
1112 /** Set voltage value.
1113  * Voltage in mV.
1114  * @param new_voltage new voltage value
1115  */
1116 void
1117 Roomba500Interface::set_voltage(const uint16_t new_voltage)
1118 {
1119  data->voltage = new_voltage;
1120  data_changed = true;
1121 }
1122 
1123 /** Get current value.
1124  * Current in mA.
1125  * @return current value
1126  */
1127 int16_t
1128 Roomba500Interface::current() const
1129 {
1130  return data->current;
1131 }
1132 
1133 /** Get maximum length of current value.
1134  * @return length of current value, can be length of the array or number of
1135  * maximum number of characters for a string
1136  */
1137 size_t
1138 Roomba500Interface::maxlenof_current() const
1139 {
1140  return 1;
1141 }
1142 
1143 /** Set current value.
1144  * Current in mA.
1145  * @param new_current new current value
1146  */
1147 void
1148 Roomba500Interface::set_current(const int16_t new_current)
1149 {
1150  data->current = new_current;
1151  data_changed = true;
1152 }
1153 
1154 /** Get temperature value.
1155  * Temperature in degree Celsius.
1156  * @return temperature value
1157  */
1158 int8_t
1159 Roomba500Interface::temperature() const
1160 {
1161  return data->temperature;
1162 }
1163 
1164 /** Get maximum length of temperature value.
1165  * @return length of temperature value, can be length of the array or number of
1166  * maximum number of characters for a string
1167  */
1168 size_t
1169 Roomba500Interface::maxlenof_temperature() const
1170 {
1171  return 1;
1172 }
1173 
1174 /** Set temperature value.
1175  * Temperature in degree Celsius.
1176  * @param new_temperature new temperature value
1177  */
1178 void
1179 Roomba500Interface::set_temperature(const int8_t new_temperature)
1180 {
1181  data->temperature = new_temperature;
1182  data_changed = true;
1183 }
1184 
1185 /** Get battery_charge value.
1186  * Battery charge in mAh.
1187  * @return battery_charge value
1188  */
1189 uint16_t
1190 Roomba500Interface::battery_charge() const
1191 {
1192  return data->battery_charge;
1193 }
1194 
1195 /** Get maximum length of battery_charge value.
1196  * @return length of battery_charge value, can be length of the array or number of
1197  * maximum number of characters for a string
1198  */
1199 size_t
1200 Roomba500Interface::maxlenof_battery_charge() const
1201 {
1202  return 1;
1203 }
1204 
1205 /** Set battery_charge value.
1206  * Battery charge in mAh.
1207  * @param new_battery_charge new battery_charge value
1208  */
1209 void
1210 Roomba500Interface::set_battery_charge(const uint16_t new_battery_charge)
1211 {
1212  data->battery_charge = new_battery_charge;
1213  data_changed = true;
1214 }
1215 
1216 /** Get battery_capacity value.
1217  * Battery capacity in mAh.
1218  * @return battery_capacity value
1219  */
1220 uint16_t
1221 Roomba500Interface::battery_capacity() const
1222 {
1223  return data->battery_capacity;
1224 }
1225 
1226 /** Get maximum length of battery_capacity value.
1227  * @return length of battery_capacity value, can be length of the array or number of
1228  * maximum number of characters for a string
1229  */
1230 size_t
1231 Roomba500Interface::maxlenof_battery_capacity() const
1232 {
1233  return 1;
1234 }
1235 
1236 /** Set battery_capacity value.
1237  * Battery capacity in mAh.
1238  * @param new_battery_capacity new battery_capacity value
1239  */
1240 void
1241 Roomba500Interface::set_battery_capacity(const uint16_t new_battery_capacity)
1242 {
1243  data->battery_capacity = new_battery_capacity;
1244  data_changed = true;
1245 }
1246 
1247 /** Get wall_signal value.
1248  * Raw wall signal
1249  * @return wall_signal value
1250  */
1251 uint16_t
1252 Roomba500Interface::wall_signal() const
1253 {
1254  return data->wall_signal;
1255 }
1256 
1257 /** Get maximum length of wall_signal value.
1258  * @return length of wall_signal value, can be length of the array or number of
1259  * maximum number of characters for a string
1260  */
1261 size_t
1262 Roomba500Interface::maxlenof_wall_signal() const
1263 {
1264  return 1;
1265 }
1266 
1267 /** Set wall_signal value.
1268  * Raw wall signal
1269  * @param new_wall_signal new wall_signal value
1270  */
1271 void
1272 Roomba500Interface::set_wall_signal(const uint16_t new_wall_signal)
1273 {
1274  data->wall_signal = new_wall_signal;
1275  data_changed = true;
1276 }
1277 
1278 /** Get cliff_left_signal value.
1279  * Raw left cliff signal.
1280  * @return cliff_left_signal value
1281  */
1282 uint16_t
1283 Roomba500Interface::cliff_left_signal() const
1284 {
1285  return data->cliff_left_signal;
1286 }
1287 
1288 /** Get maximum length of cliff_left_signal value.
1289  * @return length of cliff_left_signal value, can be length of the array or number of
1290  * maximum number of characters for a string
1291  */
1292 size_t
1293 Roomba500Interface::maxlenof_cliff_left_signal() const
1294 {
1295  return 1;
1296 }
1297 
1298 /** Set cliff_left_signal value.
1299  * Raw left cliff signal.
1300  * @param new_cliff_left_signal new cliff_left_signal value
1301  */
1302 void
1303 Roomba500Interface::set_cliff_left_signal(const uint16_t new_cliff_left_signal)
1304 {
1305  data->cliff_left_signal = new_cliff_left_signal;
1306  data_changed = true;
1307 }
1308 
1309 /** Get cliff_front_left_signal value.
1310  * Raw front left
1311  cliff signal.
1312  * @return cliff_front_left_signal value
1313  */
1314 uint16_t
1315 Roomba500Interface::cliff_front_left_signal() const
1316 {
1317  return data->cliff_front_left_signal;
1318 }
1319 
1320 /** Get maximum length of cliff_front_left_signal value.
1321  * @return length of cliff_front_left_signal value, can be length of the array or number of
1322  * maximum number of characters for a string
1323  */
1324 size_t
1325 Roomba500Interface::maxlenof_cliff_front_left_signal() const
1326 {
1327  return 1;
1328 }
1329 
1330 /** Set cliff_front_left_signal value.
1331  * Raw front left
1332  cliff signal.
1333  * @param new_cliff_front_left_signal new cliff_front_left_signal value
1334  */
1335 void
1336 Roomba500Interface::set_cliff_front_left_signal(const uint16_t new_cliff_front_left_signal)
1337 {
1338  data->cliff_front_left_signal = new_cliff_front_left_signal;
1339  data_changed = true;
1340 }
1341 
1342 /** Get cliff_front_right_signal value.
1343  * Raw front right
1344  cliff signal.
1345  * @return cliff_front_right_signal value
1346  */
1347 uint16_t
1348 Roomba500Interface::cliff_front_right_signal() const
1349 {
1350  return data->cliff_front_right_signal;
1351 }
1352 
1353 /** Get maximum length of cliff_front_right_signal value.
1354  * @return length of cliff_front_right_signal value, can be length of the array or number of
1355  * maximum number of characters for a string
1356  */
1357 size_t
1358 Roomba500Interface::maxlenof_cliff_front_right_signal() const
1359 {
1360  return 1;
1361 }
1362 
1363 /** Set cliff_front_right_signal value.
1364  * Raw front right
1365  cliff signal.
1366  * @param new_cliff_front_right_signal new cliff_front_right_signal value
1367  */
1368 void
1369 Roomba500Interface::set_cliff_front_right_signal(const uint16_t new_cliff_front_right_signal)
1370 {
1371  data->cliff_front_right_signal = new_cliff_front_right_signal;
1372  data_changed = true;
1373 }
1374 
1375 /** Get cliff_right_signal value.
1376  * Raw right cliff signal.
1377  * @return cliff_right_signal value
1378  */
1379 uint16_t
1380 Roomba500Interface::cliff_right_signal() const
1381 {
1382  return data->cliff_right_signal;
1383 }
1384 
1385 /** Get maximum length of cliff_right_signal value.
1386  * @return length of cliff_right_signal value, can be length of the array or number of
1387  * maximum number of characters for a string
1388  */
1389 size_t
1390 Roomba500Interface::maxlenof_cliff_right_signal() const
1391 {
1392  return 1;
1393 }
1394 
1395 /** Set cliff_right_signal value.
1396  * Raw right cliff signal.
1397  * @param new_cliff_right_signal new cliff_right_signal value
1398  */
1399 void
1400 Roomba500Interface::set_cliff_right_signal(const uint16_t new_cliff_right_signal)
1401 {
1402  data->cliff_right_signal = new_cliff_right_signal;
1403  data_changed = true;
1404 }
1405 
1406 /** Get home_base_charger_available value.
1407  *
1408  Home base charger available?
1409  * @return home_base_charger_available value
1410  */
1411 bool
1412 Roomba500Interface::is_home_base_charger_available() const
1413 {
1414  return data->home_base_charger_available;
1415 }
1416 
1417 /** Get maximum length of home_base_charger_available value.
1418  * @return length of home_base_charger_available value, can be length of the array or number of
1419  * maximum number of characters for a string
1420  */
1421 size_t
1422 Roomba500Interface::maxlenof_home_base_charger_available() const
1423 {
1424  return 1;
1425 }
1426 
1427 /** Set home_base_charger_available value.
1428  *
1429  Home base charger available?
1430  * @param new_home_base_charger_available new home_base_charger_available value
1431  */
1432 void
1433 Roomba500Interface::set_home_base_charger_available(const bool new_home_base_charger_available)
1434 {
1435  data->home_base_charger_available = new_home_base_charger_available;
1436  data_changed = true;
1437 }
1438 
1439 /** Get internal_charger_available value.
1440  *
1441  Internal charger available?
1442  * @return internal_charger_available value
1443  */
1444 bool
1445 Roomba500Interface::is_internal_charger_available() const
1446 {
1447  return data->internal_charger_available;
1448 }
1449 
1450 /** Get maximum length of internal_charger_available value.
1451  * @return length of internal_charger_available value, can be length of the array or number of
1452  * maximum number of characters for a string
1453  */
1454 size_t
1455 Roomba500Interface::maxlenof_internal_charger_available() const
1456 {
1457  return 1;
1458 }
1459 
1460 /** Set internal_charger_available value.
1461  *
1462  Internal charger available?
1463  * @param new_internal_charger_available new internal_charger_available value
1464  */
1465 void
1466 Roomba500Interface::set_internal_charger_available(const bool new_internal_charger_available)
1467 {
1468  data->internal_charger_available = new_internal_charger_available;
1469  data_changed = true;
1470 }
1471 
1472 /** Get song_number value.
1473  * Song number.
1474  * @return song_number value
1475  */
1476 uint8_t
1477 Roomba500Interface::song_number() const
1478 {
1479  return data->song_number;
1480 }
1481 
1482 /** Get maximum length of song_number value.
1483  * @return length of song_number value, can be length of the array or number of
1484  * maximum number of characters for a string
1485  */
1486 size_t
1487 Roomba500Interface::maxlenof_song_number() const
1488 {
1489  return 1;
1490 }
1491 
1492 /** Set song_number value.
1493  * Song number.
1494  * @param new_song_number new song_number value
1495  */
1496 void
1497 Roomba500Interface::set_song_number(const uint8_t new_song_number)
1498 {
1499  data->song_number = new_song_number;
1500  data_changed = true;
1501 }
1502 
1503 /** Get song_playing value.
1504  * Song playing?
1505  * @return song_playing value
1506  */
1507 bool
1508 Roomba500Interface::is_song_playing() const
1509 {
1510  return data->song_playing;
1511 }
1512 
1513 /** Get maximum length of song_playing value.
1514  * @return length of song_playing value, can be length of the array or number of
1515  * maximum number of characters for a string
1516  */
1517 size_t
1518 Roomba500Interface::maxlenof_song_playing() const
1519 {
1520  return 1;
1521 }
1522 
1523 /** Set song_playing value.
1524  * Song playing?
1525  * @param new_song_playing new song_playing value
1526  */
1527 void
1528 Roomba500Interface::set_song_playing(const bool new_song_playing)
1529 {
1530  data->song_playing = new_song_playing;
1531  data_changed = true;
1532 }
1533 
1534 /** Get velocity value.
1535  * Requested velocity in mm/s.
1536  * @return velocity value
1537  */
1538 int16_t
1539 Roomba500Interface::velocity() const
1540 {
1541  return data->velocity;
1542 }
1543 
1544 /** Get maximum length of velocity value.
1545  * @return length of velocity value, can be length of the array or number of
1546  * maximum number of characters for a string
1547  */
1548 size_t
1549 Roomba500Interface::maxlenof_velocity() const
1550 {
1551  return 1;
1552 }
1553 
1554 /** Set velocity value.
1555  * Requested velocity in mm/s.
1556  * @param new_velocity new velocity value
1557  */
1558 void
1559 Roomba500Interface::set_velocity(const int16_t new_velocity)
1560 {
1561  data->velocity = new_velocity;
1562  data_changed = true;
1563 }
1564 
1565 /** Get radius value.
1566  * Requested radius in mm.
1567  * @return radius value
1568  */
1569 int16_t
1570 Roomba500Interface::radius() const
1571 {
1572  return data->radius;
1573 }
1574 
1575 /** Get maximum length of radius value.
1576  * @return length of radius value, can be length of the array or number of
1577  * maximum number of characters for a string
1578  */
1579 size_t
1580 Roomba500Interface::maxlenof_radius() const
1581 {
1582  return 1;
1583 }
1584 
1585 /** Set radius value.
1586  * Requested radius in mm.
1587  * @param new_radius new radius value
1588  */
1589 void
1590 Roomba500Interface::set_radius(const int16_t new_radius)
1591 {
1592  data->radius = new_radius;
1593  data_changed = true;
1594 }
1595 
1596 /** Get velocity_right value.
1597  * Requested left velocity in mm/s.
1598  * @return velocity_right value
1599  */
1600 int16_t
1601 Roomba500Interface::velocity_right() const
1602 {
1603  return data->velocity_right;
1604 }
1605 
1606 /** Get maximum length of velocity_right value.
1607  * @return length of velocity_right value, can be length of the array or number of
1608  * maximum number of characters for a string
1609  */
1610 size_t
1611 Roomba500Interface::maxlenof_velocity_right() const
1612 {
1613  return 1;
1614 }
1615 
1616 /** Set velocity_right value.
1617  * Requested left velocity in mm/s.
1618  * @param new_velocity_right new velocity_right value
1619  */
1620 void
1621 Roomba500Interface::set_velocity_right(const int16_t new_velocity_right)
1622 {
1623  data->velocity_right = new_velocity_right;
1624  data_changed = true;
1625 }
1626 
1627 /** Get velocity_left value.
1628  * Requested right velocity in mm/s.
1629  * @return velocity_left value
1630  */
1631 int16_t
1632 Roomba500Interface::velocity_left() const
1633 {
1634  return data->velocity_left;
1635 }
1636 
1637 /** Get maximum length of velocity_left value.
1638  * @return length of velocity_left value, can be length of the array or number of
1639  * maximum number of characters for a string
1640  */
1641 size_t
1642 Roomba500Interface::maxlenof_velocity_left() const
1643 {
1644  return 1;
1645 }
1646 
1647 /** Set velocity_left value.
1648  * Requested right velocity in mm/s.
1649  * @param new_velocity_left new velocity_left value
1650  */
1651 void
1652 Roomba500Interface::set_velocity_left(const int16_t new_velocity_left)
1653 {
1654  data->velocity_left = new_velocity_left;
1655  data_changed = true;
1656 }
1657 
1658 /** Get encoder_counts_left value.
1659  * Encoder count left.
1660  * @return encoder_counts_left value
1661  */
1662 uint16_t
1663 Roomba500Interface::encoder_counts_left() const
1664 {
1665  return data->encoder_counts_left;
1666 }
1667 
1668 /** Get maximum length of encoder_counts_left value.
1669  * @return length of encoder_counts_left value, can be length of the array or number of
1670  * maximum number of characters for a string
1671  */
1672 size_t
1673 Roomba500Interface::maxlenof_encoder_counts_left() const
1674 {
1675  return 1;
1676 }
1677 
1678 /** Set encoder_counts_left value.
1679  * Encoder count left.
1680  * @param new_encoder_counts_left new encoder_counts_left value
1681  */
1682 void
1683 Roomba500Interface::set_encoder_counts_left(const uint16_t new_encoder_counts_left)
1684 {
1685  data->encoder_counts_left = new_encoder_counts_left;
1686  data_changed = true;
1687 }
1688 
1689 /** Get encoder_counts_right value.
1690  * Encoder count right.
1691  * @return encoder_counts_right value
1692  */
1693 uint16_t
1694 Roomba500Interface::encoder_counts_right() const
1695 {
1696  return data->encoder_counts_right;
1697 }
1698 
1699 /** Get maximum length of encoder_counts_right value.
1700  * @return length of encoder_counts_right value, can be length of the array or number of
1701  * maximum number of characters for a string
1702  */
1703 size_t
1704 Roomba500Interface::maxlenof_encoder_counts_right() const
1705 {
1706  return 1;
1707 }
1708 
1709 /** Set encoder_counts_right value.
1710  * Encoder count right.
1711  * @param new_encoder_counts_right new encoder_counts_right value
1712  */
1713 void
1714 Roomba500Interface::set_encoder_counts_right(const uint16_t new_encoder_counts_right)
1715 {
1716  data->encoder_counts_right = new_encoder_counts_right;
1717  data_changed = true;
1718 }
1719 
1720 /** Get bumper_left value.
1721  * Left bumper active?
1722  * @return bumper_left value
1723  */
1724 bool
1725 Roomba500Interface::is_bumper_left() const
1726 {
1727  return data->bumper_left;
1728 }
1729 
1730 /** Get maximum length of bumper_left value.
1731  * @return length of bumper_left value, can be length of the array or number of
1732  * maximum number of characters for a string
1733  */
1734 size_t
1735 Roomba500Interface::maxlenof_bumper_left() const
1736 {
1737  return 1;
1738 }
1739 
1740 /** Set bumper_left value.
1741  * Left bumper active?
1742  * @param new_bumper_left new bumper_left value
1743  */
1744 void
1745 Roomba500Interface::set_bumper_left(const bool new_bumper_left)
1746 {
1747  data->bumper_left = new_bumper_left;
1748  data_changed = true;
1749 }
1750 
1751 /** Get bumper_front_left value.
1752  * Front left bumper active?
1753  * @return bumper_front_left value
1754  */
1755 bool
1756 Roomba500Interface::is_bumper_front_left() const
1757 {
1758  return data->bumper_front_left;
1759 }
1760 
1761 /** Get maximum length of bumper_front_left value.
1762  * @return length of bumper_front_left value, can be length of the array or number of
1763  * maximum number of characters for a string
1764  */
1765 size_t
1766 Roomba500Interface::maxlenof_bumper_front_left() const
1767 {
1768  return 1;
1769 }
1770 
1771 /** Set bumper_front_left value.
1772  * Front left bumper active?
1773  * @param new_bumper_front_left new bumper_front_left value
1774  */
1775 void
1776 Roomba500Interface::set_bumper_front_left(const bool new_bumper_front_left)
1777 {
1778  data->bumper_front_left = new_bumper_front_left;
1779  data_changed = true;
1780 }
1781 
1782 /** Get bumper_center_left value.
1783  * Center left bumper active?
1784  * @return bumper_center_left value
1785  */
1786 bool
1787 Roomba500Interface::is_bumper_center_left() const
1788 {
1789  return data->bumper_center_left;
1790 }
1791 
1792 /** Get maximum length of bumper_center_left value.
1793  * @return length of bumper_center_left value, can be length of the array or number of
1794  * maximum number of characters for a string
1795  */
1796 size_t
1797 Roomba500Interface::maxlenof_bumper_center_left() const
1798 {
1799  return 1;
1800 }
1801 
1802 /** Set bumper_center_left value.
1803  * Center left bumper active?
1804  * @param new_bumper_center_left new bumper_center_left value
1805  */
1806 void
1807 Roomba500Interface::set_bumper_center_left(const bool new_bumper_center_left)
1808 {
1809  data->bumper_center_left = new_bumper_center_left;
1810  data_changed = true;
1811 }
1812 
1813 /** Get bumper_center_right value.
1814  * Center right bumper active?
1815  * @return bumper_center_right value
1816  */
1817 bool
1818 Roomba500Interface::is_bumper_center_right() const
1819 {
1820  return data->bumper_center_right;
1821 }
1822 
1823 /** Get maximum length of bumper_center_right value.
1824  * @return length of bumper_center_right value, can be length of the array or number of
1825  * maximum number of characters for a string
1826  */
1827 size_t
1828 Roomba500Interface::maxlenof_bumper_center_right() const
1829 {
1830  return 1;
1831 }
1832 
1833 /** Set bumper_center_right value.
1834  * Center right bumper active?
1835  * @param new_bumper_center_right new bumper_center_right value
1836  */
1837 void
1838 Roomba500Interface::set_bumper_center_right(const bool new_bumper_center_right)
1839 {
1840  data->bumper_center_right = new_bumper_center_right;
1841  data_changed = true;
1842 }
1843 
1844 /** Get bumper_front_right value.
1845  * Front right bumper active?
1846  * @return bumper_front_right value
1847  */
1848 bool
1849 Roomba500Interface::is_bumper_front_right() const
1850 {
1851  return data->bumper_front_right;
1852 }
1853 
1854 /** Get maximum length of bumper_front_right value.
1855  * @return length of bumper_front_right value, can be length of the array or number of
1856  * maximum number of characters for a string
1857  */
1858 size_t
1859 Roomba500Interface::maxlenof_bumper_front_right() const
1860 {
1861  return 1;
1862 }
1863 
1864 /** Set bumper_front_right value.
1865  * Front right bumper active?
1866  * @param new_bumper_front_right new bumper_front_right value
1867  */
1868 void
1869 Roomba500Interface::set_bumper_front_right(const bool new_bumper_front_right)
1870 {
1871  data->bumper_front_right = new_bumper_front_right;
1872  data_changed = true;
1873 }
1874 
1875 /** Get bumper_right value.
1876  * Right bumper active?
1877  * @return bumper_right value
1878  */
1879 bool
1880 Roomba500Interface::is_bumper_right() const
1881 {
1882  return data->bumper_right;
1883 }
1884 
1885 /** Get maximum length of bumper_right value.
1886  * @return length of bumper_right value, can be length of the array or number of
1887  * maximum number of characters for a string
1888  */
1889 size_t
1890 Roomba500Interface::maxlenof_bumper_right() const
1891 {
1892  return 1;
1893 }
1894 
1895 /** Set bumper_right value.
1896  * Right bumper active?
1897  * @param new_bumper_right new bumper_right value
1898  */
1899 void
1900 Roomba500Interface::set_bumper_right(const bool new_bumper_right)
1901 {
1902  data->bumper_right = new_bumper_right;
1903  data_changed = true;
1904 }
1905 
1906 /** Get light_bump_left value.
1907  * Raw left bumper signal.
1908  * @return light_bump_left value
1909  */
1910 uint16_t
1911 Roomba500Interface::light_bump_left() const
1912 {
1913  return data->light_bump_left;
1914 }
1915 
1916 /** Get maximum length of light_bump_left value.
1917  * @return length of light_bump_left value, can be length of the array or number of
1918  * maximum number of characters for a string
1919  */
1920 size_t
1921 Roomba500Interface::maxlenof_light_bump_left() const
1922 {
1923  return 1;
1924 }
1925 
1926 /** Set light_bump_left value.
1927  * Raw left bumper signal.
1928  * @param new_light_bump_left new light_bump_left value
1929  */
1930 void
1931 Roomba500Interface::set_light_bump_left(const uint16_t new_light_bump_left)
1932 {
1933  data->light_bump_left = new_light_bump_left;
1934  data_changed = true;
1935 }
1936 
1937 /** Get light_bump_front_left value.
1938  * Raw front left bumper
1939  signal.
1940  * @return light_bump_front_left value
1941  */
1942 uint16_t
1943 Roomba500Interface::light_bump_front_left() const
1944 {
1945  return data->light_bump_front_left;
1946 }
1947 
1948 /** Get maximum length of light_bump_front_left value.
1949  * @return length of light_bump_front_left value, can be length of the array or number of
1950  * maximum number of characters for a string
1951  */
1952 size_t
1953 Roomba500Interface::maxlenof_light_bump_front_left() const
1954 {
1955  return 1;
1956 }
1957 
1958 /** Set light_bump_front_left value.
1959  * Raw front left bumper
1960  signal.
1961  * @param new_light_bump_front_left new light_bump_front_left value
1962  */
1963 void
1964 Roomba500Interface::set_light_bump_front_left(const uint16_t new_light_bump_front_left)
1965 {
1966  data->light_bump_front_left = new_light_bump_front_left;
1967  data_changed = true;
1968 }
1969 
1970 /** Get light_bump_center_left value.
1971  * Raw center left
1972  bumper signal.
1973  * @return light_bump_center_left value
1974  */
1975 uint16_t
1976 Roomba500Interface::light_bump_center_left() const
1977 {
1978  return data->light_bump_center_left;
1979 }
1980 
1981 /** Get maximum length of light_bump_center_left value.
1982  * @return length of light_bump_center_left value, can be length of the array or number of
1983  * maximum number of characters for a string
1984  */
1985 size_t
1986 Roomba500Interface::maxlenof_light_bump_center_left() const
1987 {
1988  return 1;
1989 }
1990 
1991 /** Set light_bump_center_left value.
1992  * Raw center left
1993  bumper signal.
1994  * @param new_light_bump_center_left new light_bump_center_left value
1995  */
1996 void
1997 Roomba500Interface::set_light_bump_center_left(const uint16_t new_light_bump_center_left)
1998 {
1999  data->light_bump_center_left = new_light_bump_center_left;
2000  data_changed = true;
2001 }
2002 
2003 /** Get light_bump_center_right value.
2004  * Raw center right
2005  bumper signal.
2006  * @return light_bump_center_right value
2007  */
2008 uint16_t
2009 Roomba500Interface::light_bump_center_right() const
2010 {
2011  return data->light_bump_center_right;
2012 }
2013 
2014 /** Get maximum length of light_bump_center_right value.
2015  * @return length of light_bump_center_right value, can be length of the array or number of
2016  * maximum number of characters for a string
2017  */
2018 size_t
2019 Roomba500Interface::maxlenof_light_bump_center_right() const
2020 {
2021  return 1;
2022 }
2023 
2024 /** Set light_bump_center_right value.
2025  * Raw center right
2026  bumper signal.
2027  * @param new_light_bump_center_right new light_bump_center_right value
2028  */
2029 void
2030 Roomba500Interface::set_light_bump_center_right(const uint16_t new_light_bump_center_right)
2031 {
2032  data->light_bump_center_right = new_light_bump_center_right;
2033  data_changed = true;
2034 }
2035 
2036 /** Get light_bump_front_right value.
2037  * Raw front right
2038  bumper signal.
2039  * @return light_bump_front_right value
2040  */
2041 uint16_t
2042 Roomba500Interface::light_bump_front_right() const
2043 {
2044  return data->light_bump_front_right;
2045 }
2046 
2047 /** Get maximum length of light_bump_front_right value.
2048  * @return length of light_bump_front_right value, can be length of the array or number of
2049  * maximum number of characters for a string
2050  */
2051 size_t
2052 Roomba500Interface::maxlenof_light_bump_front_right() const
2053 {
2054  return 1;
2055 }
2056 
2057 /** Set light_bump_front_right value.
2058  * Raw front right
2059  bumper signal.
2060  * @param new_light_bump_front_right new light_bump_front_right value
2061  */
2062 void
2063 Roomba500Interface::set_light_bump_front_right(const uint16_t new_light_bump_front_right)
2064 {
2065  data->light_bump_front_right = new_light_bump_front_right;
2066  data_changed = true;
2067 }
2068 
2069 /** Get light_bump_right value.
2070  * Raw right bumper signal.
2071  * @return light_bump_right value
2072  */
2073 uint16_t
2074 Roomba500Interface::light_bump_right() const
2075 {
2076  return data->light_bump_right;
2077 }
2078 
2079 /** Get maximum length of light_bump_right value.
2080  * @return length of light_bump_right value, can be length of the array or number of
2081  * maximum number of characters for a string
2082  */
2083 size_t
2084 Roomba500Interface::maxlenof_light_bump_right() const
2085 {
2086  return 1;
2087 }
2088 
2089 /** Set light_bump_right value.
2090  * Raw right bumper signal.
2091  * @param new_light_bump_right new light_bump_right value
2092  */
2093 void
2094 Roomba500Interface::set_light_bump_right(const uint16_t new_light_bump_right)
2095 {
2096  data->light_bump_right = new_light_bump_right;
2097  data_changed = true;
2098 }
2099 
2100 /** Get ir_opcode_left value.
2101  *
2102  Left receiver opcode.
2103  * @return ir_opcode_left value
2104  */
2106 Roomba500Interface::ir_opcode_left() const
2107 {
2108  return (Roomba500Interface::InfraredCharacter)data->ir_opcode_left;
2109 }
2110 
2111 /** Get maximum length of ir_opcode_left value.
2112  * @return length of ir_opcode_left value, can be length of the array or number of
2113  * maximum number of characters for a string
2114  */
2115 size_t
2116 Roomba500Interface::maxlenof_ir_opcode_left() const
2117 {
2118  return 1;
2119 }
2120 
2121 /** Set ir_opcode_left value.
2122  *
2123  Left receiver opcode.
2124  * @param new_ir_opcode_left new ir_opcode_left value
2125  */
2126 void
2127 Roomba500Interface::set_ir_opcode_left(const InfraredCharacter new_ir_opcode_left)
2128 {
2129  data->ir_opcode_left = new_ir_opcode_left;
2130  data_changed = true;
2131 }
2132 
2133 /** Get ir_opcode_right value.
2134  *
2135  Right receiver opcode.
2136  * @return ir_opcode_right value
2137  */
2139 Roomba500Interface::ir_opcode_right() const
2140 {
2141  return (Roomba500Interface::InfraredCharacter)data->ir_opcode_right;
2142 }
2143 
2144 /** Get maximum length of ir_opcode_right value.
2145  * @return length of ir_opcode_right value, can be length of the array or number of
2146  * maximum number of characters for a string
2147  */
2148 size_t
2149 Roomba500Interface::maxlenof_ir_opcode_right() const
2150 {
2151  return 1;
2152 }
2153 
2154 /** Set ir_opcode_right value.
2155  *
2156  Right receiver opcode.
2157  * @param new_ir_opcode_right new ir_opcode_right value
2158  */
2159 void
2160 Roomba500Interface::set_ir_opcode_right(const InfraredCharacter new_ir_opcode_right)
2161 {
2162  data->ir_opcode_right = new_ir_opcode_right;
2163  data_changed = true;
2164 }
2165 
2166 /** Get left_motor_current value.
2167  * Left motor current in mA.
2168  * @return left_motor_current value
2169  */
2170 int16_t
2171 Roomba500Interface::left_motor_current() const
2172 {
2173  return data->left_motor_current;
2174 }
2175 
2176 /** Get maximum length of left_motor_current value.
2177  * @return length of left_motor_current value, can be length of the array or number of
2178  * maximum number of characters for a string
2179  */
2180 size_t
2181 Roomba500Interface::maxlenof_left_motor_current() const
2182 {
2183  return 1;
2184 }
2185 
2186 /** Set left_motor_current value.
2187  * Left motor current in mA.
2188  * @param new_left_motor_current new left_motor_current value
2189  */
2190 void
2191 Roomba500Interface::set_left_motor_current(const int16_t new_left_motor_current)
2192 {
2193  data->left_motor_current = new_left_motor_current;
2194  data_changed = true;
2195 }
2196 
2197 /** Get right_motor_current value.
2198  * Right motor current in mA.
2199  * @return right_motor_current value
2200  */
2201 int16_t
2202 Roomba500Interface::right_motor_current() const
2203 {
2204  return data->right_motor_current;
2205 }
2206 
2207 /** Get maximum length of right_motor_current value.
2208  * @return length of right_motor_current value, can be length of the array or number of
2209  * maximum number of characters for a string
2210  */
2211 size_t
2212 Roomba500Interface::maxlenof_right_motor_current() const
2213 {
2214  return 1;
2215 }
2216 
2217 /** Set right_motor_current value.
2218  * Right motor current in mA.
2219  * @param new_right_motor_current new right_motor_current value
2220  */
2221 void
2222 Roomba500Interface::set_right_motor_current(const int16_t new_right_motor_current)
2223 {
2224  data->right_motor_current = new_right_motor_current;
2225  data_changed = true;
2226 }
2227 
2228 /** Get main_brush_current value.
2229  * Main brush current in mA.
2230  * @return main_brush_current value
2231  */
2232 int16_t
2233 Roomba500Interface::main_brush_current() const
2234 {
2235  return data->main_brush_current;
2236 }
2237 
2238 /** Get maximum length of main_brush_current value.
2239  * @return length of main_brush_current value, can be length of the array or number of
2240  * maximum number of characters for a string
2241  */
2242 size_t
2243 Roomba500Interface::maxlenof_main_brush_current() const
2244 {
2245  return 1;
2246 }
2247 
2248 /** Set main_brush_current value.
2249  * Main brush current in mA.
2250  * @param new_main_brush_current new main_brush_current value
2251  */
2252 void
2253 Roomba500Interface::set_main_brush_current(const int16_t new_main_brush_current)
2254 {
2255  data->main_brush_current = new_main_brush_current;
2256  data_changed = true;
2257 }
2258 
2259 /** Get side_brush_current value.
2260  * Side brush current in mA.
2261  * @return side_brush_current value
2262  */
2263 int16_t
2264 Roomba500Interface::side_brush_current() const
2265 {
2266  return data->side_brush_current;
2267 }
2268 
2269 /** Get maximum length of side_brush_current value.
2270  * @return length of side_brush_current value, can be length of the array or number of
2271  * maximum number of characters for a string
2272  */
2273 size_t
2274 Roomba500Interface::maxlenof_side_brush_current() const
2275 {
2276  return 1;
2277 }
2278 
2279 /** Set side_brush_current value.
2280  * Side brush current in mA.
2281  * @param new_side_brush_current new side_brush_current value
2282  */
2283 void
2284 Roomba500Interface::set_side_brush_current(const int16_t new_side_brush_current)
2285 {
2286  data->side_brush_current = new_side_brush_current;
2287  data_changed = true;
2288 }
2289 
2290 /** Get caster_stasis value.
2291  * Caster wheel stasis.
2292  * @return caster_stasis value
2293  */
2294 bool
2295 Roomba500Interface::is_caster_stasis() const
2296 {
2297  return data->caster_stasis;
2298 }
2299 
2300 /** Get maximum length of caster_stasis value.
2301  * @return length of caster_stasis value, can be length of the array or number of
2302  * maximum number of characters for a string
2303  */
2304 size_t
2305 Roomba500Interface::maxlenof_caster_stasis() const
2306 {
2307  return 1;
2308 }
2309 
2310 /** Set caster_stasis value.
2311  * Caster wheel stasis.
2312  * @param new_caster_stasis new caster_stasis value
2313  */
2314 void
2315 Roomba500Interface::set_caster_stasis(const bool new_caster_stasis)
2316 {
2317  data->caster_stasis = new_caster_stasis;
2318  data_changed = true;
2319 }
2320 
2321 /* =========== message create =========== */
2322 Message *
2323 Roomba500Interface::create_message(const char *type) const
2324 {
2325  if ( strncmp("StopMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
2326  return new StopMessage();
2327  } else if ( strncmp("DockMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
2328  return new DockMessage();
2329  } else if ( strncmp("SetModeMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
2330  return new SetModeMessage();
2331  } else if ( strncmp("DriveStraightMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
2332  return new DriveStraightMessage();
2333  } else if ( strncmp("DriveMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
2334  return new DriveMessage();
2335  } else if ( strncmp("SetMotorsMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
2336  return new SetMotorsMessage();
2337  } else {
2338  throw UnknownTypeException("The given type '%s' does not match any known "
2339  "message type for this interface type.", type);
2340  }
2341 }
2342 
2343 
2344 /** Copy values from other interface.
2345  * @param other other interface to copy values from
2346  */
2347 void
2348 Roomba500Interface::copy_values(const Interface *other)
2349 {
2350  const Roomba500Interface *oi = dynamic_cast<const Roomba500Interface *>(other);
2351  if (oi == NULL) {
2352  throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
2353  type(), other->type());
2354  }
2355  memcpy(data, oi->data, sizeof(Roomba500Interface_data_t));
2356 }
2357 
2358 const char *
2359 Roomba500Interface::enum_tostring(const char *enumtype, int val) const
2360 {
2361  if (strcmp(enumtype, "Mode") == 0) {
2362  return tostring_Mode((Mode)val);
2363  }
2364  if (strcmp(enumtype, "InfraredCharacter") == 0) {
2365  return tostring_InfraredCharacter((InfraredCharacter)val);
2366  }
2367  if (strcmp(enumtype, "ChargingState") == 0) {
2368  return tostring_ChargingState((ChargingState)val);
2369  }
2370  if (strcmp(enumtype, "BrushState") == 0) {
2371  return tostring_BrushState((BrushState)val);
2372  }
2373  throw UnknownTypeException("Unknown enum type %s", enumtype);
2374 }
2375 
2376 /* =========== messages =========== */
2377 /** @class Roomba500Interface::StopMessage <interfaces/Roomba500Interface.h>
2378  * StopMessage Fawkes BlackBoard Interface Message.
2379  *
2380 
2381  */
2382 
2383 
2384 /** Constructor */
2385 Roomba500Interface::StopMessage::StopMessage() : Message("StopMessage")
2386 {
2387  data_size = sizeof(StopMessage_data_t);
2388  data_ptr = malloc(data_size);
2389  memset(data_ptr, 0, data_size);
2390  data = (StopMessage_data_t *)data_ptr;
2392 }
2393 
2394 /** Destructor */
2396 {
2397  free(data_ptr);
2398 }
2399 
2400 /** Copy constructor.
2401  * @param m message to copy from
2402  */
2404 {
2405  data_size = m->data_size;
2406  data_ptr = malloc(data_size);
2407  memcpy(data_ptr, m->data_ptr, data_size);
2408  data = (StopMessage_data_t *)data_ptr;
2410 }
2411 
2412 /* Methods */
2413 /** Clone this message.
2414  * Produces a message of the same type as this message and copies the
2415  * data to the new message.
2416  * @return clone of this message
2417  */
2418 Message *
2420 {
2421  return new Roomba500Interface::StopMessage(this);
2422 }
2423 /** @class Roomba500Interface::DockMessage <interfaces/Roomba500Interface.h>
2424  * DockMessage Fawkes BlackBoard Interface Message.
2425  *
2426 
2427  */
2428 
2429 
2430 /** Constructor */
2432 {
2433  data_size = sizeof(DockMessage_data_t);
2434  data_ptr = malloc(data_size);
2435  memset(data_ptr, 0, data_size);
2436  data = (DockMessage_data_t *)data_ptr;
2438 }
2439 
2440 /** Destructor */
2442 {
2443  free(data_ptr);
2444 }
2445 
2446 /** Copy constructor.
2447  * @param m message to copy from
2448  */
2450 {
2451  data_size = m->data_size;
2452  data_ptr = malloc(data_size);
2453  memcpy(data_ptr, m->data_ptr, data_size);
2454  data = (DockMessage_data_t *)data_ptr;
2456 }
2457 
2458 /* Methods */
2459 /** Clone this message.
2460  * Produces a message of the same type as this message and copies the
2461  * data to the new message.
2462  * @return clone of this message
2463  */
2464 Message *
2466 {
2467  return new Roomba500Interface::DockMessage(this);
2468 }
2469 /** @class Roomba500Interface::SetModeMessage <interfaces/Roomba500Interface.h>
2470  * SetModeMessage Fawkes BlackBoard Interface Message.
2471  *
2472 
2473  */
2474 
2475 
2476 /** Constructor with initial values.
2477  * @param ini_mode initial value for mode
2478  */
2480 {
2481  data_size = sizeof(SetModeMessage_data_t);
2482  data_ptr = malloc(data_size);
2483  memset(data_ptr, 0, data_size);
2484  data = (SetModeMessage_data_t *)data_ptr;
2486  data->mode = ini_mode;
2487  add_fieldinfo(IFT_ENUM, "mode", 1, &data->mode);
2488 }
2489 /** Constructor */
2491 {
2492  data_size = sizeof(SetModeMessage_data_t);
2493  data_ptr = malloc(data_size);
2494  memset(data_ptr, 0, data_size);
2495  data = (SetModeMessage_data_t *)data_ptr;
2497  add_fieldinfo(IFT_ENUM, "mode", 1, &data->mode);
2498 }
2499 
2500 /** Destructor */
2502 {
2503  free(data_ptr);
2504 }
2505 
2506 /** Copy constructor.
2507  * @param m message to copy from
2508  */
2510 {
2511  data_size = m->data_size;
2512  data_ptr = malloc(data_size);
2513  memcpy(data_ptr, m->data_ptr, data_size);
2514  data = (SetModeMessage_data_t *)data_ptr;
2516 }
2517 
2518 /* Methods */
2519 /** Get mode value.
2520  * Open Interface mode.
2521  * @return mode value
2522  */
2525 {
2526  return (Roomba500Interface::Mode)data->mode;
2527 }
2528 
2529 /** Get maximum length of mode value.
2530  * @return length of mode value, can be length of the array or number of
2531  * maximum number of characters for a string
2532  */
2533 size_t
2535 {
2536  return 1;
2537 }
2538 
2539 /** Set mode value.
2540  * Open Interface mode.
2541  * @param new_mode new mode value
2542  */
2543 void
2545 {
2546  data->mode = new_mode;
2547 }
2548 
2549 /** Clone this message.
2550  * Produces a message of the same type as this message and copies the
2551  * data to the new message.
2552  * @return clone of this message
2553  */
2554 Message *
2556 {
2557  return new Roomba500Interface::SetModeMessage(this);
2558 }
2559 /** @class Roomba500Interface::DriveStraightMessage <interfaces/Roomba500Interface.h>
2560  * DriveStraightMessage Fawkes BlackBoard Interface Message.
2561  *
2562 
2563  */
2564 
2565 
2566 /** Constructor with initial values.
2567  * @param ini_velocity initial value for velocity
2568  */
2569 Roomba500Interface::DriveStraightMessage::DriveStraightMessage(const int16_t ini_velocity) : Message("DriveStraightMessage")
2570 {
2571  data_size = sizeof(DriveStraightMessage_data_t);
2572  data_ptr = malloc(data_size);
2573  memset(data_ptr, 0, data_size);
2574  data = (DriveStraightMessage_data_t *)data_ptr;
2576  data->velocity = ini_velocity;
2577  add_fieldinfo(IFT_INT16, "velocity", 1, &data->velocity, "");
2578 }
2579 /** Constructor */
2581 {
2582  data_size = sizeof(DriveStraightMessage_data_t);
2583  data_ptr = malloc(data_size);
2584  memset(data_ptr, 0, data_size);
2585  data = (DriveStraightMessage_data_t *)data_ptr;
2587  add_fieldinfo(IFT_INT16, "velocity", 1, &data->velocity, "");
2588 }
2589 
2590 /** Destructor */
2592 {
2593  free(data_ptr);
2594 }
2595 
2596 /** Copy constructor.
2597  * @param m message to copy from
2598  */
2600 {
2601  data_size = m->data_size;
2602  data_ptr = malloc(data_size);
2603  memcpy(data_ptr, m->data_ptr, data_size);
2604  data = (DriveStraightMessage_data_t *)data_ptr;
2606 }
2607 
2608 /* Methods */
2609 /** Get velocity value.
2610  * Requested velocity in mm/s.
2611  * @return velocity value
2612  */
2613 int16_t
2615 {
2616  return data->velocity;
2617 }
2618 
2619 /** Get maximum length of velocity value.
2620  * @return length of velocity value, can be length of the array or number of
2621  * maximum number of characters for a string
2622  */
2623 size_t
2625 {
2626  return 1;
2627 }
2628 
2629 /** Set velocity value.
2630  * Requested velocity in mm/s.
2631  * @param new_velocity new velocity value
2632  */
2633 void
2635 {
2636  data->velocity = new_velocity;
2637 }
2638 
2639 /** Clone this message.
2640  * Produces a message of the same type as this message and copies the
2641  * data to the new message.
2642  * @return clone of this message
2643  */
2644 Message *
2646 {
2648 }
2649 /** @class Roomba500Interface::DriveMessage <interfaces/Roomba500Interface.h>
2650  * DriveMessage Fawkes BlackBoard Interface Message.
2651  *
2652 
2653  */
2654 
2655 
2656 /** Constructor with initial values.
2657  * @param ini_velocity initial value for velocity
2658  * @param ini_radius initial value for radius
2659  */
2660 Roomba500Interface::DriveMessage::DriveMessage(const int16_t ini_velocity, const int16_t ini_radius) : Message("DriveMessage")
2661 {
2662  data_size = sizeof(DriveMessage_data_t);
2663  data_ptr = malloc(data_size);
2664  memset(data_ptr, 0, data_size);
2665  data = (DriveMessage_data_t *)data_ptr;
2667  data->velocity = ini_velocity;
2668  data->radius = ini_radius;
2669  add_fieldinfo(IFT_INT16, "velocity", 1, &data->velocity, "");
2670  add_fieldinfo(IFT_INT16, "radius", 1, &data->radius, "");
2671 }
2672 /** Constructor */
2674 {
2675  data_size = sizeof(DriveMessage_data_t);
2676  data_ptr = malloc(data_size);
2677  memset(data_ptr, 0, data_size);
2678  data = (DriveMessage_data_t *)data_ptr;
2680  add_fieldinfo(IFT_INT16, "velocity", 1, &data->velocity, "");
2681  add_fieldinfo(IFT_INT16, "radius", 1, &data->radius, "");
2682 }
2683 
2684 /** Destructor */
2686 {
2687  free(data_ptr);
2688 }
2689 
2690 /** Copy constructor.
2691  * @param m message to copy from
2692  */
2694 {
2695  data_size = m->data_size;
2696  data_ptr = malloc(data_size);
2697  memcpy(data_ptr, m->data_ptr, data_size);
2698  data = (DriveMessage_data_t *)data_ptr;
2700 }
2701 
2702 /* Methods */
2703 /** Get velocity value.
2704  * Requested velocity in mm/s.
2705  * @return velocity value
2706  */
2707 int16_t
2709 {
2710  return data->velocity;
2711 }
2712 
2713 /** Get maximum length of velocity value.
2714  * @return length of velocity value, can be length of the array or number of
2715  * maximum number of characters for a string
2716  */
2717 size_t
2719 {
2720  return 1;
2721 }
2722 
2723 /** Set velocity value.
2724  * Requested velocity in mm/s.
2725  * @param new_velocity new velocity value
2726  */
2727 void
2729 {
2730  data->velocity = new_velocity;
2731 }
2732 
2733 /** Get radius value.
2734  * Requested radius in mm.
2735  * @return radius value
2736  */
2737 int16_t
2739 {
2740  return data->radius;
2741 }
2742 
2743 /** Get maximum length of radius value.
2744  * @return length of radius value, can be length of the array or number of
2745  * maximum number of characters for a string
2746  */
2747 size_t
2749 {
2750  return 1;
2751 }
2752 
2753 /** Set radius value.
2754  * Requested radius in mm.
2755  * @param new_radius new radius value
2756  */
2757 void
2759 {
2760  data->radius = new_radius;
2761 }
2762 
2763 /** Clone this message.
2764  * Produces a message of the same type as this message and copies the
2765  * data to the new message.
2766  * @return clone of this message
2767  */
2768 Message *
2770 {
2771  return new Roomba500Interface::DriveMessage(this);
2772 }
2773 /** @class Roomba500Interface::SetMotorsMessage <interfaces/Roomba500Interface.h>
2774  * SetMotorsMessage Fawkes BlackBoard Interface Message.
2775  *
2776 
2777  */
2778 
2779 
2780 /** Constructor with initial values.
2781  * @param ini_vacuuming initial value for vacuuming
2782  * @param ini_main initial value for main
2783  * @param ini_side initial value for side
2784  */
2785 Roomba500Interface::SetMotorsMessage::SetMotorsMessage(const bool ini_vacuuming, const BrushState ini_main, const BrushState ini_side) : Message("SetMotorsMessage")
2786 {
2787  data_size = sizeof(SetMotorsMessage_data_t);
2788  data_ptr = malloc(data_size);
2789  memset(data_ptr, 0, data_size);
2790  data = (SetMotorsMessage_data_t *)data_ptr;
2792  data->vacuuming = ini_vacuuming;
2793  data->main = ini_main;
2794  data->side = ini_side;
2795  add_fieldinfo(IFT_BOOL, "vacuuming", 1, &data->vacuuming, "");
2796  add_fieldinfo(IFT_ENUM, "main", 1, &data->main);
2797  add_fieldinfo(IFT_ENUM, "side", 1, &data->side);
2798 }
2799 /** Constructor */
2801 {
2802  data_size = sizeof(SetMotorsMessage_data_t);
2803  data_ptr = malloc(data_size);
2804  memset(data_ptr, 0, data_size);
2805  data = (SetMotorsMessage_data_t *)data_ptr;
2807  add_fieldinfo(IFT_BOOL, "vacuuming", 1, &data->vacuuming, "");
2808  add_fieldinfo(IFT_ENUM, "main", 1, &data->main);
2809  add_fieldinfo(IFT_ENUM, "side", 1, &data->side);
2810 }
2811 
2812 /** Destructor */
2814 {
2815  free(data_ptr);
2816 }
2817 
2818 /** Copy constructor.
2819  * @param m message to copy from
2820  */
2822 {
2823  data_size = m->data_size;
2824  data_ptr = malloc(data_size);
2825  memcpy(data_ptr, m->data_ptr, data_size);
2826  data = (SetMotorsMessage_data_t *)data_ptr;
2828 }
2829 
2830 /* Methods */
2831 /** Get vacuuming value.
2832  * Enable vacuuming?
2833  * @return vacuuming value
2834  */
2835 bool
2837 {
2838  return data->vacuuming;
2839 }
2840 
2841 /** Get maximum length of vacuuming value.
2842  * @return length of vacuuming value, can be length of the array or number of
2843  * maximum number of characters for a string
2844  */
2845 size_t
2847 {
2848  return 1;
2849 }
2850 
2851 /** Set vacuuming value.
2852  * Enable vacuuming?
2853  * @param new_vacuuming new vacuuming value
2854  */
2855 void
2857 {
2858  data->vacuuming = new_vacuuming;
2859 }
2860 
2861 /** Get main value.
2862  * Main brush state.
2863  * @return main value
2864  */
2867 {
2868  return (Roomba500Interface::BrushState)data->main;
2869 }
2870 
2871 /** Get maximum length of main value.
2872  * @return length of main value, can be length of the array or number of
2873  * maximum number of characters for a string
2874  */
2875 size_t
2877 {
2878  return 1;
2879 }
2880 
2881 /** Set main value.
2882  * Main brush state.
2883  * @param new_main new main value
2884  */
2885 void
2887 {
2888  data->main = new_main;
2889 }
2890 
2891 /** Get side value.
2892  * Side brush state.
2893  * @return side value
2894  */
2897 {
2898  return (Roomba500Interface::BrushState)data->side;
2899 }
2900 
2901 /** Get maximum length of side value.
2902  * @return length of side value, can be length of the array or number of
2903  * maximum number of characters for a string
2904  */
2905 size_t
2907 {
2908  return 1;
2909 }
2910 
2911 /** Set side value.
2912  * Side brush state.
2913  * @param new_side new side value
2914  */
2915 void
2917 {
2918  data->side = new_side;
2919 }
2920 
2921 /** Clone this message.
2922  * Produces a message of the same type as this message and copies the
2923  * data to the new message.
2924  * @return clone of this message
2925  */
2926 Message *
2928 {
2929  return new Roomba500Interface::SetMotorsMessage(this);
2930 }
2931 /** Check if message is valid and can be enqueued.
2932  * @param message Message to check
2933  * @return true if the message is valid, false otherwise.
2934  */
2935 bool
2937 {
2938  const StopMessage *m0 = dynamic_cast<const StopMessage *>(message);
2939  if ( m0 != NULL ) {
2940  return true;
2941  }
2942  const DockMessage *m1 = dynamic_cast<const DockMessage *>(message);
2943  if ( m1 != NULL ) {
2944  return true;
2945  }
2946  const SetModeMessage *m2 = dynamic_cast<const SetModeMessage *>(message);
2947  if ( m2 != NULL ) {
2948  return true;
2949  }
2950  const DriveStraightMessage *m3 = dynamic_cast<const DriveStraightMessage *>(message);
2951  if ( m3 != NULL ) {
2952  return true;
2953  }
2954  const DriveMessage *m4 = dynamic_cast<const DriveMessage *>(message);
2955  if ( m4 != NULL ) {
2956  return true;
2957  }
2958  const SetMotorsMessage *m5 = dynamic_cast<const SetMotorsMessage *>(message);
2959  if ( m5 != NULL ) {
2960  return true;
2961  }
2962  return false;
2963 }
2964 
2965 /// @cond INTERNALS
2966 EXPORT_INTERFACE(Roomba500Interface)
2967 /// @endcond
2968 
2969 
2970 } // end namespace fawkes
void set_velocity(const int16_t new_velocity)
Set velocity value.
int16_t velocity() const
Get velocity value.
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:114
size_t maxlenof_main() const
Get maximum length of main value.
virtual Message * clone() const
Clone this message.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:43
ChargingState
Current charging state.
int16_t velocity() const
Get velocity value.
virtual Message * clone() const
Clone this message.
StopMessage Fawkes BlackBoard Interface Message.
Mode
Open Interface mode.
void set_radius(const int16_t new_radius)
Set radius value.
virtual Message * clone() const
Clone this message.
Fawkes library namespace.
virtual Message * clone() const
Clone this message.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
Definition: message.h:119
void set_main(const BrushState new_main)
Set main value.
bool is_vacuuming() const
Get vacuuming value.
InfraredCharacter
Infrared character values.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
16 bit integer field
Definition: types.h:37
DockMessage Fawkes BlackBoard Interface Message.
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:123
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:115
size_t maxlenof_velocity() const
Get maximum length of velocity value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_side(const BrushState new_side)
Set side value.
size_t maxlenof_radius() const
Get maximum length of radius value.
size_t maxlenof_mode() const
Get maximum length of mode value.
void set_vacuuming(const bool new_vacuuming)
Set vacuuming value.
BrushState main() const
Get main value.
SetMotorsMessage Fawkes BlackBoard Interface Message.
void set_mode(const Mode new_mode)
Set mode value.
int16_t radius() const
Get radius value.
size_t maxlenof_side() const
Get maximum length of side value.
size_t maxlenof_vacuuming() const
Get maximum length of vacuuming value.
Roomba500Interface Fawkes BlackBoard Interface.
SetModeMessage Fawkes BlackBoard Interface Message.
BrushState side() const
Get side value.
size_t maxlenof_velocity() const
Get maximum length of velocity value.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0)
Add an entry to the info list.
Definition: message.cpp:435
void set_velocity(const int16_t new_velocity)
Set velocity value.
boolean field
Definition: types.h:34
DriveStraightMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
const char * type() const
Get type of interface.
Definition: interface.cpp:635
DriveMessage Fawkes BlackBoard Interface Message.
BrushState
State of the brushes.
field with interface specific enum type
Definition: types.h:47
virtual Message * clone() const
Clone this message.