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()
92 default:
return "UNKNOWN";
104 case NORTH:
return "NORTH";
105 case EAST:
return "EAST";
106 case SOUTH:
return "SOUTH";
107 case WEST:
return "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) {
190 if (strcmp(enumtype,
"Anchor") == 0) {
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;