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 void DestroyLogging();
131 
132  static std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> GetAnnouncementManager();
133  static void RegisterAnnouncementManager(
134  std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> announcementManager);
135  static void UnregisterAnnouncementManager();
136 
137  static ADDON::CAddonMgr& GetAddonMgr();
138  static ADDON::CBinaryAddonManager& GetBinaryAddonManager();
139  static ADDON::CBinaryAddonCache& GetBinaryAddonCache();
140  static KODI::ADDONS::CExtsMimeSupportList& GetExtsMimeSupportList();
141  static ADDON::CVFSAddonCache& GetVFSAddonCache();
142  static XBPython& GetXBPython();
143  static WSDiscovery::IWSDiscovery& GetWSDiscovery();
144  static MEDIA_DETECT::CDetectDVDMedia& GetDetectDVDMedia();
145  static PVR::CPVRManager& GetPVRManager();
146  static CContextMenuManager& GetContextMenuManager();
147  static CDataCacheCore& GetDataCacheCore();
148  static CPlatform& GetPlatform();
149  static PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
150  static KODI::GAME::CControllerManager& GetGameControllerManager();
151  static KODI::GAME::CGameServices& GetGameServices();
152  static KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
153  static PERIPHERALS::CPeripherals& GetPeripherals();
154  static CFavouritesService& GetFavouritesService();
155  static ADDON::CServiceAddonManager& GetServiceAddons();
156  static ADDON::CRepositoryUpdater& GetRepositoryUpdater();
157  static CInputManager& GetInputManager();
158  static CFileExtensionProvider& GetFileExtensionProvider();
159  static bool IsAddonInterfaceUp();
160  static bool IsServiceManagerUp();
161  static CNetworkBase& GetNetwork();
162  static CPowerManager& GetPowerManager();
163  static CWeatherManager& GetWeatherManager();
164  static CPlayerCoreFactory& GetPlayerCoreFactory();
165  static CDatabaseManager& GetDatabaseManager();
166  static CEventLog* GetEventLog();
167  static CMediaManager& GetMediaManager();
168  static CComponentContainer<IApplicationComponent>& GetAppComponents();
169 
170  static CGUIComponent* GetGUI();
171  static void RegisterGUI(CGUIComponent* gui);
172  static void UnregisterGUI();
173 
174  static void RegisterSettingsComponent(const std::shared_ptr<CSettingsComponent>& settings);
175  static void UnregisterSettingsComponent();
176  static std::shared_ptr<CSettingsComponent> GetSettingsComponent();
177 
178  static void RegisterWinSystem(CWinSystemBase* winsystem);
179  static void UnregisterWinSystem();
180  static CWinSystemBase* GetWinSystem();
181  static CRenderSystemBase* GetRenderSystem();
182 
183  static IAE* GetActiveAE();
184  static void RegisterAE(IAE* ae);
185  static void UnregisterAE();
186 
187  static std::shared_ptr<CAppInboundProtocol> GetAppPort();
188  static void RegisterAppPort(std::shared_ptr<CAppInboundProtocol> port);
189  static void UnregisterAppPort();
190 
191  static void RegisterDecoderFilterManager(CDecoderFilterManager* manager);
192  static CDecoderFilterManager* GetDecoderFilterManager();
193 
194  static std::shared_ptr<CCPUInfo> GetCPUInfo();
195  static void RegisterCPUInfo(std::shared_ptr<CCPUInfo> cpuInfo);
196  static void UnregisterCPUInfo();
197 
198  static void RegisterTextureCache(const std::shared_ptr<CTextureCache>& cache);
199  static void UnregisterTextureCache();
200  static std::shared_ptr<CTextureCache> GetTextureCache();
201 
202  static void RegisterJobManager(const std::shared_ptr<CJobManager>& jobManager);
203  static void UnregisterJobManager();
204  static std::shared_ptr<CJobManager> GetJobManager();
205 
206  static void RegisterAppMessenger(
207  const std::shared_ptr<KODI::MESSAGING::CApplicationMessenger>& appMessenger);
208  static void UnregisterAppMessenger();
209  static std::shared_ptr<KODI::MESSAGING::CApplicationMessenger> GetAppMessenger();
210 
211  static void RegisterKeyboardLayoutManager(
212  const std::shared_ptr<CKeyboardLayoutManager>& keyboardLayoutManager);
213  static void UnregisterKeyboardLayoutManager();
214  static std::shared_ptr<CKeyboardLayoutManager> GetKeyboardLayoutManager();
215 
216  static void RegisterSpeechRecognition(
217  const std::shared_ptr<speech::ISpeechRecognition>& speechRecognition);
218  static void UnregisterSpeechRecognition();
219  static std::shared_ptr<speech::ISpeechRecognition> GetSpeechRecognition();
220 
221 private:
222  std::shared_ptr<CAppParams> m_appParams;
223  std::unique_ptr<CLog> m_logging;
224  std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
225  CGUIComponent* m_pGUI;
226  CWinSystemBase* m_pWinSystem;
227  IAE* m_pActiveAE;
228  std::shared_ptr<CAppInboundProtocol> m_pAppPort;
229  std::shared_ptr<CSettingsComponent> m_pSettingsComponent;
230  CDecoderFilterManager* m_decoderFilterManager;
231  std::shared_ptr<CCPUInfo> m_cpuInfo;
232  std::shared_ptr<CTextureCache> m_textureCache;
233  std::shared_ptr<CJobManager> m_jobManager;
234  std::shared_ptr<KODI::MESSAGING::CApplicationMessenger> m_appMessenger;
235  std::shared_ptr<CKeyboardLayoutManager> m_keyboardLayoutManager;
236  std::shared_ptr<speech::ISpeechRecognition> m_speechRecognition;
237 };
238 
239 XBMC_GLOBAL_REF(CServiceBroker, g_serviceBroker);
240 #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:18
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:109
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:44
Definition: Network.h:40
Definition: PlayerCoreFactory.h:30
Definition: AppParams.h:19
Definition: CPUInfo.h:44
Definition: FileExtensionProvider.h:25
Database manager class for handling database updating.
Definition: DatabaseManager.h:28
Definition: GameServices.h:37
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:49
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:22
Definition: ServiceBroker.h:118
Controller configuration window.
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:92
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:49
Definition: cache.py:1