NUGU SDK Linux  1.7.6
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 #include <nugu.h>
22 
23 namespace NuguCapability {
24 
25 using namespace NuguClientKit;
26 
39 enum class ControlDirection {
40  PREVIOUS,
41  NEXT
42 };
43 
44 enum class ControlType {
45  Focus,
46  Scroll,
47 };
48 
49 enum class TemplateControlType {
52 };
53 
57 typedef struct _DisplayContextInfo {
58  std::string focused_item_token;
59  std::vector<std::string> visible_token_list;
61 
66 class NUGU_API IDisplayListener : virtual public ICapabilityListener {
67 public:
68  virtual ~IDisplayListener() = default;
76  virtual void renderDisplay(const std::string& id, const std::string& type, const std::string& json_payload, const std::string& dialog_id) = 0;
77 
85  virtual bool clearDisplay(const std::string& id, bool unconditionally, bool has_next) = 0;
86 
93  virtual void controlDisplay(const std::string& id, ControlType type, ControlDirection direction) = 0;
94 
100  virtual void updateDisplay(const std::string& id, const std::string& json_payload) = 0;
101 };
102 
107 class NUGU_API IDisplayHandler : virtual public ICapabilityInterface {
108 public:
109  virtual ~IDisplayHandler() = default;
110 
116  virtual void displayRendered(const std::string& id, const DisplayContextInfo& context_info = DisplayContextInfo {});
117 
122  virtual void displayCleared(const std::string& id);
123 
130  virtual void elementSelected(const std::string& id, const std::string& item_token, const std::string& postback = "");
131 
137  virtual void triggerChild(const std::string& ps_id, const std::string& data);
138 
144  virtual void controlTemplate(const std::string& id, TemplateControlType control_type);
145 
153  virtual void informControlResult(const std::string& id, ControlType type, ControlDirection direction, bool result);
154 
159  virtual void setDisplayListener(IDisplayListener* listener);
160 
164  virtual void removeDisplayListener(IDisplayListener* listener);
165 
170  virtual void stopRenderingTimer(const std::string& id);
171 
176  virtual void refreshRenderingTimer(const std::string& id);
177 };
178 
183 } // NuguCapability
184 
185 #endif /* __NUGU_DISPLAY_INTERFACE_H__ */
display handler interface
Definition: display_interface.hh:107
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:66
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:82
capability listener interface
Definition: capability_interface.hh:60
ControlType
Definition: display_interface.hh:44
TemplateControlType
Definition: display_interface.hh:49
ControlDirection
Definition: display_interface.hh:39
struct NuguCapability::_DisplayContextInfo DisplayContextInfo
Display Context Information.
Display Context Information.
Definition: display_interface.hh:57
std::vector< std::string > visible_token_list
Definition: display_interface.hh:59
std::string focused_item_token
Definition: display_interface.hh:58