2 * Copyright (C) 2016-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
11 #include "utils/ComponentContainer.h"
13 //! \brief Base class for services.
14 class IPlatformService
17 virtual ~IPlatformService() = default;
20 /**\brief Class for the Platform object
22 * Contains methods to retrieve platform specific information
23 * and methods for doing platform specific environment preparation/initialisation
25 class CPlatform
: public CComponentContainer
<IPlatformService
>
28 /**\brief Creates the Platform object
30 *@return the platform object
32 static CPlatform
*CreateInstance();
35 CPlatform() = default;
38 virtual ~CPlatform() = default;
40 /**\brief Called at an early stage of application startup
42 * This method can be used to do platform specific environment preparation
43 * or initialisation (like setting environment variables for example)
45 virtual bool InitStageOne() { return true; }
47 /**\brief Called at a middle stage of application startup
49 * This method can be used for starting platform specific services that
50 * do not depend on windowing/gui. (eg macos XBMCHelper)
52 virtual bool InitStageTwo() { return true; }
54 /**\brief Called at a late stage of application startup
56 * This method can be used for starting platform specific Window/GUI related
57 * services/components. (eg , WS-Discovery Daemons)
59 virtual bool InitStageThree() { return true; }
61 /**\brief Called at a late stage of application shutdown
63 * This method should be used to cleanup resources allocated in InitStageOne
65 virtual void DeinitStageOne() {}
67 /**\brief Called at a middle stage of application shutdown
69 * This method should be used to cleanup resources allocated in InitStageTwo
71 virtual void DeinitStageTwo() {}
73 /**\brief Called at an early stage of application shutdown
75 * This method should be used to cleanup resources allocated in InitStageThree
77 virtual void DeinitStageThree() {}
79 /**\brief Flag whether disabled add-ons - installed via packagemanager or manually - should be
80 * offered for configuration and activation on kodi startup for this platform
82 virtual bool IsConfigureAddonsAtStartupEnabled() { return false; }
84 /**\brief Flag whether this platform supports user installation of binary add-ons.
86 virtual bool SupportsUserInstalledBinaryAddons() { return true; }
88 /**\brief Print platform specific info to log
90 * Logs platform specific system info during application creation startup
92 virtual void PlatformSyslog() {}
94 /**\brief Get a platform service instance.
97 std::shared_ptr
<T
> GetService()
99 return this->GetComponent
<T
>();