NUGU SDK Linux  1.7.5
text_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_TEXT_INTERFACE_H__
18 #define __NUGU_TEXT_INTERFACE_H__
19 
21 
22 namespace NuguCapability {
23 
24 using namespace NuguClientKit;
25 
37 #define NUGU_SERVER_RESPONSE_TIMEOUT_SEC 10
42 enum class TextState {
43  IDLE,
44  BUSY
45 };
46 
50 enum class TextError {
52 };
53 
57 typedef struct _TextAttribute {
60 
65 class ITextListener : virtual public ICapabilityListener {
66 public:
67  virtual ~ITextListener() = default;
68 
75  virtual void onState(TextState state, const std::string& dialog_id) = 0;
76 
81  virtual void onComplete(const std::string& dialog_id) = 0;
82 
88  virtual void onError(TextError error, const std::string& dialog_id) = 0;
89 
97  virtual bool handleTextCommand(const std::string& text, const std::string& token) = 0;
98 };
99 
104 class ITextHandler : virtual public ICapabilityInterface {
105 public:
106  virtual ~ITextHandler() = default;
107 
116  virtual std::string requestTextInput(const std::string& text, const std::string& token = "", const std::string& source = "", bool include_dialog_attribute = true) = 0;
117 
122  virtual void setAttribute(TextAttribute&& attribute) = 0;
123 };
124 
129 } // NuguCapability
130 
131 #endif /* __NUGU_TEXT_INTERFACE_H__ */
text handler interface
Definition: text_interface.hh:104
virtual void setAttribute(TextAttribute &&attribute)=0
Set attribute about response.
virtual std::string requestTextInput(const std::string &text, const std::string &token="", const std::string &source="", bool include_dialog_attribute=true)=0
Request NUGU services based on text input.
text listener interface
Definition: text_interface.hh:65
virtual void onState(TextState state, const std::string &dialog_id)=0
TextState changed.
virtual void onError(TextError error, const std::string &dialog_id)=0
An error occurred during requesting text input.
virtual bool handleTextCommand(const std::string &text, const std::string &token)=0
Handle text command and return whether consumed.
virtual void onComplete(const std::string &dialog_id)=0
When server processing for text input requests is completed.
capability interface
Definition: capability_interface.hh:81
capability listener interface
Definition: capability_interface.hh:59
TextState
TextState.
Definition: text_interface.hh:42
TextError
TextError.
Definition: text_interface.hh:50
struct NuguCapability::_TextAttribute TextAttribute
Attributes for setting Text options.
Attributes for setting Text options.
Definition: text_interface.hh:57
int response_timeout
Definition: text_interface.hh:58