Fawkes API
Fawkes Development Version
|
24 #include <interfaces/VisualDisplay2DInterface.h>
26 #include <core/exceptions/software.h>
59 VisualDisplay2DInterface::VisualDisplay2DInterface() : Interface()
61 data_size =
sizeof(VisualDisplay2DInterface_data_t);
63 data = (VisualDisplay2DInterface_data_t *)
data_ptr;
66 enum_map_LineStyle[(int)LS_SOLID] =
"LS_SOLID";
67 enum_map_LineStyle[(int)LS_DASHED] =
"LS_DASHED";
68 enum_map_LineStyle[(int)LS_DOTTED] =
"LS_DOTTED";
69 enum_map_LineStyle[(int)LS_DASH_DOTTED] =
"LS_DASH_DOTTED";
70 enum_map_Anchor[(int)CENTERED] =
"CENTERED";
71 enum_map_Anchor[(int)NORTH] =
"NORTH";
72 enum_map_Anchor[(int)EAST] =
"EAST";
73 enum_map_Anchor[(int)SOUTH] =
"SOUTH";
74 enum_map_Anchor[(int)WEST] =
"WEST";
75 enum_map_Anchor[(int)NORTH_EAST] =
"NORTH_EAST";
76 enum_map_Anchor[(int)SOUTH_EAST] =
"SOUTH_EAST";
77 enum_map_Anchor[(int)SOUTH_WEST] =
"SOUTH_WEST";
78 enum_map_Anchor[(int)NORTH_WEST] =
"NORTH_WEST";
86 unsigned char tmp_hash[] = {0xd9, 0x2, 0xad, 0xbb, 0x7a, 0x47, 0x40, 0x6a, 0x4f, 0x6d, 0xfa, 0xa, 0x20, 0x35, 0xe6, 0x1};
91 VisualDisplay2DInterface::~VisualDisplay2DInterface()
107 default:
return "UNKNOWN";
119 case NORTH:
return "NORTH";
120 case EAST:
return "EAST";
121 case SOUTH:
return "SOUTH";
122 case WEST:
return "WEST";
127 default:
return "UNKNOWN";
138 return data->counter;
165 if ( strncmp(
"AddCartLineMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
167 }
else if ( strncmp(
"AddCartCircleMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
169 }
else if ( strncmp(
"AddCartRectMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
171 }
else if ( strncmp(
"AddCartTextMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
173 }
else if ( strncmp(
"DeleteObjectMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
175 }
else if ( strncmp(
"DeleteAllMessage",
type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
179 "message type for this interface type.",
type);
195 memcpy(data, oi->data,
sizeof(VisualDisplay2DInterface_data_t));
201 if (strcmp(enumtype,
"LineStyle") == 0) {
204 if (strcmp(enumtype,
"Anchor") == 0) {
226 data_size =
sizeof(AddCartLineMessage_data_t);
229 data = (AddCartLineMessage_data_t *)
data_ptr;
231 memcpy(data->x, ini_x,
sizeof(
float) * 2);
232 memcpy(data->y, ini_y,
sizeof(
float) * 2);
233 data->style = ini_style;
234 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
235 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
236 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
237 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
239 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
240 enum_map_Anchor[(int)
NORTH] =
"NORTH";
241 enum_map_Anchor[(int)
EAST] =
"EAST";
242 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
243 enum_map_Anchor[(int)
WEST] =
"WEST";
244 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
245 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
246 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
247 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
256 data_size =
sizeof(AddCartLineMessage_data_t);
259 data = (AddCartLineMessage_data_t *)
data_ptr;
261 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
262 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
263 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
265 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
266 enum_map_Anchor[(int)
NORTH] =
"NORTH";
267 enum_map_Anchor[(int)
EAST] =
"EAST";
268 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
269 enum_map_Anchor[(int)
WEST] =
"WEST";
270 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
271 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
272 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
273 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
294 data = (AddCartLineMessage_data_t *)
data_ptr;
319 throw Exception(
"Index value %u out of bounds (0..1)", index);
321 return data->x[index];
376 throw Exception(
"Index value %u out of bounds (0..1)", index);
378 return data->y[index];
463 throw Exception(
"Index value %u out of bounds (0..3)", index);
465 return data->color[index];
524 data_size =
sizeof(AddCartCircleMessage_data_t);
527 data = (AddCartCircleMessage_data_t *)
data_ptr;
531 data->radius = ini_radius;
532 data->style = ini_style;
533 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
534 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
535 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
536 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
538 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
539 enum_map_Anchor[(int)
NORTH] =
"NORTH";
540 enum_map_Anchor[(int)
EAST] =
"EAST";
541 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
542 enum_map_Anchor[(int)
WEST] =
"WEST";
543 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
544 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
545 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
546 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
556 data_size =
sizeof(AddCartCircleMessage_data_t);
559 data = (AddCartCircleMessage_data_t *)
data_ptr;
561 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
562 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
563 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
565 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
566 enum_map_Anchor[(int)
NORTH] =
"NORTH";
567 enum_map_Anchor[(int)
EAST] =
"EAST";
568 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
569 enum_map_Anchor[(int)
WEST] =
"WEST";
570 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
571 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
572 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
573 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
595 data = (AddCartCircleMessage_data_t *)
data_ptr;
740 throw Exception(
"Index value %u out of bounds (0..3)", index);
742 return data->color[index];
802 data_size =
sizeof(AddCartRectMessage_data_t);
805 data = (AddCartRectMessage_data_t *)
data_ptr;
809 data->width = ini_width;
810 data->height = ini_height;
811 data->style = ini_style;
812 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
813 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
814 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
815 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
817 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
818 enum_map_Anchor[(int)
NORTH] =
"NORTH";
819 enum_map_Anchor[(int)
EAST] =
"EAST";
820 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
821 enum_map_Anchor[(int)
WEST] =
"WEST";
822 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
823 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
824 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
825 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
836 data_size =
sizeof(AddCartRectMessage_data_t);
839 data = (AddCartRectMessage_data_t *)
data_ptr;
841 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
842 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
843 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
845 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
846 enum_map_Anchor[(int)
NORTH] =
"NORTH";
847 enum_map_Anchor[(int)
EAST] =
"EAST";
848 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
849 enum_map_Anchor[(int)
WEST] =
"WEST";
850 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
851 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
852 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
853 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
876 data = (AddCartRectMessage_data_t *)
data_ptr;
1051 throw Exception(
"Index value %u out of bounds (0..3)", index);
1053 return data->color[index];
1113 data_size =
sizeof(AddCartTextMessage_data_t);
1116 data = (AddCartTextMessage_data_t *)
data_ptr;
1120 strncpy(data->text, ini_text, 128-1);
1121 data->text[128-1] = 0;
1122 data->anchor = ini_anchor;
1123 data->size = ini_size;
1124 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
1125 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1126 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1127 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1129 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1130 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1131 enum_map_Anchor[(int)
EAST] =
"EAST";
1132 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1133 enum_map_Anchor[(int)
WEST] =
"WEST";
1134 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1135 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1136 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1137 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1148 data_size =
sizeof(AddCartTextMessage_data_t);
1151 data = (AddCartTextMessage_data_t *)
data_ptr;
1153 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1154 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1155 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1157 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1158 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1159 enum_map_Anchor[(int)
EAST] =
"EAST";
1160 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1161 enum_map_Anchor[(int)
WEST] =
"WEST";
1162 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1163 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1164 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1165 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1188 data = (AddCartTextMessage_data_t *)
data_ptr;
1365 throw Exception(
"Index value %u out of bounds (0..3)", index);
1367 return data->color[index];
1422 data_size =
sizeof(DeleteObjectMessage_data_t);
1425 data = (DeleteObjectMessage_data_t *)
data_ptr;
1427 data->object_id = ini_object_id;
1428 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1429 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1430 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1432 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1433 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1434 enum_map_Anchor[(int)
EAST] =
"EAST";
1435 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1436 enum_map_Anchor[(int)
WEST] =
"WEST";
1437 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1438 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1439 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1440 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1446 data_size =
sizeof(DeleteObjectMessage_data_t);
1449 data = (DeleteObjectMessage_data_t *)
data_ptr;
1451 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1452 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1453 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1455 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1456 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1457 enum_map_Anchor[(int)
EAST] =
"EAST";
1458 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1459 enum_map_Anchor[(int)
WEST] =
"WEST";
1460 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1461 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1462 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1463 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1481 data = (DeleteObjectMessage_data_t *)
data_ptr;
1494 return data->object_id;
1538 data_size =
sizeof(DeleteAllMessage_data_t);
1541 data = (DeleteAllMessage_data_t *)
data_ptr;
1543 enum_map_LineStyle[(int)
LS_SOLID] =
"LS_SOLID";
1544 enum_map_LineStyle[(int)
LS_DASHED] =
"LS_DASHED";
1545 enum_map_LineStyle[(int)
LS_DOTTED] =
"LS_DOTTED";
1547 enum_map_Anchor[(int)
CENTERED] =
"CENTERED";
1548 enum_map_Anchor[(int)
NORTH] =
"NORTH";
1549 enum_map_Anchor[(int)
EAST] =
"EAST";
1550 enum_map_Anchor[(int)
SOUTH] =
"SOUTH";
1551 enum_map_Anchor[(int)
WEST] =
"WEST";
1552 enum_map_Anchor[(int)
NORTH_EAST] =
"NORTH_EAST";
1553 enum_map_Anchor[(int)
SOUTH_EAST] =
"SOUTH_EAST";
1554 enum_map_Anchor[(int)
SOUTH_WEST] =
"SOUTH_WEST";
1555 enum_map_Anchor[(int)
NORTH_WEST] =
"NORTH_WEST";
1572 data = (DeleteAllMessage_data_t *)
data_ptr;
void set_x(unsigned int index, const float new_x)
Set x value at given index.
size_t maxlenof_color() const
Get maximum length of color value.
size_t maxlenof_text() const
Get maximum length of text value.
void * data_ptr
Pointer to local memory storage.
size_t maxlenof_y() const
Get maximum length of y value.
AddCartRectMessage Fawkes BlackBoard Interface Message.
uint8_t * color() const
Get color value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_object_id() const
Get maximum length of object_id value.
void set_anchor(const Anchor new_anchor)
Set anchor value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_color() const
Get maximum length of color value.
size_t maxlenof_x() const
Get maximum length of x value.
@ LS_DASH_DOTTED
Dashed and dotted line.
float size() const
Get size value.
void set_size(const float new_size)
Set size value.
void set_counter(const uint32_t new_counter)
Set counter value.
size_t maxlenof_width() const
Get maximum length of width value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
void * data_ptr
Pointer to memory that contains local data.
uint8_t * color() const
Get color value.
void set_x(const float new_x)
Set x value.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
@ IFT_ENUM
field with interface specific enum type
message_data_ts_t * data_ts
data timestamp aliasing pointer
size_t maxlenof_style() const
Get maximum length of style value.
size_t maxlenof_radius() const
Get maximum length of radius value.
@ IFT_UINT32
32 bit unsigned integer field
void set_text(const char *new_text)
Set text value.
void set_radius(const float new_radius)
Set radius value.
void set_y(const float new_y)
Set y value.
float x() const
Get x value.
void set_y(unsigned int index, const float new_y)
Set y value at given index.
const char * type() const
Get type of interface.
~AddCartTextMessage()
Destructor.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the field info list.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
~AddCartLineMessage()
Destructor.
float y() const
Get y value.
void set_style(const LineStyle new_style)
Set style value.
~AddCartCircleMessage()
Destructor.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
size_t maxlenof_y() const
Get maximum length of y value.
VisualDisplay2DInterface Fawkes BlackBoard Interface.
size_t maxlenof_color() const
Get maximum length of color value.
AddCartTextMessage Fawkes BlackBoard Interface Message.
Timestamp data, must be present and first entries for each interface data structs!...
size_t maxlenof_x() const
Get maximum length of x value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
DeleteAllMessage Fawkes BlackBoard Interface Message.
const char * tostring_Anchor(Anchor value) const
Convert Anchor constant to string.
virtual Message * clone() const
Clone this message.
~DeleteAllMessage()
Destructor.
bool data_changed
Indicator if data has changed.
@ CENTERED
Vertically and horitontally centered.
void set_object_id(const uint32_t new_object_id)
Set object_id value.
void set_style(const LineStyle new_style)
Set style value.
float width() const
Get width value.
AddCartLineMessage()
Constructor.
~DeleteObjectMessage()
Destructor.
uint32_t counter() const
Get counter value.
float * y() const
Get y value.
AddCartLineMessage Fawkes BlackBoard Interface Message.
DeleteAllMessage()
Constructor.
size_t maxlenof_x() const
Get maximum length of x value.
float y() const
Get y value.
void set_x(const float new_x)
Set x value.
float height() const
Get height value.
virtual Message * clone() const
Clone this message.
Fawkes library namespace.
size_t maxlenof_color() const
Get maximum length of color value.
void set_hash(unsigned char *ihash)
Set hash.
virtual Message * create_message(const char *type) const
Create message based on type name.
AddCartRectMessage()
Constructor.
unsigned int data_size
Size of memory needed to hold all data.
void set_height(const float new_height)
Set height value.
@ SOUTH_EAST
Bottom right.
float x() const
Get x value.
void set_x(const float new_x)
Set x value.
size_t maxlenof_y() const
Get maximum length of y value.
DeleteObjectMessage()
Constructor.
Base class for all Fawkes BlackBoard interfaces.
LineStyle style() const
Get style value.
size_t maxlenof_anchor() const
Get maximum length of anchor value.
void set_style(const LineStyle new_style)
Set style value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_size() const
Get maximum length of size value.
LineStyle style() const
Get style value.
float * x() const
Get x value.
uint32_t object_id() const
Get object_id value.
void set_width(const float new_width)
Set width value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_style() const
Get maximum length of style value.
void add_fieldinfo(interface_fieldtype_t type, const char *name, size_t length, void *value, const char *enumtype=0, const interface_enum_map_t *enum_map=0)
Add an entry to the info list.
char * text() const
Get text value.
uint8_t * color() const
Get color value.
float x() const
Get x value.
AddCartCircleMessage Fawkes BlackBoard Interface Message.
unsigned int data_size
Minimal data size to hold data storage.
const char * tostring_LineStyle(LineStyle value) const
Convert LineStyle constant to string.
AddCartCircleMessage()
Constructor.
float y() const
Get y value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_style() const
Get maximum length of style value.
LineStyle style() const
Get style value.
AddCartTextMessage()
Constructor.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
~AddCartRectMessage()
Destructor.
LineStyle
Enumeration defining the possible line styles.
size_t maxlenof_counter() const
Get maximum length of counter value.
@ IFT_BYTE
byte field, alias for uint8
size_t maxlenof_x() const
Get maximum length of x value.
void set_y(const float new_y)
Set y value.
float radius() const
Get radius value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Anchor anchor() const
Get anchor value.
uint8_t * color() const
Get color value.
Anchor
Enumeration defining the possible anchor points.
void set_y(const float new_y)
Set y value.
size_t maxlenof_height() const
Get maximum length of height value.
Base class for exceptions in Fawkes.