NUGU SDK Linux  1.7.5
speech_recognizer_interface.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019 SK Telecom Co., Ltd. All rights reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef __NUGU_SPEECH_RECOGNIZER_INTERFACE_H__
18 #define __NUGU_SPEECH_RECOGNIZER_INTERFACE_H__
19 
20 #include <string>
21 
22 namespace NuguClientKit {
23 
38 enum class ListeningState {
39  READY,
40  LISTENING,
41  SPEECH_START,
42  SPEECH_END,
43  TIMEOUT,
44  FAILED,
45  DONE
46 };
47 
51 typedef struct _EpdAttribute {
56 
62 public:
63  virtual ~ISpeechRecognizerListener() = default;
64 
70  virtual void onListeningState(ListeningState state, const std::string& id) = 0;
71 
78  virtual void onRecordData(unsigned char* buf, int length, bool is_end) = 0;
79 };
80 
86 public:
87  virtual ~ISpeechRecognizer() = default;
88 
93  virtual void setListener(ISpeechRecognizerListener* listener) = 0;
94 
100  virtual bool startListening(const std::string& id) = 0;
101 
105  virtual void stopListening() = 0;
106 
111  virtual void setEpdAttribute(const EpdAttribute& attribute) = 0;
112 
118 
123  virtual bool isMute() = 0;
124 
129  virtual std::string getCodec() = 0;
130 
135  virtual std::string getMimeType() = 0;
136 };
137 
142 } //NuguClientKit
143 
144 #endif /* __NUGU_SPEECH_RECOGNIZER_INTERFACE_H__*/
SpeechRecognizer listener interface.
Definition: speech_recognizer_interface.hh:61
virtual void onRecordData(unsigned char *buf, int length, bool is_end)=0
Get current audio input stream.
virtual void onListeningState(ListeningState state, const std::string &id)=0
Report to the user listening state changed.
SpeechRecognizer interface.
Definition: speech_recognizer_interface.hh:85
virtual void setListener(ISpeechRecognizerListener *listener)=0
Set SpeechRecognizer listener object.
virtual void setEpdAttribute(const EpdAttribute &attribute)=0
Set EPD attribute.
virtual void stopListening()=0
Stop listening speech.
virtual bool startListening(const std::string &id)=0
Start listening speech.
virtual std::string getCodec()=0
Get codec information of recorder.
virtual bool isMute()=0
Get audio recorder's mute.
virtual std::string getMimeType()=0
Get mime type information of recorder.
virtual EpdAttribute getEpdAttribute()=0
Get EPD attribute.
struct NuguClientKit::_EpdAttribute EpdAttribute
Attributes about epd.
ListeningState
ListeningState.
Definition: speech_recognizer_interface.hh:38
Attributes about epd.
Definition: speech_recognizer_interface.hh:51
long epd_pause_length
Definition: speech_recognizer_interface.hh:54
int epd_max_duration
Definition: speech_recognizer_interface.hh:53
int epd_timeout
Definition: speech_recognizer_interface.hh:52