NUGU SDK Linux  1.7.6
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 #include <nugu.h>
22 
23 namespace NuguCapability {
24 
25 using namespace NuguClientKit;
26 
38 #define NUGU_SERVER_RESPONSE_TIMEOUT_SEC 10
43 enum class TextState {
44  IDLE,
45  BUSY
46 };
47 
51 enum class TextError {
53 };
54 
58 typedef struct _TextAttribute {
61 
66 class NUGU_API ITextListener : virtual public ICapabilityListener {
67 public:
68  virtual ~ITextListener() = default;
69 
76  virtual void onState(TextState state, const std::string& dialog_id) = 0;
77 
82  virtual void onComplete(const std::string& dialog_id) = 0;
83 
89  virtual void onError(TextError error, const std::string& dialog_id) = 0;
90 
98  virtual bool handleTextCommand(const std::string& text, const std::string& token) = 0;
99 };
100 
105 class NUGU_API ITextHandler : virtual public ICapabilityInterface {
106 public:
107  virtual ~ITextHandler() = default;
108 
117  virtual std::string requestTextInput(const std::string& text, const std::string& token = "", const std::string& source = "", bool include_dialog_attribute = true) = 0;
118 
123  virtual void setAttribute(TextAttribute&& attribute) = 0;
124 };
125 
130 } // NuguCapability
131 
132 #endif /* __NUGU_TEXT_INTERFACE_H__ */
text handler interface
Definition: text_interface.hh:105
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:66
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:82
capability listener interface
Definition: capability_interface.hh:60
TextState
TextState.
Definition: text_interface.hh:43
TextError
TextError.
Definition: text_interface.hh:51
struct NuguCapability::_TextAttribute TextAttribute
Attributes for setting Text options.
Attributes for setting Text options.
Definition: text_interface.hh:58
int response_timeout
Definition: text_interface.hh:59