summaryrefslogtreecommitdiffstats
path: root/xbmc/addons/kodi-dev-kit/include/kodi/platform
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
committermanuel <manuel@mausz.at>2020-10-19 00:52:24 +0200
commitbe933ef2241d79558f91796cc5b3a161f72ebf9c (patch)
treefe3ab2f130e20c99001f2d7a81d610c78c96a3f4 /xbmc/addons/kodi-dev-kit/include/kodi/platform
parent5f8335c1e49ce108ef3481863833c98efa00411b (diff)
downloadkodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.gz
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.tar.bz2
kodi-pvr-build-be933ef2241d79558f91796cc5b3a161f72ebf9c.zip
sync with upstream
Diffstat (limited to 'xbmc/addons/kodi-dev-kit/include/kodi/platform')
-rw-r--r--xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h105
1 files changed, 105 insertions, 0 deletions
diff --git a/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h b/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h
new file mode 100644
index 0000000..245abd6
--- /dev/null
+++ b/xbmc/addons/kodi-dev-kit/include/kodi/platform/android/System.h
@@ -0,0 +1,105 @@
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 "../../AddonBase.h"
12#include "../../c-api/platform/android/system.h"
13
14#ifdef __cplusplus
15namespace kodi
16{
17namespace platform
18{
19
20//==============================================================================
21/// @defgroup cpp_kodi_platform_CInterfaceAndroidSystem class CInterfaceAndroidSystem
22/// @ingroup cpp_kodi_platform
23/// @brief **Android platform specific functions**\n
24/// C++ class to query Android specific things in Kodi.
25///
26/// It has the header is @ref System.h "#include <kodi/platform/android/System.h>".
27///
28/// ----------------------------------------------------------------------------
29///
30/// **Example:**
31/// ~~~~~~~~~~~~~{.cpp}
32/// #include <kodi/platform/android/System.h>
33///
34/// #if defined(ANDROID)
35/// kodi::platform::CInterfaceAndroidSystem system;
36/// if (system.GetSDKVersion() >= 23)
37/// {
38/// ...
39/// }
40/// #endif
41/// ~~~~~~~~~~~~~
42///
43class ATTRIBUTE_HIDDEN CInterfaceAndroidSystem
44{
45public:
46 CInterfaceAndroidSystem()
47 : m_interface(static_cast<AddonToKodiFuncTable_android_system*>(
48 GetInterface(INTERFACE_ANDROID_SYSTEM_NAME, INTERFACE_ANDROID_SYSTEM_VERSION))){};
49
50 //============================================================================
51 /// @ingroup cpp_kodi_platform_CInterfaceAndroidSystem
52 /// @brief Request an JNI env pointer for the calling thread.
53 ///
54 /// JNI env has to be controlled by kodi because of the underlying
55 /// threading concep.
56 ///
57 /// @return JNI env pointer for the calling thread
58 ///
59 inline void* GetJNIEnv()
60 {
61 if (m_interface)
62 return m_interface->get_jni_env();
63
64 return nullptr;
65 }
66 //----------------------------------------------------------------------------
67
68 //============================================================================
69 /// @ingroup cpp_kodi_platform_CInterfaceAndroidSystem
70 /// @brief Request the android sdk version to e.g. initialize <b>`JNIBase`</b>.
71 ///
72 /// @return Android SDK version
73 ///
74 inline int GetSDKVersion()
75 {
76 if (m_interface)
77 return m_interface->get_sdk_version();
78
79 return 0;
80 }
81 //----------------------------------------------------------------------------
82
83 //============================================================================
84 /// @ingroup cpp_kodi_platform_CInterfaceAndroidSystem
85 /// @brief Request the android main class name e.g. <b>`org.xbmc.kodi`</b>.
86 ///
87 /// @return package class name
88 ///
89 inline std::string GetClassName()
90 {
91 if (m_interface)
92 return m_interface->get_class_name();
93
94 return std::string();
95 }
96 //----------------------------------------------------------------------------
97
98private:
99 AddonToKodiFuncTable_android_system* m_interface;
100};
101//------------------------------------------------------------------------------
102
103} /* namespace platform */
104} /* namespace kodi */
105#endif /* __cplusplus */