24 #include <interfaces/FacerInterface.h> 26 #include <core/exceptions/software.h> 48 FacerInterface::FacerInterface() : Interface()
50 data_size =
sizeof(FacerInterface_data_t);
52 data = (FacerInterface_data_t *)
data_ptr;
76 unsigned char tmp_hash[] = {0xe1, 0x12, 0xd2, 0x51, 0x1d, 0x24, 0x1b, 0x27, 0x86, 0xce, 0x29, 0x32, 0xd6, 0x5a, 0x5e, 0xb3};
81 FacerInterface::~FacerInterface()
93 case OPMODE_DISABLED:
return "OPMODE_DISABLED";
94 case OPMODE_DETECTION:
return "OPMODE_DETECTION";
95 case OPMODE_RECOGNITION:
return "OPMODE_RECOGNITION";
96 case OPMODE_LEARNING:
return "OPMODE_LEARNING";
97 default:
return "UNKNOWN";
132 data->opmode = new_opmode;
145 return data->num_identities;
167 data->num_identities = new_num_identities;
180 return data->recognized_identity;
202 data->recognized_identity = new_recognized_identity;
215 return data->recognized_name;
237 strncpy(data->recognized_name, new_recognized_name,
sizeof(data->recognized_name));
250 return data->num_detections;
272 data->num_detections = new_num_detections;
285 return data->num_recognitions;
307 data->num_recognitions = new_num_recognitions;
320 return data->most_likely_identity;
342 data->most_likely_identity = new_most_likely_identity;
356 return data->history_ratio;
379 data->history_ratio = new_history_ratio;
392 return data->sec_since_detection;
414 data->sec_since_detection = new_sec_since_detection;
428 return data->visibility_history;
451 data->visibility_history = new_visibility_history;
465 return data->learning_in_progress;
488 data->learning_in_progress = new_learning_in_progress;
501 return data->recording_progress;
523 data->recording_progress = new_recording_progress;
536 return data->bearing;
558 data->bearing = new_bearing;
593 data->slope = new_slope;
606 return data->requested_index;
628 data->requested_index = new_requested_index;
641 return data->requested_name;
663 strncpy(data->requested_name, new_requested_name,
sizeof(data->requested_name));
671 if ( strncmp(
"LearnFaceMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
673 }
else if ( strncmp(
"SetOpmodeMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
675 }
else if ( strncmp(
"EnableIdentityMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
677 }
else if ( strncmp(
"SetNameMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
679 }
else if ( strncmp(
"GetNameMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
683 "message type for this interface type.", type);
699 memcpy(data, oi->data,
sizeof(FacerInterface_data_t));
705 if (strcmp(enumtype,
"if_facer_opmode_t") == 0) {
724 data_size =
sizeof(LearnFaceMessage_data_t);
727 data = (LearnFaceMessage_data_t *)
data_ptr;
729 strncpy(data->name, ini_name, 64);
735 data_size =
sizeof(LearnFaceMessage_data_t);
738 data = (LearnFaceMessage_data_t *)
data_ptr;
757 data = (LearnFaceMessage_data_t *)
data_ptr;
789 strncpy(data->name, new_name,
sizeof(data->name));
814 data_size =
sizeof(SetOpmodeMessage_data_t);
817 data = (SetOpmodeMessage_data_t *)
data_ptr;
819 data->opmode = ini_opmode;
825 data_size =
sizeof(SetOpmodeMessage_data_t);
828 data = (SetOpmodeMessage_data_t *)
data_ptr;
847 data = (SetOpmodeMessage_data_t *)
data_ptr;
883 data->opmode = new_opmode;
909 data_size =
sizeof(EnableIdentityMessage_data_t);
912 data = (EnableIdentityMessage_data_t *)
data_ptr;
914 data->index = ini_index;
915 data->enable = ini_enable;
922 data_size =
sizeof(EnableIdentityMessage_data_t);
925 data = (EnableIdentityMessage_data_t *)
data_ptr;
945 data = (EnableIdentityMessage_data_t *)
data_ptr;
977 data->index = new_index;
1007 data->enable = new_enable;
1033 data_size =
sizeof(SetNameMessage_data_t);
1036 data = (SetNameMessage_data_t *)
data_ptr;
1038 data->index = ini_index;
1039 strncpy(data->name, ini_name, 64);
1046 data_size =
sizeof(SetNameMessage_data_t);
1049 data = (SetNameMessage_data_t *)
data_ptr;
1069 data = (SetNameMessage_data_t *)
data_ptr;
1101 data->index = new_index;
1131 strncpy(data->name, new_name,
sizeof(data->name));
1156 data_size =
sizeof(GetNameMessage_data_t);
1159 data = (GetNameMessage_data_t *)
data_ptr;
1161 data->index = ini_index;
1167 data_size =
sizeof(GetNameMessage_data_t);
1170 data = (GetNameMessage_data_t *)
data_ptr;
1189 data = (GetNameMessage_data_t *)
data_ptr;
1221 data->index = new_index;
uint32_t recognized_identity() const
Get recognized_identity value.
size_t maxlenof_slope() const
Get maximum length of slope value.
size_t maxlenof_index() const
Get maximum length of index value.
bool is_learning_in_progress() const
Get learning_in_progress value.
uint32_t index() const
Get index value.
void * data_ptr
Pointer to memory that contains local data.
float sec_since_detection() const
Get sec_since_detection value.
uint32_t num_recognitions() const
Get num_recognitions value.
char * recognized_name() const
Get recognized_name value.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
void set_most_likely_identity(const uint32_t new_most_likely_identity)
Set most_likely_identity value.
size_t maxlenof_requested_name() const
Get maximum length of requested_name value.
size_t maxlenof_name() const
Get maximum length of name value.
if_facer_opmode_t opmode() const
Get opmode value.
size_t maxlenof_name() const
Get maximum length of name value.
size_t maxlenof_enable() const
Get maximum length of enable value.
void set_enable(const bool new_enable)
Set enable value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
SetOpmodeMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_recording_progress() const
Get maximum length of recording_progress value.
size_t maxlenof_sec_since_detection() const
Get maximum length of sec_since_detection value.
void set_hash(unsigned char *ihash)
Set hash.
const char * type() const
Get message type.
SetNameMessage Fawkes BlackBoard Interface Message.
Fawkes library namespace.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
size_t maxlenof_most_likely_identity() const
Get maximum length of most_likely_identity value.
char * requested_name() const
Get requested_name value.
float slope() const
Get slope value.
if_facer_opmode_t opmode() const
Get opmode value.
size_t maxlenof_index() const
Get maximum length of index value.
size_t maxlenof_recognized_name() const
Get maximum length of recognized_name value.
void set_index(const uint32_t new_index)
Set index value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
~SetNameMessage()
Destructor.
SetNameMessage()
Constructor.
SetOpmodeMessage()
Constructor.
Base class for all Fawkes BlackBoard interfaces.
size_t maxlenof_learning_in_progress() const
Get maximum length of learning_in_progress value.
size_t maxlenof_opmode() const
Get maximum length of opmode value.
void set_num_identities(const uint32_t new_num_identities)
Set num_identities value.
float recording_progress() const
Get recording_progress value.
uint32_t index() const
Get index value.
~LearnFaceMessage()
Destructor.
GetNameMessage Fawkes BlackBoard Interface Message.
void set_sec_since_detection(const float new_sec_since_detection)
Set sec_since_detection value.
void set_slope(const float new_slope)
Set slope value.
size_t maxlenof_bearing() const
Get maximum length of bearing value.
void set_recognized_identity(const uint32_t new_recognized_identity)
Set recognized_identity value.
EnableIdentityMessage()
Constructor.
size_t maxlenof_visibility_history() const
Get maximum length of visibility_history value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
void set_visibility_history(const int32_t new_visibility_history)
Set visibility_history value.
unsigned int data_size
Size of memory needed to hold all data.
~EnableIdentityMessage()
Destructor.
size_t maxlenof_requested_index() const
Get maximum length of requested_index value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
bool data_changed
Indicator if data has changed.
float history_ratio() const
Get history_ratio value.
uint32_t most_likely_identity() const
Get most_likely_identity value.
char * name() const
Get name value.
const char * tostring_if_facer_opmode_t(if_facer_opmode_t value) const
Convert if_facer_opmode_t constant to string.
void set_name(const char *new_name)
Set name value.
size_t maxlenof_num_detections() const
Get maximum length of num_detections value.
float bearing() const
Get bearing value.
bool is_enable() const
Get enable value.
virtual Message * clone() const
Clone this message.
virtual Message * clone() const
Clone this message.
void set_opmode(const if_facer_opmode_t new_opmode)
Set opmode value.
virtual Message * clone() const
Clone this message.
uint32_t num_detections() const
Get num_detections value.
void set_num_detections(const uint32_t new_num_detections)
Set num_detections value.
uint32_t requested_index() const
Get requested_index value.
virtual Message * clone() const
Clone this message.
virtual Message * create_message(const char *type) const
Create message based on type name.
size_t maxlenof_recognized_identity() const
Get maximum length of recognized_identity value.
LearnFaceMessage Fawkes BlackBoard Interface Message.
void set_requested_name(const char *new_requested_name)
Set requested_name value.
size_t maxlenof_opmode() const
Get maximum length of opmode value.
size_t maxlenof_history_ratio() const
Get maximum length of history_ratio value.
size_t maxlenof_index() const
Get maximum length of index value.
void set_requested_index(const uint32_t new_requested_index)
Set requested_index value.
virtual Message * clone() const
Clone this message.
void set_opmode(const if_facer_opmode_t new_opmode)
Set opmode value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_bearing(const float new_bearing)
Set bearing value.
size_t maxlenof_num_identities() const
Get maximum length of num_identities value.
int32_t visibility_history() const
Get visibility_history value.
void set_num_recognitions(const uint32_t new_num_recognitions)
Set num_recognitions value.
FacerInterface Fawkes BlackBoard Interface.
void set_learning_in_progress(const bool new_learning_in_progress)
Set learning_in_progress value.
void set_recording_progress(const float new_recording_progress)
Set recording_progress value.
~SetOpmodeMessage()
Destructor.
uint32_t num_identities() const
Get num_identities 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.
uint32_t index() const
Get index value.
GetNameMessage()
Constructor.
void set_history_ratio(const float new_history_ratio)
Set history_ratio value.
LearnFaceMessage()
Constructor.
~GetNameMessage()
Destructor.
EnableIdentityMessage Fawkes BlackBoard Interface Message.
const char * type() const
Get type of interface.
void set_index(const uint32_t new_index)
Set index value.
char * name() const
Get name value.
if_facer_opmode_t
This determines the current status of skill execution.
size_t maxlenof_num_recognitions() const
Get maximum length of num_recognitions value.
32 bit unsigned integer field
field with interface specific enum type
void set_index(const uint32_t new_index)
Set index value.
void set_name(const char *new_name)
Set name value.
void set_recognized_name(const char *new_recognized_name)
Set recognized_name value.