You.i Engine
YiCloudInterface.h
Go to the documentation of this file.
1 // © You i Labs Inc. All rights reserved.
2 #ifndef _YI_CLOUD_INTERFACE_H_
3 #define _YI_CLOUD_INTERFACE_H_
4 
6 #include "cloud/iap/YiCloudIAP.h"
10 
12 #include <utility/YiBundle.h>
15 #include <utility/YiString.h>
16 
17 #include <map>
18 #include <set>
19 
20 class CYIAny;
21 class CYIApp;
22 class CYICloudInterfaceManager;
23 class CYIListView;
24 class CYIScrollingView;
25 class CYISceneManager;
26 class CYISceneNode;
27 class CYISceneView;
29 
31 {
35 
37 };
38 
39 using CYIClientCallback = std::function<void(bool, CYIBundle)>;
40 
52 {
53  friend class CYICloudInterfaceManager;
54  friend class CYICloudContext;
55 
56 public:
57  enum class InterfaceType
58  {
59  NULL_INTERFACE,
60  ROKU_INTERFACE,
61  WEB_INTERFACE
62  };
63 
65  {
66  SERVER,
67  CLOSEST,
68  PREVIOUS_ITEM
69  };
70 
72  {
73  SERVER,
74  CLOSEST,
75  CLOSEST_TO_LIST
76  };
77 
78  CYICloudInterface() = default;
79  virtual ~CYICloudInterface(){};
80 
84  virtual bool IsCloudServer() = 0;
85 
89  virtual bool IsUsingNullRenderer() const = 0;
90 
94  virtual bool SendFocusMap(CYISceneManager *pSceneManager = nullptr) = 0;
95 
99  virtual bool SetExportHint(CYISceneNode *pNode, const CYIString &hintName, const CYIString &value) = 0;
100 
106  virtual void SetIncomingFocusStyle(CYIListView *pList, ListIncomingFocusStyle focusStyle) = 0;
107 
113  virtual void SetOutgoingFocusStyle(CYIListView *pList, ListOutgoingFocusStyle focusStyle) = 0;
114 
123  virtual void SetInitalScrollIndexWithFocus(CYIListView *pList, uint32_t index) = 0;
124 
129  virtual bool SetVideoNodeProperties(const CYIBundle &properties) = 0;
130 
136  virtual bool SetVideoSurfaceProperties(const CYIBundle &properties, CYIVideoSurfaceView *pVideoSurfaceView = nullptr) = 0;
137 
142  virtual const CYIClientPlayer::PlaybackSessionInfo &GetLastPlaybackSessionInfo() const = 0;
143 
147  virtual void SetFocusOnSceneNode(const CYISceneNode *pNode) = 0;
148 
152  virtual void ClearClientFocus() = 0;
153 
160  virtual void InvokeCommand(const CYIString cmd, const CYIBundle &args = CYIBundle(), CYIClientCallback callback = nullptr) = 0;
161 
165  virtual bool IsLowEndDevice() = 0;
166 
170  virtual const CYIString &GetClientExternalIp() const = 0;
171 
176  virtual const CYIString &GetClientLocalIp() const = 0;
177 
181  virtual const glm::vec2 GetClientUIResolution() const = 0;
182 
186  virtual void TerminateApplication() = 0;
187 
192  virtual void SetDisconnectOnInactivityEnabled(bool enabled) = 0;
193 
198  virtual void ShowWaitSpinnerNow() = 0;
199 
204  virtual void SetSpinnerDelayMs(uint32_t delayMs) = 0;
205 
210  virtual void ShowWaitSpinner() = 0;
211 
215  virtual void SetWaitSpinnerAccessibilityAttributes(CYIAccessibilityAttributes::Accessible accessible, std::unique_ptr<const CYIAccessibilityAttributes> pAccessibilityAttributes = nullptr) = 0;
216 
220  virtual void HideWaitSpinner() = 0;
221 
229  virtual void AddModalScene(const CYIString &name, const CYISceneNode *pSceneNode, int32_t layerIndex = 0, std::set<CYIString> associatedScenes = std::set<CYIString>()) = 0;
230 
234  virtual void RemoveModalScene(const CYIString &name) = 0;
235 
239  virtual void SendScrollToNode(const CYIScrollingView *pScrollingView, const CYISceneNode *pNode) = 0;
240 
244  virtual void SendScrollingTextViewUpdate(const CYISceneNode *pScrollingTextView, const CYIString &text, const CYIString &title) = 0;
245 
250  virtual void SetDefaultCloudKeyboardTitle(const CYIString &title) = 0;
251 
256  virtual const CYIString &GetDefaultCloudKeyboardTitle() const = 0;
257 
261  virtual uint64_t RegisterDataListener(CYIString eventId, std::function<bool(CYIString eventId, const yi::rapidjson::Document *pEvent)> dataFunction) = 0;
262 
266  virtual void UnregisterDataListener(CYIString eventId, uint64_t listenerId) = 0;
267 
276  virtual void RegisterPersistentStore(const CYIString &name, CYIPersistentStore *pStore) = 0;
277 
280  virtual void UnregisterPersistentStore(CYIPersistentStore *pStore) = 0;
281 
284  virtual void SendRokuAnalyticsEvent(const CYIString &eventName, const CYIString &parameters) = 0;
285 
292  virtual void GetIAPCustomerUID(std::function<void(const CloudIAPRequestStatus &status, const CloudIAPCustomerUID &customerUID)> responder) = 0;
293 
297  virtual void GetChannelCredentials(std::function<void(const CloudIAPRequestStatus &status, const CloudIAPChannelCredentials &channelCredentials)> responder) = 0;
298 
305  virtual void SaveChannelCredentials(const CYIString &credentials, std::function<void(const CloudIAPRequestStatus &status)> responder) = 0;
306 
310  virtual void GetIAPUser(std::function<void(const CloudIAPRequestStatus &status, const CloudIAPUser &iapUser)> responder) = 0;
311 
315  virtual void GetAvailableProducts(std::function<void(const CloudIAPRequestStatus &status, const std::vector<std::shared_ptr<CloudIAPProduct>> &products)> responder) = 0;
316 
320  virtual void GetUserPurchases(std::function<void(const CloudIAPRequestStatus &status, const std::vector<std::shared_ptr<CloudIAPPurchase>> &purchases)> responder) = 0;
321 
325  virtual void RequestPurchase(const CYIString &productId, std::function<void(const CloudIAPRequestStatus &status, const CloudIAPReceipt &receipt)> responder) = 0;
326 
333  virtual bool ConfigureVideoDrawer(CYIAbstractVideoPlayer *pVideoPlayer, CYISceneNode *pContentDrawerSceneNode, const CYIClientPlayer::ContentDrawerAnimations &animations) = 0;
334 
338  virtual bool SetVideoPlayerColor(CYIAbstractVideoPlayer *pVideoPlayer, const CYIColor &color) = 0;
339 
343  virtual void SendStopVideo() = 0;
344 
350  virtual bool ConfigureContentOverlay(const CYIContentOverlay::Configuration &configuration) = 0;
351 
357  virtual bool ContentOverlaySetState(const CYISceneView *pNode, const CYIContentOverlay::State &state) = 0;
358 
363  virtual void SendStopAnimation(const CYIString &animation, const CYISceneNode *pNode = nullptr) = 0;
364 
369  virtual void SendEpgContent(CYISceneNode *pNode, const CloudEpgContentModel &content) = 0;
370 
374  virtual void SendFocusEpgProgram(CYISceneNode *pNode, const CYIString &channelTitle, const int64_t startTime) = 0;
375 
382  virtual void ReplaceSubtree(const CYISceneNode *pSubtreeRootNode, bool useJSON = false) = 0;
383 
387  virtual void SendErrorMessage(const CYIString &message) = 0;
388 
396  virtual void PauseExportUpdates() = 0;
397 
405  virtual void ResumeExportUpdates() = 0;
406 
413  virtual bool AreExportUpdatesPaused() = 0;
414 
418  virtual void EnqueuePostExportAction(std::function<void()> action) = 0;
419 
424  virtual void SetNavigationPersistenceKey(const CYIString &persistenceKey) = 0;
425 
430  virtual const CYIString &GetStatus() const = 0;
431 
439  virtual void SaveInstanceState(const CYIString &stringifiedState) = 0;
440 
444  virtual const CYIString &GetSavedInstanceState() const = 0;
445 
447 
453 
459 
465  virtual std::shared_ptr<CYIPersistentStore> FindUnusedPersistentStore(const CYIString &name) = 0;
466 
469  virtual void SendAppBeacon(const CYIString &beaconName) = 0;
470 
471 protected:
476  virtual void AddUnusedPersistentStoreData(const CYIString &name, yi::rapidjson::Value *pData) = 0;
477 };
478 
481 #endif
Structure identifying the recently played session information if it&#39;s available.
Definition: YiClientPlayer.h:58
The CYIPersistentStore class manages storing and retrieving application state data.
Definition: YiPersistentStore.h:61
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:82
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:46
CYISignal ExportComplete
Definition: YiCloudInterface.h:446
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:32
CloudAppStatus()
Definition: YiCloudInterface.h:36
CYIBundle represents a collection of key-value pairs.
Definition: YiBundle.h:46
A class that holds instances of any type that is copy-constructible.
Definition: YiAny.h:80
CYIString errorMessage
Definition: YiCloudInterface.h:34
Structure identifying the settings for a cloud content overlay.
Definition: YiContentOverlay.h:17
A class that provides streaming functionality in a scrolling view.
Definition: YiListView.h:35
Structure identifying the video content drawer animation names for In and Out.
Definition: YiClientPlayer.h:20
An abstract video player that provides a basic interface that all subclasses must implement...
Definition: YiAbstractVideoPlayer.h:59
Abstract structure describing the user information.
Definition: YiCloudIAP.h:44
ListIncomingFocusStyle
Definition: YiCloudInterface.h:64
Abstract structure describing the receipt information.
Definition: YiCloudIAP.h:68
State
Enumeration that defines the different content overlay states.
Definition: YiContentOverlay.h:44
Cloud In App Purchase abstract interface.
Definition: YiCloudIAP.h:18
CYIString errorCode
Definition: YiCloudInterface.h:33
A scene node is the base type for all nodes which are used by the scene manager; it is an integral pa...
Definition: YiSceneNode.h:105
Definition: YiCloudInterface.h:30
CYIString statusCode
Definition: YiCloudInterface.h:32
CYISignal ScreenSaverWillStart
Fired when the client notifies the screensaver is about to start. Server can take opportunity to save...
Definition: YiCloudInterface.h:458
Abstract structure describing the customer unique ID.
Definition: YiCloudIAP.h:28
The structure of cloud EPG content model.
Definition: YiCloudEpgGridView.h:45
virtual ~CYICloudInterface()
Definition: YiCloudInterface.h:79
Abstract structure describing the channel credentials.
Definition: YiCloudIAP.h:36
Allows users to scroll and pan through content inside.
Definition: YiScrollingView.h:147
Accessible
The accessible type of the CYIAccessibilityAttributes class instance.
Definition: YiAccessibilityAttributes.h:31
CYISignal ClientBackgrounded
Fired when the client starts playback or inactivated.
Definition: YiCloudInterface.h:452
std::function< void(bool, CYIBundle)> CYIClientCallback
Definition: YiCloudInterface.h:39
InterfaceType
Definition: YiCloudInterface.h:57
A class used to represent a color value.
Definition: YiColor.h:35
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:169
ListOutgoingFocusStyle
Definition: YiCloudInterface.h:71
The base class for all applications.
Definition: YiApp.h:43
View representation of a CYIAbstractVideoPlayer&#39;s CYIVideoSurface.
Definition: YiVideoSurfaceView.h:32
The cloud interface provides a binding to the Cloud SDK.
Definition: YiCloudInterface.h:51