You.i Engine
YiCloudInterface.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_CLOUD_INTERFACE_H_
3 #define _YI_CLOUD_INTERFACE_H_
4 
6 #include "cloud/iap/YiCloudIAP.h"
9 
11 #include <utility/YiBundle.h>
14 #include <utility/YiString.h>
15 
16 #include <map>
17 #include <set>
18 
19 class CYIAny;
20 class CYIApp;
21 class CYICloudInterfaceManager;
22 class CYIListView;
23 class CYIScrollingView;
24 class CYISceneManager;
25 class CYISceneNode;
26 class CYISceneView;
27 
29 {
33 
35 };
36 
37 using CYIClientCallback = std::function<void(bool, CYIBundle)>;
38 
50 {
51  friend class CYICloudInterfaceManager;
52  friend class CYICloudContext;
53 
54 public:
55  enum class InterfaceType
56  {
57  NULL_INTERFACE,
58  ROKU_INTERFACE,
59  WEB_INTERFACE
60  };
61 
63  {
64  SERVER,
65  CLOSEST,
66  PREVIOUS_ITEM
67  };
68 
70  {
71  SERVER,
72  CLOSEST,
73  CLOSEST_TO_LIST
74  };
75 
76  CYICloudInterface() = default;
77  virtual ~CYICloudInterface(){};
78 
83  virtual bool Init(CYIApp *pApp) = 0;
84 
88  virtual bool RunMainLoop() = 0;
89 
94  virtual bool Begin(bool startImmediately) = 0;
95 
99  virtual void Shutdown() = 0;
100 
104  virtual bool IsCloudServer() = 0;
105 
109  virtual void ExportStagedScenes() {}
110 
114  virtual void SetUseNullRenderer(bool useNull) = 0;
115 
119  virtual bool IsUsingNullRenderer() const = 0;
120 
124  virtual bool SendFocusMap(CYISceneManager *pSceneManager = nullptr) = 0;
125 
129  virtual bool SetExportHint(CYISceneNode *pNode, const CYIString &hintName, const CYIAny &value) = 0;
130 
136  virtual void SetIncomingFocusStyle(CYIListView *pList, ListIncomingFocusStyle focusStyle) = 0;
137 
143  virtual void SetOutgoingFocusStyle(CYIListView *pList, ListOutgoingFocusStyle focusStyle) = 0;
144 
153  virtual void SetInitalScrollIndexWithFocus(CYIListView *pList, uint32_t index) = 0;
154 
158  virtual bool SetVideoMetadata(CYIAbstractVideoPlayer *pVideoPlayer, const CYIAbstractVideoPlayer::VideoMetadata &metadata) = 0;
159 
164  virtual const CYIClientPlayer::PlaybackSessionInfo &GetLastPlaybackSessionInfo() const = 0;
165 
171  virtual void EnableLayoutExport(bool enable) = 0;
172 
176  virtual void SetFocusOnSceneNode(const CYISceneNode *pNode) = 0;
177 
181  virtual void ClearClientFocus() = 0;
182 
189  virtual void InvokeCommand(const CYIString cmd, const CYIBundle &args = CYIBundle(), CYIClientCallback callback = nullptr) = 0;
190 
194  virtual bool IsLowEndDevice() = 0;
195 
199  virtual const CYIString &GetClientExternalIp() const = 0;
200 
204  virtual void TerminateApplication() = 0;
205 
210  virtual void ShowWaitSpinnerNow() = 0;
211 
216  virtual void SetSpinnerDelayMs(uint32_t delayMs) = 0;
217 
222  virtual void ShowWaitSpinner() = 0;
223 
227  virtual void HideWaitSpinner() = 0;
228 
236  virtual void AddModalScene(const CYIString &name, const CYISceneNode *pSceneNode, int32_t layerIndex = 0, std::set<CYIString> associatedScenes = std::set<CYIString>()) = 0;
237 
241  virtual void RemoveModalScene(const CYIString &name) = 0;
242 
246  virtual void SendScrollToNode(const CYIScrollingView *pScrollingView, const CYISceneNode *pNode) = 0;
247 
251  virtual void SendScrollingTextViewUpdate(const CYISceneNode *pScrollingTextView, const CYIString &text, const CYIString &title) = 0;
252 
257  virtual void SetDefaultCloudKeyboardTitle(const CYIString &title) = 0;
258 
263  virtual const CYIString &GetDefaultCloudKeyboardTitle() const = 0;
264 
268  virtual uint64_t RegisterDataListener(CYIString eventId, std::function<bool(CYIString eventId, const yi::rapidjson::Document *pEvent)> dataFunction) = 0;
269 
273  virtual void UnregisterDataListener(CYIString eventId, uint64_t listenerId) = 0;
274 
283  virtual void RegisterPersistentStore(const CYIString &name, CYIPersistentStore *pStore) = 0;
284 
287  virtual void UnregisterPersistentStore(CYIPersistentStore *pStore) = 0;
288 
291  virtual void SendRokuAnalyticsEvent(const CYIString &eventName, const CYIString &parameters) = 0;
292 
296  virtual void GetIAPCustomerUID(std::function<void(const CloudIAPRequestStatus &status, const CloudIAPCustomerUID &customerUID)> responder) = 0;
297 
301  virtual void GetIAPUser(std::function<void(const CloudIAPRequestStatus &status, const CloudIAPUser &iapUser)> responder) = 0;
302 
306  virtual void GetAvailableProducts(std::function<void(const CloudIAPRequestStatus &status, const std::vector<std::shared_ptr<CloudIAPProduct>> &products)> responder) = 0;
307 
311  virtual void GetUserPurchases(std::function<void(const CloudIAPRequestStatus &status, const std::vector<std::shared_ptr<CloudIAPPurchase>> &purchases)> responder) = 0;
312 
316  virtual void RequestPurchase(const CYIString &productId, std::function<void(const CloudIAPRequestStatus, const CloudIAPReceipt &receipt)> responder) = 0;
317 
324  virtual bool ConfigureVideoDrawer(CYIAbstractVideoPlayer *pVideoPlayer, CYISceneNode *pContentDrawerSceneNode, const CYIClientPlayer::ContentDrawerAnimations &animations) = 0;
325 
329  virtual bool SetVideoPlayerColor(CYIAbstractVideoPlayer *pVideoPlayer, const CYIColor &color) = 0;
330 
334  virtual void SendStopVideo() = 0;
335 
340  virtual void SendStopAnimation(const CYIString &animation, const CYISceneNode *pNode = nullptr) = 0;
341 
346  virtual void SendEpgContent(CYISceneNode *pNode, const CloudEpgContentModel &content) = 0;
347 
351  virtual void SendFocusEpgProgram(CYISceneNode *pNode, const CYIString &channelTitle, const int64_t startTime) = 0;
352 
359  virtual void ReplaceSubtree(const CYISceneNode *pSubtreeRootNode, bool useJSON = false) = 0;
360 
364  virtual void SendErrorMessage(const CYIString &message) = 0;
365 
374  virtual void PauseExportUpdates() = 0;
375 
384  virtual void ResumeExportUpdates() = 0;
385 
392  virtual bool AreExportUpdatesPaused() = 0;
393 
397  virtual void EnqueuePostExportAction(std::function<void()> action) = 0;
398 
403  virtual void SetNavigationPersistenceKey(const CYIString &persistenceKey) = 0;
404 
409  virtual const CYIString &GetStatus() const = 0;
410 
418  virtual void SaveInstanceState(const CYIString &stringifiedState) = 0;
419 
423  virtual const CYIString &GetSavedInstanceState() const = 0;
424 
426 
432 
438 
444  virtual std::shared_ptr<CYIPersistentStore> FindUnusedPersistentStore(const CYIString &name) = 0;
445 
446 protected:
451  virtual void AddUnusedPersistentStoreData(const CYIString &name, yi::rapidjson::Value *pData) = 0;
452 };
453 
456 #endif
virtual void ExportStagedScenes()
Definition: YiCloudInterface.h:109
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:60
Scene trees composed of CYISceneNode objects are registered with the scene manager in order for them ...
Definition: YiSceneManager.h:69
The base class for all view types. Views are containers of renderable elements that often define inte...
Definition: YiSceneView.h:47
CYISignal ExportComplete
Definition: YiCloudInterface.h:425
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
CloudAppStatus()
Definition: YiCloudInterface.h:34
CYIBundle represents a collection of key-value pairs.
Definition: YiBundle.h:44
A class that holds instances of any type that is copy-constructible.
Definition: YiAny.h:77
CYIString errorMessage
Definition: YiCloudInterface.h:32
std::map< CYIString, CYIString > VideoMetadata
Definition: YiAbstractVideoPlayer.h:68
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:56
Abstract structure describing the user information.
Definition: YiCloudIAP.h:35
ListIncomingFocusStyle
Definition: YiCloudInterface.h:62
Abstract structure describing the receipt information.
Definition: YiCloudIAP.h:59
Cloud In App Purchase abstract interface.
Definition: YiCloudIAP.h:18
CYIString errorCode
Definition: YiCloudInterface.h:31
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:99
Definition: YiCloudInterface.h:28
CYIString statusCode
Definition: YiCloudInterface.h:30
CYISignal ScreenSaverWillStart
Fired when the client notifies the screensaver is about to start. Server can take opportunity to save...
Definition: YiCloudInterface.h:437
Abstract structure describing the customer unique ID.
Definition: YiCloudIAP.h:27
The structure of cloud EPG content model.
Definition: YiCloudEpgGridView.h:45
virtual ~CYICloudInterface()
Definition: YiCloudInterface.h:77
Allows users to scroll and pan through content inside.
Definition: YiScrollingView.h:144
CYISignal ClientBackgrounded
Fired when the client starts playback or inactivated.
Definition: YiCloudInterface.h:431
std::function< void(bool, CYIBundle)> CYIClientCallback
Definition: YiCloudInterface.h:37
InterfaceType
Definition: YiCloudInterface.h:55
A class used to represent a color value.
Definition: YiColor.h:31
Signals and slots are a thread-safe and flexible communication framework that will allow various obje...
Definition: YiSignal.h:168
ListOutgoingFocusStyle
Definition: YiCloudInterface.h:69
The base class for all applications.
Definition: YiApp.h:45
The cloud interface provides a binding to the Cloud SDK.
Definition: YiCloudInterface.h:49