kodi
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 KEYBOARD
103 {
104 class CKeyboardLayoutManager;
105 } // namespace KEYBOARD
106 
107 namespace RETRO
108 {
109 class CGUIGameRenderManager;
110 }
111 } // namespace KODI
112 
113 namespace PERIPHERALS
114 {
115 class CPeripherals;
116 }
117 
118 namespace speech
119 {
120 class ISpeechRecognition;
121 }
122 
124 {
125 public:
126  CServiceBroker();
127  ~CServiceBroker();
128 
129  static std::shared_ptr<CAppParams> GetAppParams();
130  static void RegisterAppParams(const std::shared_ptr<CAppParams>& appParams);
131  static void UnregisterAppParams();
132 
133  static CLog& GetLogging();
134  static void CreateLogging();
135  static bool IsLoggingUp();
136  static void DestroyLogging();
137 
138  static std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> GetAnnouncementManager();
139  static void RegisterAnnouncementManager(
140  std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> announcementManager);
141  static void UnregisterAnnouncementManager();
142 
143  static ADDON::CAddonMgr& GetAddonMgr();
144  static ADDON::CBinaryAddonManager& GetBinaryAddonManager();
145  static ADDON::CBinaryAddonCache& GetBinaryAddonCache();
146  static KODI::ADDONS::CExtsMimeSupportList& GetExtsMimeSupportList();
147  static ADDON::CVFSAddonCache& GetVFSAddonCache();
148  static XBPython& GetXBPython();
149  static WSDiscovery::IWSDiscovery& GetWSDiscovery();
150  static MEDIA_DETECT::CDetectDVDMedia& GetDetectDVDMedia();
151  static PVR::CPVRManager& GetPVRManager();
152  static CContextMenuManager& GetContextMenuManager();
153  static CDataCacheCore& GetDataCacheCore();
154  static CPlatform& GetPlatform();
155  static PLAYLIST::CPlayListPlayer& GetPlaylistPlayer();
156  static CSlideShowDelegator& GetSlideShowDelegator();
157  static KODI::GAME::CControllerManager& GetGameControllerManager();
158  static KODI::GAME::CGameServices& GetGameServices();
159  static KODI::RETRO::CGUIGameRenderManager& GetGameRenderManager();
160  static PERIPHERALS::CPeripherals& GetPeripherals();
161  static CFavouritesService& GetFavouritesService();
162  static ADDON::CServiceAddonManager& GetServiceAddons();
163  static ADDON::CRepositoryUpdater& GetRepositoryUpdater();
164  static CInputManager& GetInputManager();
165  static CFileExtensionProvider& GetFileExtensionProvider();
166  static bool IsAddonInterfaceUp();
167  static bool IsServiceManagerUp();
168  static CNetworkBase& GetNetwork();
169  static CPowerManager& GetPowerManager();
170  static CWeatherManager& GetWeatherManager();
171  static CPlayerCoreFactory& GetPlayerCoreFactory();
172  static CDatabaseManager& GetDatabaseManager();
173  static CEventLog* GetEventLog();
174  static CMediaManager& GetMediaManager();
175  static CComponentContainer<IApplicationComponent>& GetAppComponents();
176 
177  static CGUIComponent* GetGUI();
178  static void RegisterGUI(CGUIComponent* gui);
179  static void UnregisterGUI();
180 
181  static void RegisterSettingsComponent(const std::shared_ptr<CSettingsComponent>& settings);
182  static void UnregisterSettingsComponent();
183  static std::shared_ptr<CSettingsComponent> GetSettingsComponent();
184 
185  static void RegisterWinSystem(CWinSystemBase* winsystem);
186  static void UnregisterWinSystem();
187  static CWinSystemBase* GetWinSystem();
188  static CRenderSystemBase* GetRenderSystem();
189 
190  static IAE* GetActiveAE();
191  static void RegisterAE(IAE* ae);
192  static void UnregisterAE();
193 
194  static std::shared_ptr<CAppInboundProtocol> GetAppPort();
195  static void RegisterAppPort(std::shared_ptr<CAppInboundProtocol> port);
196  static void UnregisterAppPort();
197 
198  static void RegisterDecoderFilterManager(CDecoderFilterManager* manager);
199  static CDecoderFilterManager* GetDecoderFilterManager();
200 
201  static std::shared_ptr<CCPUInfo> GetCPUInfo();
202  static void RegisterCPUInfo(std::shared_ptr<CCPUInfo> cpuInfo);
203  static void UnregisterCPUInfo();
204 
205  static void RegisterTextureCache(const std::shared_ptr<CTextureCache>& cache);
206  static void UnregisterTextureCache();
207  static std::shared_ptr<CTextureCache> GetTextureCache();
208 
209  static void RegisterJobManager(const std::shared_ptr<CJobManager>& jobManager);
210  static void UnregisterJobManager();
211  static std::shared_ptr<CJobManager> GetJobManager();
212 
213  static void RegisterAppMessenger(
214  const std::shared_ptr<KODI::MESSAGING::CApplicationMessenger>& appMessenger);
215  static void UnregisterAppMessenger();
216  static std::shared_ptr<KODI::MESSAGING::CApplicationMessenger> GetAppMessenger();
217 
218  static void RegisterKeyboardLayoutManager(
219  const std::shared_ptr<KODI::KEYBOARD::CKeyboardLayoutManager>& keyboardLayoutManager);
220  static void UnregisterKeyboardLayoutManager();
221  static std::shared_ptr<KODI::KEYBOARD::CKeyboardLayoutManager> GetKeyboardLayoutManager();
222 
223  static void RegisterSpeechRecognition(
224  const std::shared_ptr<speech::ISpeechRecognition>& speechRecognition);
225  static void UnregisterSpeechRecognition();
226  static std::shared_ptr<speech::ISpeechRecognition> GetSpeechRecognition();
227 
228 private:
229  std::shared_ptr<CAppParams> m_appParams;
230  std::unique_ptr<CLog> m_logging;
231  std::shared_ptr<ANNOUNCEMENT::CAnnouncementManager> m_pAnnouncementManager;
232  CGUIComponent* m_pGUI = nullptr;
233  CWinSystemBase* m_pWinSystem = nullptr;
234  IAE* m_pActiveAE = nullptr;
235  std::shared_ptr<CAppInboundProtocol> m_pAppPort;
236  std::shared_ptr<CSettingsComponent> m_pSettingsComponent;
237  CDecoderFilterManager* m_decoderFilterManager = nullptr;
238  std::shared_ptr<CCPUInfo> m_cpuInfo;
239  std::shared_ptr<CTextureCache> m_textureCache;
240  std::shared_ptr<CJobManager> m_jobManager;
241  std::shared_ptr<KODI::MESSAGING::CApplicationMessenger> m_appMessenger;
242  std::shared_ptr<KODI::KEYBOARD::CKeyboardLayoutManager> m_keyboardLayoutManager;
243  std::shared_ptr<speech::ISpeechRecognition> m_speechRecognition;
244  std::shared_ptr<CSlideShowDelegator> m_slideshowDelegator;
245 };
246 
247 XBMC_GLOBAL_REF(CServiceBroker, g_serviceBroker);
248 #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:62
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:68
Definition: IWSDiscovery.h:13
Definition: ContextMenuManager.h:24
Definition: AppInboundProtocol.h:18
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:40
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:123
Definition: AudioDecoder.h:18
Definition: XBPython.h:52
Base class for application components.
Definition: IApplicationComponent.h:12
Definition: Application.h:57
Definition: Application.h:52
Definition: Service.h:23
Definition: SettingsComponent.h:25
Definition: settings.py:1
Definition: SpeechRecognitionListenerAndroid.h:15
Definition: SlideShowDelegator.h:17
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:56
Definition: cache.py:1