xbmc
ServiceBroker.h
1 /*
2  * Copyright (C) 2005-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "utils/GlobalsHandling.h"
12 
13 #include <memory>
14 
15 namespace ADDON
16 {
17 class CAddonMgr;
18 class CBinaryAddonManager;
19 class CBinaryAddonCache;
20 class CVFSAddonCache;
21 class CServiceAddonManager;
22 class CRepositoryUpdater;
23 } // namespace ADDON
24 
25 namespace ANNOUNCEMENT
26 {
27 class CAnnouncementManager;
28 }
29 
30 namespace MEDIA_DETECT
31 {
32 class CDetectDVDMedia;
33 }
34 
35 namespace PVR
36 {
37 class CPVRManager;
38 }
39 
40 namespace PLAYLIST
41 {
42 class CPlayListPlayer;
43 }
44 
45 namespace KODI
46 {
47 namespace MESSAGING
48 {
49 class CApplicationMessenger;
50 }
51 } // namespace KODI
52 
53 class CAppParams;
54 template<class T>
57 class XBPython;
58 class CDataCacheCore;
59 class IAE;
61 class CFavouritesService;
62 class CInputManager;
64 class CNetworkBase;
65 class CWinSystemBase;
66 class CRenderSystemBase;
67 class CPowerManager;
68 class CWeatherManager;
69 class CPlayerCoreFactory;
70 class CDatabaseManager;
71 class CEventLog;
72 class CGUIComponent;
74 class CSettingsComponent;
76 class CMediaManager;
77 class CCPUInfo;
78 class CLog;
79 class CPlatform;
80 class CTextureCache;
81 class CJobManager;
83 
84 namespace WSDiscovery
85 {
86 class IWSDiscovery;
87 }
88 
89 namespace KODI
90 {
91 namespace ADDONS
92 {
93 class CExtsMimeSupportList;
94 }
95 
96 namespace GAME
97 {
98 class CControllerManager;
99 class CGameServices;
100 } // namespace GAME
101 
102 namespace RETRO
103 {
104 class CGUIGameRenderManager;
105 }
106 } // namespace KODI
107 
108 namespace PERIPHERALS
109 {
110 class CPeripherals;
111 }
112 
113 namespace speech
114 {
115 class ISpeechRecognition;
116 }
117 
119 {
120 public:
121  CServiceBroker();
122  ~CServiceBroker();
123 
124  static std::shared_ptr<CAppParams> GetAppParams();
125  static void RegisterAppParams(const std::shared_ptr<CAppParams>& appParams);
126  static void UnregisterAppParams();
127 
128  static CLog& GetLogging();
129  static void CreateLogging();
130  static bool IsLoggingUp();
131  static void DestroyLogging();
132 
133  static std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> GetAnnouncementManager();
134  static void RegisterAnnouncementManager(
135  std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> announcementManager);
136  static void UnregisterAnnouncementManager();
137 
138  static ADDON::CAddonMgr& GetAddonMgr();
139  static ADDON::CBinaryAddonManager& GetBinaryAddonManager();
140  static ADDON::CBinaryAddonCache& GetBinaryAddonCache();
141  static KODI::ADDONS::CExtsMimeSupportList& GetExtsMimeSupportList();
142  static ADDON::CVFSAddonCache& GetVFSAddonCache();
143  static XBPython& GetXBPython();
144  static WSDiscovery::IWSDiscovery& GetWSDiscovery();
145  static MEDIA_DETECT::CDetectDVDMedia& GetDetectDVDMedia();
146  static PVR::CPVRManager& GetPVRManager();
147  static CContextMenuManager& GetContextMenuManager();
148  static CDataCacheCore& GetDataCacheCore();
149  static CPlatform& GetPlatform();
150  static PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
151  static KODI::GAME::CControllerManager& GetGameControllerManager();
152  static KODI::GAME::CGameServices& GetGameServices();
153  static KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
154  static PERIPHERALS::CPeripherals& GetPeripherals();
155  static CFavouritesService& GetFavouritesService();
156  static ADDON::CServiceAddonManager& GetServiceAddons();
157  static ADDON::CRepositoryUpdater& GetRepositoryUpdater();
158  static CInputManager& GetInputManager();
159  static CFileExtensionProvider& GetFileExtensionProvider();
160  static bool IsAddonInterfaceUp();
161  static bool IsServiceManagerUp();
162  static CNetworkBase& GetNetwork();
163  static CPowerManager& GetPowerManager();
164  static CWeatherManager& GetWeatherManager();
165  static CPlayerCoreFactory& GetPlayerCoreFactory();
166  static CDatabaseManager& GetDatabaseManager();
167  static CEventLog* GetEventLog();
168  static CMediaManager& GetMediaManager();
169  static CComponentContainer<IApplicationComponent>& GetAppComponents();
170 
171  static CGUIComponent* GetGUI();
172  static void RegisterGUI(CGUIComponent* gui);
173  static void UnregisterGUI();
174 
175  static void RegisterSettingsComponent(const std::shared_ptr<CSettingsComponent>& settings);
176  static void UnregisterSettingsComponent();
177  static std::shared_ptr<CSettingsComponent> GetSettingsComponent();
178 
179  static void RegisterWinSystem(CWinSystemBase* winsystem);
180  static void UnregisterWinSystem();
181  static CWinSystemBase* GetWinSystem();
182  static CRenderSystemBase* GetRenderSystem();
183 
184  static IAE* GetActiveAE();
185  static void RegisterAE(IAE* ae);
186  static void UnregisterAE();
187 
188  static std::shared_ptr<CAppInboundProtocol> GetAppPort();
189  static void RegisterAppPort(std::shared_ptr<CAppInboundProtocol> port);
190  static void UnregisterAppPort();
191 
192  static void RegisterDecoderFilterManager(CDecoderFilterManager* manager);
193  static CDecoderFilterManager* GetDecoderFilterManager();
194 
195  static std::shared_ptr<CCPUInfo> GetCPUInfo();
196  static void RegisterCPUInfo(std::shared_ptr<CCPUInfo> cpuInfo);
197  static void UnregisterCPUInfo();
198 
199  static void RegisterTextureCache(const std::shared_ptr<CTextureCache>& cache);
200  static void UnregisterTextureCache();
201  static std::shared_ptr<CTextureCache> GetTextureCache();
202 
203  static void RegisterJobManager(const std::shared_ptr<CJobManager>& jobManager);
204  static void UnregisterJobManager();
205  static std::shared_ptr<CJobManager> GetJobManager();
206 
207  static void RegisterAppMessenger(
208  const std::shared_ptr<KODI::MESSAGING::CApplicationMessenger>& appMessenger);
209  static void UnregisterAppMessenger();
210  static std::shared_ptr<KODI::MESSAGING::CApplicationMessenger> GetAppMessenger();
211 
212  static void RegisterKeyboardLayoutManager(
213  const std::shared_ptr<CKeyboardLayoutManager>& keyboardLayoutManager);
214  static void UnregisterKeyboardLayoutManager();
215  static std::shared_ptr<CKeyboardLayoutManager> GetKeyboardLayoutManager();
216 
217  static void RegisterSpeechRecognition(
218  const std::shared_ptr<speech::ISpeechRecognition>& speechRecognition);
219  static void UnregisterSpeechRecognition();
220  static std::shared_ptr<speech::ISpeechRecognition> GetSpeechRecognition();
221 
222 private:
223  std::shared_ptr<CAppParams> m_appParams;
224  std::unique_ptr<CLog> m_logging;
225  std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
226  CGUIComponent* m_pGUI = nullptr;
227  CWinSystemBase* m_pWinSystem = nullptr;
228  IAE* m_pActiveAE = nullptr;
229  std::shared_ptr<CAppInboundProtocol> m_pAppPort;
230  std::shared_ptr<CSettingsComponent> m_pSettingsComponent;
231  CDecoderFilterManager* m_decoderFilterManager = nullptr;
232  std::shared_ptr<CCPUInfo> m_cpuInfo;
233  std::shared_ptr<CTextureCache> m_textureCache;
234  std::shared_ptr<CJobManager> m_jobManager;
235  std::shared_ptr<KODI::MESSAGING::CApplicationMessenger> m_appMessenger;
236  std::shared_ptr<CKeyboardLayoutManager> m_keyboardLayoutManager;
237  std::shared_ptr<speech::ISpeechRecognition> m_speechRecognition;
238 };
239 
240 XBMC_GLOBAL_REF(CServiceBroker, g_serviceBroker);
241 #define g_serviceBroker XBMC_GLOBAL_USE(CServiceBroker)
Class - CAddonMgr Holds references to all addons, enabled or otherwise.
Definition: AddonManager.h:79
Definition: BinaryAddonCache.h:28
Definition: FavouritesService.h:20
Definition: Application.h:64
Texture cache class for handling the caching of images.
Definition: TextureCache.h:36
Class which handles multiple CDecoderFilter elements.
Definition: DecoderFilterManager.h:112
Main input processing class.
Definition: InputManager.h:63
Definition: IWSDiscovery.h:13
Definition: ContextMenuManager.h:24
Definition: AppInboundProtocol.h:15
Definition: RetroPlayerInput.h:15
Definition: WinSystem.h:49
Definition: Network.h:40
Definition: PlayerCoreFactory.h:30
Definition: AppParams.h:20
Definition: CPUInfo.h:44
Definition: FileExtensionProvider.h:25
Database manager class for handling database updating.
Definition: DatabaseManager.h:28
Definition: GameServices.h:50
Definition: BinaryAddonManager.h:33
Definition: PowerManager.h:26
Definition: DataCacheCore.h:19
Definition: RenderSystem.h:27
A generic container for components.
Definition: ServiceBroker.h:55
Definition: IWSDiscovery.h:15
Definition: EventLog.h:23
Definition: WeatherManager.h:80
Definition: RepositoryUpdater.h:34
Definition: MediaManager.h:34
Job Manager class for scheduling asynchronous jobs.
Definition: JobManager.h:205
Definition: log.h:61
Class to manage all available and activated add-ons and to release their types to the outside for sel...
Definition: ExtsMimeSupportList.h:42
Definition: ControllerManager.h:31
Definition: ServiceBroker.h:118
Definition: AudioDecoder.h:18
Definition: XBPython.h:52
Base class for application components.
Definition: IApplicationComponent.h:12
Definition: Application.h:59
Definition: Application.h:54
Definition: Service.h:23
Definition: SettingsComponent.h:25
Definition: KeyboardLayoutManager.h:23
Definition: settings.py:1
Definition: SpeechRecognitionListenerAndroid.h:15
Class for the Platform object.
Definition: Platform.h:25
Class to safely route commands between the GUI and RetroPlayer.
Definition: GUIGameRenderManager.h:69
Definition: ContextMenuManager.h:31
Definition: PVRManager.h:96
IAE Interface.
Definition: AE.h:81
Definition: Addon.cpp:39
Definition: VFSEntry.h:27
Definition: PlayListPlayer.h:29
Definition: GUIComponent.h:22
Definition: Peripherals.h:53
Definition: cache.py:1