SpeechRecognitionInterface.h
00001 00002 /*************************************************************************** 00003 * SpeechRecognitionInterface.h - Fawkes BlackBoard Interface - SpeechRecognitionInterface 00004 * 00005 * Templated created: Thu Oct 12 10:49:19 2006 00006 * Copyright 2009 Tim Niemueller and Masrur Doostdar 00007 * 00008 ****************************************************************************/ 00009 00010 /* This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. A runtime exception applies to 00014 * this software (see LICENSE.GPL_WRE file mentioned below for details). 00015 * 00016 * This program is distributed in the hope that it will be useful, 00017 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00019 * GNU Library General Public License for more details. 00020 * 00021 * Read the full text in the LICENSE.GPL_WRE file in the doc directory. 00022 */ 00023 00024 #ifndef __INTERFACES_SPEECHRECOGNITIONINTERFACE_H_ 00025 #define __INTERFACES_SPEECHRECOGNITIONINTERFACE_H_ 00026 00027 #include <interface/interface.h> 00028 #include <interface/message.h> 00029 #include <interface/field_iterator.h> 00030 00031 namespace fawkes { 00032 00033 class SpeechRecognitionInterface : public Interface 00034 { 00035 /// @cond INTERNALS 00036 INTERFACE_MGMT_FRIENDS(SpeechRecognitionInterface) 00037 /// @endcond 00038 public: 00039 /* constants */ 00040 00041 private: 00042 /** Internal data storage, do NOT modify! */ 00043 typedef struct { 00044 unsigned int counter; /**< 00045 Counter for messages. Increased after each new recognized string. 00046 */ 00047 bool processing; /**< 00048 True, if the the speech recognition is currently processing. 00049 */ 00050 bool enabled; /**< 00051 True, if speech processing is currently enabled, false otherwise. 00052 */ 00053 char text[1024]; /**< 00054 Last spoken string. Must be properly null-terminated. 00055 */ 00056 } SpeechRecognitionInterface_data_t; 00057 00058 SpeechRecognitionInterface_data_t *data; 00059 00060 public: 00061 /* messages */ 00062 class ResetMessage : public Message 00063 { 00064 public: 00065 ResetMessage(); 00066 ~ResetMessage(); 00067 00068 ResetMessage(const ResetMessage *m); 00069 /* Methods */ 00070 virtual Message * clone() const; 00071 }; 00072 00073 class SetEnabledMessage : public Message 00074 { 00075 private: 00076 /** Internal data storage, do NOT modify! */ 00077 typedef struct { 00078 bool enabled; /**< 00079 True, if speech processing is currently enabled, false otherwise. 00080 */ 00081 } SetEnabledMessage_data_t; 00082 00083 SetEnabledMessage_data_t *data; 00084 00085 public: 00086 SetEnabledMessage(const bool ini_enabled); 00087 SetEnabledMessage(); 00088 ~SetEnabledMessage(); 00089 00090 SetEnabledMessage(const SetEnabledMessage *m); 00091 /* Methods */ 00092 bool is_enabled() const; 00093 void set_enabled(const bool new_enabled); 00094 size_t maxlenof_enabled() const; 00095 virtual Message * clone() const; 00096 }; 00097 00098 virtual bool message_valid(const Message *message) const; 00099 private: 00100 SpeechRecognitionInterface(); 00101 ~SpeechRecognitionInterface(); 00102 00103 public: 00104 /* Methods */ 00105 char * text() const; 00106 void set_text(const char * new_text); 00107 size_t maxlenof_text() const; 00108 unsigned int counter() const; 00109 void set_counter(const unsigned int new_counter); 00110 size_t maxlenof_counter() const; 00111 bool is_processing() const; 00112 void set_processing(const bool new_processing); 00113 size_t maxlenof_processing() const; 00114 bool is_enabled() const; 00115 void set_enabled(const bool new_enabled); 00116 size_t maxlenof_enabled() const; 00117 virtual Message * create_message(const char *type) const; 00118 00119 virtual void copy_values(const Interface *other); 00120 00121 }; 00122 00123 } // end namespace fawkes 00124 00125 #endif

