NUGU SDK Linux  1.7.5
display_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_DISPLAY_INTERFACE_H__
18 #define __NUGU_DISPLAY_INTERFACE_H__
19 
21 
22 namespace NuguCapability {
23 
24 using namespace NuguClientKit;
25 
38 enum class ControlDirection {
39  PREVIOUS,
40  NEXT
41 };
42 
43 enum class ControlType {
44  Focus,
45  Scroll,
46 };
47 
48 enum class TemplateControlType {
51 };
52 
56 typedef struct _DisplayContextInfo {
57  std::string focused_item_token;
58  std::vector<std::string> visible_token_list;
60 
65 class IDisplayListener : virtual public ICapabilityListener {
66 public:
67  virtual ~IDisplayListener() = default;
75  virtual void renderDisplay(const std::string& id, const std::string& type, const std::string& json_payload, const std::string& dialog_id) = 0;
76 
84  virtual bool clearDisplay(const std::string& id, bool unconditionally, bool has_next) = 0;
85 
92  virtual void controlDisplay(const std::string& id, ControlType type, ControlDirection direction) = 0;
93 
99  virtual void updateDisplay(const std::string& id, const std::string& json_payload) = 0;
100 };
101 
106 class IDisplayHandler : virtual public ICapabilityInterface {
107 public:
108  virtual ~IDisplayHandler() = default;
109 
115  virtual void displayRendered(const std::string& id, const DisplayContextInfo& context_info = DisplayContextInfo {});
116 
121  virtual void displayCleared(const std::string& id);
122 
129  virtual void elementSelected(const std::string& id, const std::string& item_token, const std::string& postback = "");
130 
136  virtual void triggerChild(const std::string& ps_id, const std::string& data);
137 
143  virtual void controlTemplate(const std::string& id, TemplateControlType control_type);
144 
152  virtual void informControlResult(const std::string& id, ControlType type, ControlDirection direction, bool result);
153 
158  virtual void setDisplayListener(IDisplayListener* listener);
159 
163  virtual void removeDisplayListener(IDisplayListener* listener);
164 
169  virtual void stopRenderingTimer(const std::string& id);
170 
175  virtual void refreshRenderingTimer(const std::string& id);
176 };
177 
182 } // NuguCapability
183 
184 #endif /* __NUGU_DISPLAY_INTERFACE_H__ */
display handler interface
Definition: display_interface.hh:106
virtual void displayCleared(const std::string &id)
The user reports that the display is cleared.
virtual void setDisplayListener(IDisplayListener *listener)
Set the IDisplayListener object.
virtual void displayRendered(const std::string &id, const DisplayContextInfo &context_info=DisplayContextInfo {})
The user reports that the display was rendered.
virtual void controlTemplate(const std::string &id, TemplateControlType control_type)
Control templates which are composed by history control.
virtual void triggerChild(const std::string &ps_id, const std::string &data)
Send TriggerChild event for receiving child template.
virtual void removeDisplayListener(IDisplayListener *listener)
Remove the IDisplayListener object.
virtual void stopRenderingTimer(const std::string &id)
Stop display rendering hold timer.
virtual void elementSelected(const std::string &id, const std::string &item_token, const std::string &postback="")
The user informs the selected item of the list and reports the token information of the item.
virtual void informControlResult(const std::string &id, ControlType type, ControlDirection direction, bool result)
The user informs the control result.
virtual void refreshRenderingTimer(const std::string &id)
Refresh display rendering hold timer.
display listener interface
Definition: display_interface.hh:65
virtual void updateDisplay(const std::string &id, const std::string &json_payload)=0
Request to update the current display.
virtual void renderDisplay(const std::string &id, const std::string &type, const std::string &json_payload, const std::string &dialog_id)=0
Request rendering by passing metadata so that the device with the display can draw on the screen.
virtual void controlDisplay(const std::string &id, ControlType type, ControlDirection direction)=0
Request to control the display with type and direction.
virtual bool clearDisplay(const std::string &id, bool unconditionally, bool has_next)=0
The SDK will ask you to delete the rendered display on the display according to the service context m...
capability interface
Definition: capability_interface.hh:81
capability listener interface
Definition: capability_interface.hh:59
ControlType
Definition: display_interface.hh:43
TemplateControlType
Definition: display_interface.hh:48
ControlDirection
Definition: display_interface.hh:38
struct NuguCapability::_DisplayContextInfo DisplayContextInfo
Display Context Information.
Display Context Information.
Definition: display_interface.hh:56
std::vector< std::string > visible_token_list
Definition: display_interface.hh:58
std::string focused_item_token
Definition: display_interface.hh:57