Fawkes API Fawkes Development Version
SpeechRecognitionInterface.h
1
2/***************************************************************************
3 * SpeechRecognitionInterface.h - Fawkes BlackBoard Interface - SpeechRecognitionInterface
4 *
5 * Templated created: Thu Oct 12 10:49:19 2006
6 * Copyright 2009 Tim Niemueller and Masrur Doostdar
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#ifndef _INTERFACES_SPEECHRECOGNITIONINTERFACE_H_
25#define _INTERFACES_SPEECHRECOGNITIONINTERFACE_H_
26
27#include <interface/interface.h>
28#include <interface/message.h>
29#include <interface/field_iterator.h>
30
31namespace fawkes {
32
34{
35 /// @cond INTERNALS
36 INTERFACE_MGMT_FRIENDS(SpeechRecognitionInterface)
37 /// @endcond
38 public:
39 /* constants */
40
41 private:
42 /** Internal data storage, do NOT modify! */
43 typedef struct {
44 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
45 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
46 char text[1024]; /**<
47 Last spoken string. Must be properly null-terminated.
48 */
49 uint32_t counter; /**<
50 Counter for messages. Increased after each new recognized string.
51 */
52 bool processing; /**<
53 True, if the the speech recognition is currently processing.
54 */
55 bool enabled; /**<
56 True, if speech processing is currently enabled, false otherwise.
57 */
58 } SpeechRecognitionInterface_data_t;
59
60 SpeechRecognitionInterface_data_t *data;
61
62 public:
63 /* messages */
64 class ResetMessage : public Message
65 {
66 private:
67 /** Internal data storage, do NOT modify! */
68 typedef struct {
69 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
70 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
71 } ResetMessage_data_t;
72
73 ResetMessage_data_t *data;
74
75 public:
78
79 explicit ResetMessage(const ResetMessage *m);
80 /* Methods */
81 virtual Message * clone() const;
82 };
83
85 {
86 private:
87 /** Internal data storage, do NOT modify! */
88 typedef struct {
89 int64_t timestamp_sec; /**< Interface Unix timestamp, seconds */
90 int64_t timestamp_usec; /**< Interface Unix timestamp, micro-seconds */
91 bool enabled; /**<
92 True, if speech processing is currently enabled, false otherwise.
93 */
94 } SetEnabledMessage_data_t;
95
96 SetEnabledMessage_data_t *data;
97
98 public:
99 SetEnabledMessage(const bool ini_enabled);
102
103 explicit SetEnabledMessage(const SetEnabledMessage *m);
104 /* Methods */
105 bool is_enabled() const;
106 void set_enabled(const bool new_enabled);
107 size_t maxlenof_enabled() const;
108 virtual Message * clone() const;
109 };
110
111 virtual bool message_valid(const Message *message) const;
112 private:
115
116 public:
117 /* Methods */
118 char * text() const;
119 void set_text(const char * new_text);
120 size_t maxlenof_text() const;
121 uint32_t counter() const;
122 void set_counter(const uint32_t new_counter);
123 size_t maxlenof_counter() const;
124 bool is_processing() const;
125 void set_processing(const bool new_processing);
126 size_t maxlenof_processing() const;
127 bool is_enabled() const;
128 void set_enabled(const bool new_enabled);
129 size_t maxlenof_enabled() const;
130 virtual Message * create_message(const char *type) const;
131
132 virtual void copy_values(const Interface *other);
133 virtual const char * enum_tostring(const char *enumtype, int val) const;
134
135};
136
137} // end namespace fawkes
138
139#endif
Base class for all Fawkes BlackBoard interfaces.
Definition: interface.h:80
const char * type() const
Get type of interface.
Definition: interface.cpp:652
Base class for all messages passed through interfaces in Fawkes BlackBoard.
Definition: message.h:44
ResetMessage Fawkes BlackBoard Interface Message.
virtual Message * clone() const
Clone this message.
SetEnabledMessage Fawkes BlackBoard Interface Message.
size_t maxlenof_enabled() const
Get maximum length of enabled value.
void set_enabled(const bool new_enabled)
Set enabled value.
SpeechRecognitionInterface Fawkes BlackBoard Interface.
size_t maxlenof_processing() const
Get maximum length of processing value.
void set_text(const char *new_text)
Set text value.
virtual void copy_values(const Interface *other)
Copy values from other interface.
void set_processing(const bool new_processing)
Set processing value.
uint32_t counter() const
Get counter value.
size_t maxlenof_counter() const
Get maximum length of counter value.
virtual Message * create_message(const char *type) const
Create message based on type name.
bool is_processing() const
Get processing value.
virtual bool message_valid(const Message *message) const
Check if message is valid and can be enqueued.
void set_counter(const uint32_t new_counter)
Set counter value.
size_t maxlenof_enabled() const
Get maximum length of enabled value.
size_t maxlenof_text() const
Get maximum length of text value.
virtual const char * enum_tostring(const char *enumtype, int val) const
Convert arbitrary enum value to string.
void set_enabled(const bool new_enabled)
Set enabled value.
Fawkes library namespace.