All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
AndroidPlatformAbstractionModule.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Types.h"
6 #include "AndroidDeclarations.h"
7 #include "Helpers.h"
8 #include "Web.h"
9 #include "Tasks.h"
10 #include "Concurrency.h"
11 #include "Rendering.h"
12 #include "IPlatformAbstractionModule.h"
13 #include "AndroidUrlEncoder.h"
14 #include "AndroidFileIO.h"
15 #include "AndroidGlTaskContextFactory.h"
16 #include "AndroidTextureFileLoader.h"
17 #include "AndroidCacheFileIO.h"
18 #include "IConnectivityService.h"
19 #include "Rendering.h"
20 #include "IWorkPool.h"
21 #include "DefaultWorkPool.h"
22 #include "AndroidAlertBoxFactory.h"
23 #include "AndroidStorageFullAlertBoxHandler.h"
24 #include "SceneBuilderModuleFactory.h"
25 #include "NativeTextureFactory.h"
26 #include "IThreadService.h"
27 
28 #include <string>
29 #include <set>
30 #include <EGL/egl.h>
31 
32 
33 namespace Eegeo
34 {
35  namespace Unity
36  {
37  struct UnityCallbacks;
38  }
39 
40  namespace Android
41  {
42  class IAndroidSharedGlContextUsageGuard;
43 
45  {
46  public:
49  Helpers::Jpeg::IJpegLoader& jpegLoader,
50  EGLDisplay& display,
51  EGLContext& context,
52  EGLSurface& surface,
53  const std::string& apiKey,
54  const std::set<std::string>& customDirectoryPaths=std::set<std::string>(),
55  Eegeo::UI::NativeAlerts::Android::AndroidAlertBoxFactory* pAndroidAlertBoxFactory = nullptr,
56  const Unity::UnityCallbacks* pUnityCallbacks = nullptr,
57  IAndroidSharedGlContextUsageGuard* pContextUsageGuard = nullptr);
58 
59  static AndroidPlatformAbstractionModule* Create(
60  AndroidNativeState& nativeState,
61  Helpers::Jpeg::IJpegLoader& jpegLoader,
62  const Eegeo::Android::Sdk::IAndroidGlDisplayService& glDisplayService,
63  const std::string& apiKey,
64  const std::vector<std::string>& customDirectoryPaths,
66  );
67 
69 
70  Helpers::ITextureFileLoader& GetTextureFileLoader() const;
71  Web::IWebLoadRequestFactory& GetWebLoadRequestFactory() const;
72  Web::IWebLoadRequestFactory& GetPlatformWebLoadRequestFactory() const;
73  Web::IWebProxySettings& GetProxySettings() const;
74  Web::ISSLSettings& GetSSLSettings() const;
75  Helpers::IHttpCache& GetHttpCache() const;
76  Helpers::IFileIO& GetFileIO() const;
77  Helpers::UrlHelpers::IUrlEncoder& GetUrlEncoder() const;
78  Concurrency::Tasks::IGlTaskContextFactory& GetGlTaskContextFactory() const;
79  Eegeo::Web::IConnectivityService& GetConnectivityService() const;
80  Eegeo::Concurrency::Tasks::IWorkPool& GetWorkPool() const;
81  Modules::ISceneBuilderModuleFactory& GetSceneBuilderModuleFactory();
82  Rendering::AsyncTexturing::ITextureFactory& GetTextureFactory() const;
83  IAndroidSharedGlContextUsageGuard& GetSharedGlContextUsageGuard();
84 
85  void OnPause();
86  void OnResume();
87  void Update();
88 
89  // currently used by app boilerplate, retain
90  Helpers::IHttpCache& GetAndroidHttpCache() const;
91  void UpdateSurface(EGLSurface& surface);
92 
93  private:
94 
96  Android::AndroidUrlEncoder* pAndroidUrlEncoder,
97  Android::AndroidFileIO* pAndroidFileIO,
98  Helpers::IHttpCache* pAndroidHttpCache,
99  Android::AndroidCacheFileIO* pAndroidCacheFileIO,
100  Helpers::ITextureFileLoader* pAndroidTextureFileLoader,
101  Web::WebModule* pWebModule,
102  Android::AndroidGlTaskContextFactory* pLegacyAndroidGlTaskContextFactory,
104  Web::IWebLoadRequestFactory* pPlatformWebLoadRequestFactory,
105  Web::IConnectivityService* pAndroidConnectivityService,
107  Concurrency::IThreadService* pThreadService,
108  AndroidStorageFullAlertBoxHandler* pAndroidStorageFullAlertBoxHandler,
110  Helpers::PNG::IPNGDecoder* pPNGDecoder,
112  );
113 
114  Android::AndroidUrlEncoder* m_pAndroidUrlEncoder;
115  Android::AndroidFileIO* m_pAndroidFileIO;
116  Helpers::IHttpCache* m_pAndroidHttpCache;
117  Android::AndroidCacheFileIO* m_pAndroidCacheFileIO;
118  Helpers::ITextureFileLoader* m_pAndroidTextureFileLoader;
119  Web::WebModule* m_pWebModule;
120  Android::AndroidGlTaskContextFactory* m_pLegacyAndroidGlTaskContextFactory;
121  Eegeo::Concurrency::Tasks::IGlTaskContextFactory* m_pGlTaskContextFactory;
122  Web::IWebLoadRequestFactory* m_pPlatformWebLoadRequestFactory;
123  Web::IConnectivityService* m_pAndroidConnectivityService;
125  Concurrency::IThreadService* m_pThreadService;
126  AndroidStorageFullAlertBoxHandler* m_pAndroidStorageFullAlertBoxHandler;
127  Modules::SceneBuilderModuleFactory m_sceneBuilderModuleFactory;
129  Helpers::PNG::IPNGDecoder* m_pPNGDecoder;
130  IAndroidSharedGlContextUsageGuard* m_pContextUsageGuard;
131  bool m_ownsContextUsageGuard;
132  };
133  }
134 }