Fawkes API Fawkes Development Version
FacialExpressionInterface.cpp
1
2/***************************************************************************
3 * FacialExpressionInterface.cpp - Fawkes BlackBoard Interface - FacialExpressionInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2009 Bahram Maleki-Fard
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/FacialExpressionInterface.h>
25
26#include <core/exceptions/software.h>
27
28#include <map>
29#include <string>
30#include <cstring>
31#include <cstdlib>
32
33namespace fawkes {
34
35/** @class FacialExpressionInterface <interfaces/FacialExpressionInterface.h>
36 * FacialExpressionInterface Fawkes BlackBoard Interface.
37 *
38 Interface to acces facial expressions on display (RCSoft)
39
40 * @ingroup FawkesInterfaces
41 */
42
43
44
45/** Constructor */
46FacialExpressionInterface::FacialExpressionInterface() : Interface()
47{
48 data_size = sizeof(FacialExpressionInterface_data_t);
49 data_ptr = malloc(data_size);
50 data = (FacialExpressionInterface_data_t *)data_ptr;
51 data_ts = (interface_data_ts_t *)data_ptr;
52 memset(data_ptr, 0, data_size);
53 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
54 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
55 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
56 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
57 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
58 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
59 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
60 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
61 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
62 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
63 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
64 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
65 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
66 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
67 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
68 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
69 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
70 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
71 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
72 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
73 add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t", &enum_map_brows_t);
74 add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t", &enum_map_eyes_t);
75 add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t", &enum_map_jowl_t);
76 add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t", &enum_map_mouth_t);
77 add_messageinfo("MoveBrowsMessage");
78 add_messageinfo("MoveEyesMessage");
79 add_messageinfo("MoveJowlMessage");
80 add_messageinfo("MoveMouthMessage");
81 unsigned char tmp_hash[] = {0x1, 0xbd, 0xc6, 0x65, 0xb3, 0x10, 0xcb, 0x5f, 0xe8, 0x78, 0xdd, 0x6, 0xe, 0x82, 0x7f, 0x80};
82 set_hash(tmp_hash);
83}
84
85/** Destructor */
86FacialExpressionInterface::~FacialExpressionInterface()
87{
88 free(data_ptr);
89}
90/** Convert brows_t constant to string.
91 * @param value value to convert to string
92 * @return constant value as string.
93 */
94const char *
95FacialExpressionInterface::tostring_brows_t(brows_t value) const
96{
97 switch (value) {
98 case BROWS_DEFAULT: return "BROWS_DEFAULT";
99 case BROWS_FROWN: return "BROWS_FROWN";
100 case BROWS_LIFT: return "BROWS_LIFT";
101 default: return "UNKNOWN";
102 }
103}
104/** Convert eyes_t constant to string.
105 * @param value value to convert to string
106 * @return constant value as string.
107 */
108const char *
109FacialExpressionInterface::tostring_eyes_t(eyes_t value) const
110{
111 switch (value) {
112 case EYES_DEFAULT: return "EYES_DEFAULT";
113 case EYES_UP: return "EYES_UP";
114 case EYES_DOWN: return "EYES_DOWN";
115 case EYES_LEFT: return "EYES_LEFT";
116 case EYES_RIGHT: return "EYES_RIGHT";
117 case EYES_COOL: return "EYES_COOL";
118 case EYES_CROSS: return "EYES_CROSS";
119 case EYES_HEART: return "EYES_HEART";
120 case EYES_DOLLAR: return "EYES_DOLLAR";
121 default: return "UNKNOWN";
122 }
123}
124/** Convert jowl_t constant to string.
125 * @param value value to convert to string
126 * @return constant value as string.
127 */
128const char *
129FacialExpressionInterface::tostring_jowl_t(jowl_t value) const
130{
131 switch (value) {
132 case JOWL_DEFAULT: return "JOWL_DEFAULT";
133 case JOWL_BLUSH: return "JOWL_BLUSH";
134 case JOWL_TEARS: return "JOWL_TEARS";
135 default: return "UNKNOWN";
136 }
137}
138/** Convert mouth_t constant to string.
139 * @param value value to convert to string
140 * @return constant value as string.
141 */
142const char *
143FacialExpressionInterface::tostring_mouth_t(mouth_t value) const
144{
145 switch (value) {
146 case MOUTH_DEFAULT: return "MOUTH_DEFAULT";
147 case MOUTH_OPEN: return "MOUTH_OPEN";
148 case MOUTH_CLOSE: return "MOUTH_CLOSE";
149 case MOUTH_SMILE: return "MOUTH_SMILE";
150 case MOUTH_SCOWL: return "MOUTH_SCOWL";
151 default: return "UNKNOWN";
152 }
153}
154/* Methods */
155/** Get brows_action value.
156 * Type of action of brows
157 * @return brows_action value
158 */
160FacialExpressionInterface::brows_action() const
161{
162 return (FacialExpressionInterface::brows_t)data->brows_action;
163}
164
165/** Get maximum length of brows_action value.
166 * @return length of brows_action value, can be length of the array or number of
167 * maximum number of characters for a string
168 */
169size_t
170FacialExpressionInterface::maxlenof_brows_action() const
171{
172 return 1;
173}
174
175/** Set brows_action value.
176 * Type of action of brows
177 * @param new_brows_action new brows_action value
178 */
179void
180FacialExpressionInterface::set_brows_action(const brows_t new_brows_action)
181{
182 set_field(data->brows_action, new_brows_action);
183}
184
185/** Get eyes_action value.
186 * Type of action of eyes
187 * @return eyes_action value
188 */
190FacialExpressionInterface::eyes_action() const
191{
192 return (FacialExpressionInterface::eyes_t)data->eyes_action;
193}
194
195/** Get maximum length of eyes_action value.
196 * @return length of eyes_action value, can be length of the array or number of
197 * maximum number of characters for a string
198 */
199size_t
200FacialExpressionInterface::maxlenof_eyes_action() const
201{
202 return 1;
203}
204
205/** Set eyes_action value.
206 * Type of action of eyes
207 * @param new_eyes_action new eyes_action value
208 */
209void
210FacialExpressionInterface::set_eyes_action(const eyes_t new_eyes_action)
211{
212 set_field(data->eyes_action, new_eyes_action);
213}
214
215/** Get jowl_action value.
216 * Type of action of jown
217 * @return jowl_action value
218 */
220FacialExpressionInterface::jowl_action() const
221{
222 return (FacialExpressionInterface::jowl_t)data->jowl_action;
223}
224
225/** Get maximum length of jowl_action value.
226 * @return length of jowl_action value, can be length of the array or number of
227 * maximum number of characters for a string
228 */
229size_t
230FacialExpressionInterface::maxlenof_jowl_action() const
231{
232 return 1;
233}
234
235/** Set jowl_action value.
236 * Type of action of jown
237 * @param new_jowl_action new jowl_action value
238 */
239void
240FacialExpressionInterface::set_jowl_action(const jowl_t new_jowl_action)
241{
242 set_field(data->jowl_action, new_jowl_action);
243}
244
245/** Get mouth_action value.
246 * Type of action of mouth
247 * @return mouth_action value
248 */
250FacialExpressionInterface::mouth_action() const
251{
252 return (FacialExpressionInterface::mouth_t)data->mouth_action;
253}
254
255/** Get maximum length of mouth_action value.
256 * @return length of mouth_action value, can be length of the array or number of
257 * maximum number of characters for a string
258 */
259size_t
260FacialExpressionInterface::maxlenof_mouth_action() const
261{
262 return 1;
263}
264
265/** Set mouth_action value.
266 * Type of action of mouth
267 * @param new_mouth_action new mouth_action value
268 */
269void
270FacialExpressionInterface::set_mouth_action(const mouth_t new_mouth_action)
271{
272 set_field(data->mouth_action, new_mouth_action);
273}
274
275/* =========== message create =========== */
276Message *
277FacialExpressionInterface::create_message(const char *type) const
278{
279 if ( strncmp("MoveBrowsMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
280 return new MoveBrowsMessage();
281 } else if ( strncmp("MoveEyesMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
282 return new MoveEyesMessage();
283 } else if ( strncmp("MoveJowlMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
284 return new MoveJowlMessage();
285 } else if ( strncmp("MoveMouthMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
286 return new MoveMouthMessage();
287 } else {
288 throw UnknownTypeException("The given type '%s' does not match any known "
289 "message type for this interface type.", type);
290 }
291}
292
293
294/** Copy values from other interface.
295 * @param other other interface to copy values from
296 */
297void
298FacialExpressionInterface::copy_values(const Interface *other)
299{
300 const FacialExpressionInterface *oi = dynamic_cast<const FacialExpressionInterface *>(other);
301 if (oi == NULL) {
302 throw TypeMismatchException("Can only copy values from interface of same type (%s vs. %s)",
303 type(), other->type());
304 }
305 memcpy(data, oi->data, sizeof(FacialExpressionInterface_data_t));
306}
307
308const char *
309FacialExpressionInterface::enum_tostring(const char *enumtype, int val) const
310{
311 if (strcmp(enumtype, "brows_t") == 0) {
312 return tostring_brows_t((brows_t)val);
313 }
314 if (strcmp(enumtype, "eyes_t") == 0) {
315 return tostring_eyes_t((eyes_t)val);
316 }
317 if (strcmp(enumtype, "jowl_t") == 0) {
318 return tostring_jowl_t((jowl_t)val);
319 }
320 if (strcmp(enumtype, "mouth_t") == 0) {
321 return tostring_mouth_t((mouth_t)val);
322 }
323 throw UnknownTypeException("Unknown enum type %s", enumtype);
324}
325
326/* =========== messages =========== */
327/** @class FacialExpressionInterface::MoveBrowsMessage <interfaces/FacialExpressionInterface.h>
328 * MoveBrowsMessage Fawkes BlackBoard Interface Message.
329 *
330
331 */
332
333
334/** Constructor with initial values.
335 * @param ini_brows_action initial value for brows_action
336 */
337FacialExpressionInterface::MoveBrowsMessage::MoveBrowsMessage(const brows_t ini_brows_action) : Message("MoveBrowsMessage")
338{
339 data_size = sizeof(MoveBrowsMessage_data_t);
340 data_ptr = malloc(data_size);
341 memset(data_ptr, 0, data_size);
342 data = (MoveBrowsMessage_data_t *)data_ptr;
344 data->brows_action = ini_brows_action;
345 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
346 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
347 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
348 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
349 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
350 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
351 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
352 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
353 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
354 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
355 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
356 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
357 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
358 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
359 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
360 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
361 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
362 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
363 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
364 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
365 add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t", &enum_map_brows_t);
366}
367/** Constructor */
369{
370 data_size = sizeof(MoveBrowsMessage_data_t);
371 data_ptr = malloc(data_size);
372 memset(data_ptr, 0, data_size);
373 data = (MoveBrowsMessage_data_t *)data_ptr;
375 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
376 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
377 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
378 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
379 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
380 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
381 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
382 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
383 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
384 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
385 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
386 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
387 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
388 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
389 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
390 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
391 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
392 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
393 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
394 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
395 add_fieldinfo(IFT_ENUM, "brows_action", 1, &data->brows_action, "brows_t", &enum_map_brows_t);
396}
397
398/** Destructor */
400{
401 free(data_ptr);
402}
403
404/** Copy constructor.
405 * @param m message to copy from
406 */
408{
409 data_size = m->data_size;
410 data_ptr = malloc(data_size);
411 memcpy(data_ptr, m->data_ptr, data_size);
412 data = (MoveBrowsMessage_data_t *)data_ptr;
414}
415
416/* Methods */
417/** Get brows_action value.
418 * Type of action of brows
419 * @return brows_action value
420 */
423{
424 return (FacialExpressionInterface::brows_t)data->brows_action;
425}
426
427/** Get maximum length of brows_action value.
428 * @return length of brows_action value, can be length of the array or number of
429 * maximum number of characters for a string
430 */
431size_t
433{
434 return 1;
435}
436
437/** Set brows_action value.
438 * Type of action of brows
439 * @param new_brows_action new brows_action value
440 */
441void
443{
444 set_field(data->brows_action, new_brows_action);
445}
446
447/** Clone this message.
448 * Produces a message of the same type as this message and copies the
449 * data to the new message.
450 * @return clone of this message
451 */
452Message *
454{
456}
457/** @class FacialExpressionInterface::MoveEyesMessage <interfaces/FacialExpressionInterface.h>
458 * MoveEyesMessage Fawkes BlackBoard Interface Message.
459 *
460
461 */
462
463
464/** Constructor with initial values.
465 * @param ini_eyes_action initial value for eyes_action
466 */
468{
469 data_size = sizeof(MoveEyesMessage_data_t);
470 data_ptr = malloc(data_size);
471 memset(data_ptr, 0, data_size);
472 data = (MoveEyesMessage_data_t *)data_ptr;
474 data->eyes_action = ini_eyes_action;
475 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
476 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
477 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
478 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
479 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
480 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
481 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
482 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
483 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
484 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
485 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
486 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
487 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
488 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
489 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
490 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
491 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
492 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
493 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
494 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
495 add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t", &enum_map_eyes_t);
496}
497/** Constructor */
499{
500 data_size = sizeof(MoveEyesMessage_data_t);
501 data_ptr = malloc(data_size);
502 memset(data_ptr, 0, data_size);
503 data = (MoveEyesMessage_data_t *)data_ptr;
505 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
506 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
507 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
508 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
509 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
510 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
511 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
512 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
513 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
514 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
515 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
516 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
517 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
518 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
519 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
520 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
521 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
522 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
523 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
524 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
525 add_fieldinfo(IFT_ENUM, "eyes_action", 1, &data->eyes_action, "eyes_t", &enum_map_eyes_t);
526}
527
528/** Destructor */
530{
531 free(data_ptr);
532}
533
534/** Copy constructor.
535 * @param m message to copy from
536 */
538{
539 data_size = m->data_size;
540 data_ptr = malloc(data_size);
541 memcpy(data_ptr, m->data_ptr, data_size);
542 data = (MoveEyesMessage_data_t *)data_ptr;
544}
545
546/* Methods */
547/** Get eyes_action value.
548 * Type of action of eyes
549 * @return eyes_action value
550 */
553{
554 return (FacialExpressionInterface::eyes_t)data->eyes_action;
555}
556
557/** Get maximum length of eyes_action value.
558 * @return length of eyes_action value, can be length of the array or number of
559 * maximum number of characters for a string
560 */
561size_t
563{
564 return 1;
565}
566
567/** Set eyes_action value.
568 * Type of action of eyes
569 * @param new_eyes_action new eyes_action value
570 */
571void
573{
574 set_field(data->eyes_action, new_eyes_action);
575}
576
577/** Clone this message.
578 * Produces a message of the same type as this message and copies the
579 * data to the new message.
580 * @return clone of this message
581 */
582Message *
584{
586}
587/** @class FacialExpressionInterface::MoveJowlMessage <interfaces/FacialExpressionInterface.h>
588 * MoveJowlMessage Fawkes BlackBoard Interface Message.
589 *
590
591 */
592
593
594/** Constructor with initial values.
595 * @param ini_jowl_action initial value for jowl_action
596 */
598{
599 data_size = sizeof(MoveJowlMessage_data_t);
600 data_ptr = malloc(data_size);
601 memset(data_ptr, 0, data_size);
602 data = (MoveJowlMessage_data_t *)data_ptr;
604 data->jowl_action = ini_jowl_action;
605 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
606 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
607 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
608 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
609 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
610 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
611 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
612 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
613 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
614 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
615 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
616 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
617 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
618 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
619 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
620 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
621 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
622 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
623 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
624 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
625 add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t", &enum_map_jowl_t);
626}
627/** Constructor */
629{
630 data_size = sizeof(MoveJowlMessage_data_t);
631 data_ptr = malloc(data_size);
632 memset(data_ptr, 0, data_size);
633 data = (MoveJowlMessage_data_t *)data_ptr;
635 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
636 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
637 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
638 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
639 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
640 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
641 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
642 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
643 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
644 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
645 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
646 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
647 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
648 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
649 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
650 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
651 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
652 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
653 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
654 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
655 add_fieldinfo(IFT_ENUM, "jowl_action", 1, &data->jowl_action, "jowl_t", &enum_map_jowl_t);
656}
657
658/** Destructor */
660{
661 free(data_ptr);
662}
663
664/** Copy constructor.
665 * @param m message to copy from
666 */
668{
669 data_size = m->data_size;
670 data_ptr = malloc(data_size);
671 memcpy(data_ptr, m->data_ptr, data_size);
672 data = (MoveJowlMessage_data_t *)data_ptr;
674}
675
676/* Methods */
677/** Get jowl_action value.
678 * Type of action of jown
679 * @return jowl_action value
680 */
683{
684 return (FacialExpressionInterface::jowl_t)data->jowl_action;
685}
686
687/** Get maximum length of jowl_action value.
688 * @return length of jowl_action value, can be length of the array or number of
689 * maximum number of characters for a string
690 */
691size_t
693{
694 return 1;
695}
696
697/** Set jowl_action value.
698 * Type of action of jown
699 * @param new_jowl_action new jowl_action value
700 */
701void
703{
704 set_field(data->jowl_action, new_jowl_action);
705}
706
707/** Clone this message.
708 * Produces a message of the same type as this message and copies the
709 * data to the new message.
710 * @return clone of this message
711 */
712Message *
714{
716}
717/** @class FacialExpressionInterface::MoveMouthMessage <interfaces/FacialExpressionInterface.h>
718 * MoveMouthMessage Fawkes BlackBoard Interface Message.
719 *
720
721 */
722
723
724/** Constructor with initial values.
725 * @param ini_mouth_action initial value for mouth_action
726 */
728{
729 data_size = sizeof(MoveMouthMessage_data_t);
730 data_ptr = malloc(data_size);
731 memset(data_ptr, 0, data_size);
732 data = (MoveMouthMessage_data_t *)data_ptr;
734 data->mouth_action = ini_mouth_action;
735 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
736 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
737 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
738 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
739 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
740 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
741 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
742 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
743 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
744 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
745 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
746 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
747 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
748 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
749 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
750 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
751 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
752 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
753 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
754 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
755 add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t", &enum_map_mouth_t);
756}
757/** Constructor */
759{
760 data_size = sizeof(MoveMouthMessage_data_t);
761 data_ptr = malloc(data_size);
762 memset(data_ptr, 0, data_size);
763 data = (MoveMouthMessage_data_t *)data_ptr;
765 enum_map_brows_t[(int)BROWS_DEFAULT] = "BROWS_DEFAULT";
766 enum_map_brows_t[(int)BROWS_FROWN] = "BROWS_FROWN";
767 enum_map_brows_t[(int)BROWS_LIFT] = "BROWS_LIFT";
768 enum_map_eyes_t[(int)EYES_DEFAULT] = "EYES_DEFAULT";
769 enum_map_eyes_t[(int)EYES_UP] = "EYES_UP";
770 enum_map_eyes_t[(int)EYES_DOWN] = "EYES_DOWN";
771 enum_map_eyes_t[(int)EYES_LEFT] = "EYES_LEFT";
772 enum_map_eyes_t[(int)EYES_RIGHT] = "EYES_RIGHT";
773 enum_map_eyes_t[(int)EYES_COOL] = "EYES_COOL";
774 enum_map_eyes_t[(int)EYES_CROSS] = "EYES_CROSS";
775 enum_map_eyes_t[(int)EYES_HEART] = "EYES_HEART";
776 enum_map_eyes_t[(int)EYES_DOLLAR] = "EYES_DOLLAR";
777 enum_map_jowl_t[(int)JOWL_DEFAULT] = "JOWL_DEFAULT";
778 enum_map_jowl_t[(int)JOWL_BLUSH] = "JOWL_BLUSH";
779 enum_map_jowl_t[(int)JOWL_TEARS] = "JOWL_TEARS";
780 enum_map_mouth_t[(int)MOUTH_DEFAULT] = "MOUTH_DEFAULT";
781 enum_map_mouth_t[(int)MOUTH_OPEN] = "MOUTH_OPEN";
782 enum_map_mouth_t[(int)MOUTH_CLOSE] = "MOUTH_CLOSE";
783 enum_map_mouth_t[(int)MOUTH_SMILE] = "MOUTH_SMILE";
784 enum_map_mouth_t[(int)MOUTH_SCOWL] = "MOUTH_SCOWL";
785 add_fieldinfo(IFT_ENUM, "mouth_action", 1, &data->mouth_action, "mouth_t", &enum_map_mouth_t);
786}
787
788/** Destructor */
790{
791 free(data_ptr);
792}
793
794/** Copy constructor.
795 * @param m message to copy from
796 */
798{
799 data_size = m->data_size;
800 data_ptr = malloc(data_size);
801 memcpy(data_ptr, m->data_ptr, data_size);
802 data = (MoveMouthMessage_data_t *)data_ptr;
804}
805
806/* Methods */
807/** Get mouth_action value.
808 * Type of action of mouth
809 * @return mouth_action value
810 */
813{
814 return (FacialExpressionInterface::mouth_t)data->mouth_action;
815}
816
817/** Get maximum length of mouth_action value.
818 * @return length of mouth_action value, can be length of the array or number of
819 * maximum number of characters for a string
820 */
821size_t
823{
824 return 1;
825}
826
827/** Set mouth_action value.
828 * Type of action of mouth
829 * @param new_mouth_action new mouth_action value
830 */
831void
833{
834 set_field(data->mouth_action, new_mouth_action);
835}
836
837/** Clone this message.
838 * Produces a message of the same type as this message and copies the
839 * data to the new message.
840 * @return clone of this message
841 */
842Message *
844{
846}
847/** Check if message is valid and can be enqueued.
848 * @param message Message to check
849 * @return true if the message is valid, false otherwise.
850 */
851bool
853{
854 const MoveBrowsMessage *m0 = dynamic_cast<const MoveBrowsMessage *>(message);
855 if ( m0 != NULL ) {
856 return true;
857 }
858 const MoveEyesMessage *m1 = dynamic_cast<const MoveEyesMessage *>(message);
859 if ( m1 != NULL ) {
860 return true;
861 }
862 const MoveJowlMessage *m2 = dynamic_cast<const MoveJowlMessage *>(message);
863 if ( m2 != NULL ) {
864 return true;
865 }
866 const MoveMouthMessage *m3 = dynamic_cast<const MoveMouthMessage *>(message);
867 if ( m3 != NULL ) {
868 return true;
869 }
870 return false;
871}
872
873/// @cond INTERNALS
874EXPORT_INTERFACE(FacialExpressionInterface)
875/// @endcond
876
877
878} // end namespace fawkes
MoveBrowsMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
size_t maxlenof_brows_action() const
Get maximum length of brows_action value.
void set_brows_action(const brows_t new_brows_action)
Set brows_action value.
MoveEyesMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
void set_eyes_action(const eyes_t new_eyes_action)
Set eyes_action value.
size_t maxlenof_eyes_action() const
Get maximum length of eyes_action value.
MoveJowlMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_jowl_action() const
Get maximum length of jowl_action value.
virtual Message * clone() const
Clone this message.
void set_jowl_action(const jowl_t new_jowl_action)
Set jowl_action value.
MoveMouthMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
size_t maxlenof_mouth_action() const
Get maximum length of mouth_action value.
void set_mouth_action(const mouth_t new_mouth_action)
Set mouth_action value.
FacialExpressionInterface Fawkes BlackBoard Interface.
brows_t
Action types for moving brows.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
mouth_t
Action types for moving mouth.
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
void * data_ptr
Pointer to local memory storage.
Definition: interface.h:244
void set_field(FieldT &field, DataT &data)
Set a field, set data_changed to true and update data_changed accordingly.
Definition: interface.h:304
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
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.
Definition: message.cpp:435
void * data_ptr
Pointer to memory that contains local data.
Definition: message.h:146
message_data_ts_t * data_ts
data timestamp aliasing pointer
Definition: message.h:156
unsigned int data_size
Size of memory needed to hold all data.
Definition: message.h:147
Fawkes library namespace.
@ IFT_ENUM
field with interface specific enum type
Definition: types.h:50
Timestamp data, must be present and first entries for each interface data structs!...
Definition: message.h:152