24 #include <interfaces/VisualDisplay2DInterface.h> 26 #include <core/exceptions/software.h> 57 VisualDisplay2DInterface::VisualDisplay2DInterface() : Interface()
59 data_size =
sizeof(VisualDisplay2DInterface_data_t);
61 data = (VisualDisplay2DInterface_data_t *)
data_ptr;
71 unsigned char tmp_hash[] = {0xd9, 0x2, 0xad, 0xbb, 0x7a, 0x47, 0x40, 0x6a, 0x4f, 0x6d, 0xfa, 0xa, 0x20, 0x35, 0xe6, 0x1};
76 VisualDisplay2DInterface::~VisualDisplay2DInterface()
88 case LS_SOLID:
return "LS_SOLID";
89 case LS_DASHED:
return "LS_DASHED";
90 case LS_DOTTED:
return "LS_DOTTED";
91 case LS_DASH_DOTTED:
return "LS_DASH_DOTTED";
92 default:
return "UNKNOWN";
103 case CENTERED:
return "CENTERED";
104 case NORTH:
return "NORTH";
105 case EAST:
return "EAST";
106 case SOUTH:
return "SOUTH";
107 case WEST:
return "WEST";
108 case NORTH_EAST:
return "NORTH_EAST";
109 case SOUTH_EAST:
return "SOUTH_EAST";
110 case SOUTH_WEST:
return "SOUTH_WEST";
111 case NORTH_WEST:
return "NORTH_WEST";
112 default:
return "UNKNOWN";
123 return data->counter;
143 data->counter = new_counter;
151 if ( strncmp(
"AddCartLineMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
153 }
else if ( strncmp(
"AddCartCircleMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
155 }
else if ( strncmp(
"AddCartRectMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
157 }
else if ( strncmp(
"AddCartTextMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
159 }
else if ( strncmp(
"DeleteObjectMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
161 }
else if ( strncmp(
"DeleteAllMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
165 "message type for this interface type.", type);
181 memcpy(data, oi->data,
sizeof(VisualDisplay2DInterface_data_t));
187 if (strcmp(enumtype,
"LineStyle") == 0) {
188 return tostring_LineStyle((
LineStyle)val);
190 if (strcmp(enumtype,
"Anchor") == 0) {
191 return tostring_Anchor((
Anchor)val);
212 data_size =
sizeof(AddCartLineMessage_data_t);
215 data = (AddCartLineMessage_data_t *)
data_ptr;
217 memcpy(data->x, ini_x,
sizeof(
float) * 2);
218 memcpy(data->y, ini_y,
sizeof(
float) * 2);
219 data->style = ini_style;
220 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
229 data_size =
sizeof(AddCartLineMessage_data_t);
232 data = (AddCartLineMessage_data_t *)
data_ptr;
254 data = (AddCartLineMessage_data_t *)
data_ptr;
279 throw Exception(
"Index value %u out of bounds (0..2)", index);
281 return data->x[index];
301 memcpy(data->x, new_x,
sizeof(
float) * 2);
313 throw Exception(
"Index value %u out of bounds (0..2)", index);
315 data->x[index] = new_x;
339 throw Exception(
"Index value %u out of bounds (0..2)", index);
341 return data->y[index];
362 memcpy(data->y, new_y,
sizeof(
float) * 2);
375 throw Exception(
"Index value %u out of bounds (0..2)", index);
377 data->y[index] = new_y;
406 data->style = new_style;
429 throw Exception(
"Index value %u out of bounds (0..4)", index);
431 return data->color[index];
451 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
463 throw Exception(
"Index value %u out of bounds (0..4)", index);
465 data->color[index] = new_color;
493 data_size =
sizeof(AddCartCircleMessage_data_t);
496 data = (AddCartCircleMessage_data_t *)
data_ptr;
500 data->radius = ini_radius;
501 data->style = ini_style;
502 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
512 data_size =
sizeof(AddCartCircleMessage_data_t);
515 data = (AddCartCircleMessage_data_t *)
data_ptr;
538 data = (AddCartCircleMessage_data_t *)
data_ptr;
630 data->radius = new_radius;
660 data->style = new_style;
683 throw Exception(
"Index value %u out of bounds (0..4)", index);
685 return data->color[index];
705 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
717 throw Exception(
"Index value %u out of bounds (0..4)", index);
719 data->color[index] = new_color;
748 data_size =
sizeof(AddCartRectMessage_data_t);
751 data = (AddCartRectMessage_data_t *)
data_ptr;
755 data->width = ini_width;
756 data->height = ini_height;
757 data->style = ini_style;
758 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
769 data_size =
sizeof(AddCartRectMessage_data_t);
772 data = (AddCartRectMessage_data_t *)
data_ptr;
796 data = (AddCartRectMessage_data_t *)
data_ptr;
888 data->width = new_width;
918 data->height = new_height;
948 data->style = new_style;
971 throw Exception(
"Index value %u out of bounds (0..4)", index);
973 return data->color[index];
993 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
1005 throw Exception(
"Index value %u out of bounds (0..4)", index);
1007 data->color[index] = new_color;
1036 data_size =
sizeof(AddCartTextMessage_data_t);
1039 data = (AddCartTextMessage_data_t *)
data_ptr;
1043 strncpy(data->text, ini_text, 128);
1044 data->anchor = ini_anchor;
1045 data->size = ini_size;
1046 memcpy(data->color, ini_color,
sizeof(uint8_t) * 4);
1057 data_size =
sizeof(AddCartTextMessage_data_t);
1060 data = (AddCartTextMessage_data_t *)
data_ptr;
1084 data = (AddCartTextMessage_data_t *)
data_ptr;
1176 strncpy(data->text, new_text,
sizeof(data->text));
1208 data->anchor = new_anchor;
1238 data->size = new_size;
1261 throw Exception(
"Index value %u out of bounds (0..4)", index);
1263 return data->color[index];
1283 memcpy(data->color, new_color,
sizeof(uint8_t) * 4);
1295 throw Exception(
"Index value %u out of bounds (0..4)", index);
1297 data->color[index] = new_color;
1321 data_size =
sizeof(DeleteObjectMessage_data_t);
1324 data = (DeleteObjectMessage_data_t *)
data_ptr;
1326 data->object_id = ini_object_id;
1332 data_size =
sizeof(DeleteObjectMessage_data_t);
1335 data = (DeleteObjectMessage_data_t *)
data_ptr;
1354 data = (DeleteObjectMessage_data_t *)
data_ptr;
1367 return data->object_id;
1388 data->object_id = new_object_id;
1411 data_size =
sizeof(DeleteAllMessage_data_t);
1414 data = (DeleteAllMessage_data_t *)
data_ptr;
1432 data = (DeleteAllMessage_data_t *)
data_ptr;
AddCartRectMessage Fawkes BlackBoard Interface Message.
uint8_t * color() const
Get color value.
LineStyle
Enumeration defining the possible line styles.
AddCartTextMessage()
Constructor.
DeleteAllMessage()
Constructor.
void set_anchor(const Anchor new_anchor)
Set anchor value.
void set_y(const float new_y)
Set y value.
size_t maxlenof_style() const
Get maximum length of style value.
float y() const
Get y value.
void * data_ptr
Pointer to memory that contains local data.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
virtual Message * clone() const
Clone this message.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
size_t maxlenof_x() const
Get maximum length of x value.
size_t maxlenof_color() const
Get maximum length of color value.
float y() const
Get y value.
void set_x(const float new_x)
Set x value.
void set_hash(unsigned char *ihash)
Set hash.
float x() const
Get x value.
uint8_t * color() const
Get color value.
size_t maxlenof_width() const
Get maximum length of width value.
uint32_t object_id() const
Get object_id value.
Fawkes library namespace.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
AddCartCircleMessage Fawkes BlackBoard Interface Message.
void set_radius(const float new_radius)
Set radius value.
size_t maxlenof_y() const
Get maximum length of y value.
unsigned int data_size
Minimal data size to hold data storage.
~AddCartCircleMessage()
Destructor.
Anchor
Enumeration defining the possible anchor points.
size_t maxlenof_style() const
Get maximum length of style value.
float y() const
Get y value.
~AddCartTextMessage()
Destructor.
float radius() const
Get radius value.
LineStyle style() const
Get style value.
virtual Message * clone() const
Clone this message.
byte field, alias for uint8
virtual Message * clone() const
Clone this message.
size_t maxlenof_y() const
Get maximum length of y value.
Base class for all Fawkes BlackBoard interfaces.
float * x() const
Get x value.
void set_style(const LineStyle new_style)
Set style value.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
uint8_t * color() const
Get color value.
float width() const
Get width value.
size_t maxlenof_counter() const
Get maximum length of counter value.
AddCartTextMessage Fawkes BlackBoard Interface Message.
AddCartRectMessage()
Constructor.
size_t maxlenof_height() const
Get maximum length of height value.
size_t maxlenof_x() const
Get maximum length of x value.
~AddCartLineMessage()
Destructor.
float * y() const
Get y value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
size_t maxlenof_color() const
Get maximum length of color value.
size_t maxlenof_style() const
Get maximum length of style value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
DeleteObjectMessage Fawkes BlackBoard Interface Message.
bool data_changed
Indicator if data has changed.
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.
size_t maxlenof_object_id() const
Get maximum length of object_id value.
size_t maxlenof_x() const
Get maximum length of x value.
void * data_ptr
Pointer to local memory storage.
Base class for exceptions in Fawkes.
float size() const
Get size value.
~DeleteAllMessage()
Destructor.
AddCartLineMessage Fawkes BlackBoard Interface Message.
void set_height(const float new_height)
Set height value.
void set_x(unsigned int index, const float new_x)
Set x value at given index.
size_t maxlenof_anchor() const
Get maximum length of anchor value.
size_t maxlenof_x() const
Get maximum length of x value.
const char * tostring_LineStyle(LineStyle value) const
Convert LineStyle constant to string.
uint32_t counter() const
Get counter value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
size_t maxlenof_text() const
Get maximum length of text value.
void set_y(const float new_y)
Set y value.
~AddCartRectMessage()
Destructor.
void set_style(const LineStyle new_style)
Set style value.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_color() const
Get maximum length of color value.
virtual Message * clone() const
Clone this message.
float height() const
Get height value.
void set_x(const float new_x)
Set x 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 field info list.
const char * tostring_Anchor(Anchor value) const
Convert Anchor constant to string.
virtual Message * clone() const
Clone this message.
AddCartCircleMessage()
Constructor.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
void set_object_id(const uint32_t new_object_id)
Set object_id value.
~DeleteObjectMessage()
Destructor.
void set_size(const float new_size)
Set size value.
virtual Message * clone() const
Clone this message.
void set_color(unsigned int index, const uint8_t new_color)
Set color value at given index.
size_t maxlenof_color() const
Get maximum length of color value.
float x() const
Get x value.
void set_width(const float new_width)
Set width value.
void set_y(const float new_y)
Set y 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.
Anchor anchor() const
Get anchor value.
virtual Message * create_message(const char *type) const
Create message based on type name.
DeleteAllMessage Fawkes BlackBoard Interface Message.
void set_text(const char *new_text)
Set text value.
interface_data_ts_t * data_ts
Pointer to data casted to timestamp struct.
size_t maxlenof_size() const
Get maximum length of size value.
LineStyle style() const
Get style value.
float x() const
Get x value.
AddCartLineMessage()
Constructor.
size_t maxlenof_y() const
Get maximum length of y value.
size_t maxlenof_radius() const
Get maximum length of radius value.
VisualDisplay2DInterface Fawkes BlackBoard Interface.
const char * type() const
Get type of interface.
char * text() const
Get text value.
32 bit unsigned integer field
field with interface specific enum type
void set_y(unsigned int index, const float new_y)
Set y value at given index.
void set_style(const LineStyle new_style)
Set style value.
LineStyle style() const
Get style value.
DeleteObjectMessage()
Constructor.
uint8_t * color() const
Get color value.
void set_counter(const uint32_t new_counter)
Set counter value.