24 #include <interfaces/TestInterface.h>
26 #include <core/exceptions/software.h>
47 TestInterface::TestInterface() : Interface()
51 data = (TestInterface_data_t *)
data_ptr;
63 unsigned char tmp_hash[] = {0xe4, 0xe2, 0x1, 0xa9, 0xc8, 0x87, 0x8d, 0x3d, 0xa3, 0xab, 0xc9, 0xcd, 0xf3, 0xf, 0x5a, 0x33};
68 TestInterface::~TestInterface()
80 case TEST_ENUM_1:
return "TEST_ENUM_1";
81 case TEST_ENUM_2:
return "TEST_ENUM_2";
82 default:
return "UNKNOWN";
93 return data->test_bool;
113 data->test_bool = new_test_bool;
124 return data->test_int;
144 data->test_int = new_test_int;
175 data->flags = new_flags;
186 return data->test_string;
206 strncpy(data->test_string, new_test_string,
sizeof(data->test_string));
237 data->result = new_result;
248 return data->test_uint;
268 data->test_uint = new_test_uint;
276 if ( strncmp(
"SetTestIntMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
278 }
else if ( strncmp(
"SetTestStringMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
280 }
else if ( strncmp(
"CalculateMessage", type, __INTERFACE_MESSAGE_TYPE_SIZE) == 0 ) {
284 "message type for this interface type.", type);
300 memcpy(data, oi->data,
sizeof(TestInterface_data_t));
306 if (strcmp(enumtype,
"TestEnum") == 0) {
307 return tostring_TestEnum((
TestEnum)val);
325 data_size =
sizeof(SetTestIntMessage_data_t);
328 data = (SetTestIntMessage_data_t *)
data_ptr;
330 data->test_int = ini_test_int;
336 data_size =
sizeof(SetTestIntMessage_data_t);
339 data = (SetTestIntMessage_data_t *)
data_ptr;
358 data = (SetTestIntMessage_data_t *)
data_ptr;
370 return data->test_int;
390 data->test_int = new_test_int;
415 data_size =
sizeof(SetTestStringMessage_data_t);
418 data = (SetTestStringMessage_data_t *)
data_ptr;
420 strncpy(data->test_string, ini_test_string, 30);
426 data_size =
sizeof(SetTestStringMessage_data_t);
429 data = (SetTestStringMessage_data_t *)
data_ptr;
448 data = (SetTestStringMessage_data_t *)
data_ptr;
460 return data->test_string;
480 strncpy(data->test_string, new_test_string,
sizeof(data->test_string));
506 data_size =
sizeof(CalculateMessage_data_t);
509 data = (CalculateMessage_data_t *)
data_ptr;
511 data->summand = ini_summand;
512 data->addend = ini_addend;
519 data_size =
sizeof(CalculateMessage_data_t);
522 data = (CalculateMessage_data_t *)
data_ptr;
542 data = (CalculateMessage_data_t *)
data_ptr;
554 return data->summand;
574 data->summand = new_summand;
604 data->addend = new_addend;
size_t maxlenof_result() const
Get maximum length of result value.
void set_test_string(const char *new_test_string)
Set test_string value.
void * data_ptr
Pointer to memory that contains local data.
const char * tostring_TestEnum(TestEnum value) const
Convert TestEnum constant to string.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
size_t maxlenof_test_int() const
Get maximum length of test_int value.
TestEnum
Demonstrating enums.
void set_hash(unsigned char *ihash)
Set hash.
float value() const
Get value value.
Timestamp data, must be present and first entries for each interface data structs! This leans on time...
size_t maxlenof_test_string() const
Get maximum length of test_string value.
uint32_t test_uint() const
Get test_uint value.
char * test_string() const
Get test_string value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
~CalculateMessage()
Destructor.
byte field, alias for uint8
virtual Message * create_message(const char *type) const
Create message based on type name.
Base class for all Fawkes BlackBoard interfaces.
size_t maxlenof_addend() const
Get maximum length of addend value.
virtual Message * clone() const
Clone this message.
size_t maxlenof_summand() const
Get maximum length of summand value.
void set_summand(const int32_t new_summand)
Set summand value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
~SetTestStringMessage()
Destructor.
char * test_string() const
Get test_string value.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
int32_t test_int() const
Get test_int value.
void set_test_int(const int32_t new_test_int)
Set test_int value.
void add_messageinfo(const char *name)
Add an entry to the message info list.
bool data_changed
Indicator if data has changed.
static const int32_t TEST_CONSTANT
TEST_CONSTANT constant.
void * data_ptr
Pointer to local memory storage.
size_t maxlenof_flags() const
Get maximum length of flags value.
int32_t test_int() const
Get test_int value.
bool is_test_bool() const
Get test_bool value.
int32_t result() const
Get result value.
void set_addend(const int32_t new_addend)
Set addend value.
void set_test_bool(const bool new_test_bool)
Set test_bool value.
virtual Message * clone() const
Clone this message.
CalculateMessage Fawkes BlackBoard Interface Message.
void set_flags(const uint8_t new_flags)
Set flags value.
SetTestIntMessage Fawkes BlackBoard Interface Message.
void set_test_uint(const uint32_t new_test_uint)
Set test_uint value.
void set_test_string(const char *new_test_string)
Set test_string value.
SetTestIntMessage()
Constructor.
virtual Message * clone() const
Clone this message.
uint8_t flags() const
Get flags value.
size_t maxlenof_test_int() const
Get maximum length of test_int value.
~SetTestIntMessage()
Destructor.
size_t maxlenof_test_uint() const
Get maximum length of test_uint value.
SetTestStringMessage()
Constructor.
size_t maxlenof_test_bool() const
Get maximum length of test_bool 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.
int32_t addend() const
Get addend value.
static const float TEST_FLOAT_CONSTANT
TEST_FLOAT_CONSTANT constant.
int32_t summand() const
Get summand value.
SetTestStringMessage Fawkes BlackBoard Interface Message.
void set_result(const int32_t new_result)
Set result value.
void set_test_int(const int32_t new_test_int)
Set test_int value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
const char * type() const
Get type of interface.
size_t maxlenof_test_string() const
Get maximum length of test_string value.
32 bit unsigned integer field
CalculateMessage()
Constructor.
TestInterface Fawkes BlackBoard Interface.