24 #include <interfaces/SpeechSynthInterface.h>
26 #include <core/exceptions/software.h>
49 SpeechSynthInterface::SpeechSynthInterface() : Interface()
51 data_size =
sizeof(SpeechSynthInterface_data_t);
52 data_ptr = malloc(data_size);
53 data = (SpeechSynthInterface_data_t *)data_ptr;
54 data_ts = (interface_data_ts_t *)data_ptr;
55 memset(data_ptr, 0, data_size);
56 add_fieldinfo(IFT_STRING,
"text", 1024, data->text);
57 add_fieldinfo(IFT_UINT32,
"msgid", 1, &data->msgid);
58 add_fieldinfo(IFT_BOOL,
"final", 1, &data->final);
59 add_fieldinfo(IFT_FLOAT,
"duration", 1, &data->duration);
60 add_messageinfo(
"SayMessage");
61 unsigned char tmp_hash[] = {0x28, 0x11, 0x46, 0x87, 0xb1, 0x65, 0x92, 0x96, 0xe6, 0x6e, 0x18, 0x8a, 0xdc, 0x8, 0xb0, 0x69};
66 SpeechSynthInterface::~SpeechSynthInterface()
78 SpeechSynthInterface::text()
const
88 SpeechSynthInterface::maxlenof_text()
const
100 SpeechSynthInterface::set_text(
const char * new_text)
113 SpeechSynthInterface::msgid()
const
123 SpeechSynthInterface::maxlenof_msgid()
const
136 SpeechSynthInterface::set_msgid(
const uint32_t new_msgid)
148 SpeechSynthInterface::is_final()
const
158 SpeechSynthInterface::maxlenof_final()
const
170 SpeechSynthInterface::set_final(
const bool new_final)
184 SpeechSynthInterface::duration()
const
186 return data->duration;
194 SpeechSynthInterface::maxlenof_duration()
const
208 SpeechSynthInterface::set_duration(
const float new_duration)
210 data_changed |=
change_field(data->duration, new_duration);
215 SpeechSynthInterface::create_message(
const char *type)
const
217 if ( strncmp(
"SayMessage", type, INTERFACE_MESSAGE_TYPE_SIZE_ - 1) == 0 ) {
221 "message type for this interface type.", type);
230 SpeechSynthInterface::copy_values(
const Interface *other)
235 type(), other->
type());
237 memcpy(data, oi->data,
sizeof(SpeechSynthInterface_data_t));
241 SpeechSynthInterface::enum_tostring(
const char *enumtype,
int val)
const
257 SpeechSynthInterface::SayMessage::SayMessage(
const char * ini_text) :
Message(
"SayMessage")
262 data = (SayMessage_data_t *)
data_ptr;
264 strncpy(data->text, ini_text, 1024-1);
265 data->text[1024-1] = 0;
274 data = (SayMessage_data_t *)
data_ptr;
293 data = (SayMessage_data_t *)
data_ptr;
Base class for all Fawkes BlackBoard interfaces.
const char * type() const
Get type of interface.
void * data_ptr
Pointer to local memory storage.
Base class for all messages passed through interfaces in Fawkes BlackBoard.
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.
void * data_ptr
Pointer to memory that contains local data.
message_data_ts_t * data_ts
data timestamp aliasing pointer
unsigned int data_size
Size of memory needed to hold all data.
SayMessage Fawkes BlackBoard Interface Message.
char * text() const
Get text value.
size_t maxlenof_text() const
Get maximum length of text value.
void set_text(const char *new_text)
Set text value.
virtual Message * clone() const
Clone this message.
SpeechSynthInterface Fawkes BlackBoard Interface.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
Fawkes library namespace.
bool change_field(FieldT &field, const DataT &value)
Set a field and return whether it changed.
Timestamp data, must be present and first entries for each interface data structs!...