summaryrefslogtreecommitdiffstats
path: root/xbmc/platform/linux/powermanagement/UPowerSyscall.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-10 18:07:22 +0000
commitc04dcc2e7d834218ef2d4194331e383402495ae1 (patch)
tree7333e38d10d75386e60f336b80c2443c1166031d /xbmc/platform/linux/powermanagement/UPowerSyscall.h
parentInitial commit. (diff)
downloadkodi-c04dcc2e7d834218ef2d4194331e383402495ae1.tar.xz
kodi-c04dcc2e7d834218ef2d4194331e383402495ae1.zip
Adding upstream version 2:20.4+dfsg.upstream/2%20.4+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'xbmc/platform/linux/powermanagement/UPowerSyscall.h')
-rw-r--r--xbmc/platform/linux/powermanagement/UPowerSyscall.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/xbmc/platform/linux/powermanagement/UPowerSyscall.h b/xbmc/platform/linux/powermanagement/UPowerSyscall.h
new file mode 100644
index 0000000..aed08d8
--- /dev/null
+++ b/xbmc/platform/linux/powermanagement/UPowerSyscall.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2005-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "DBusUtil.h"
+#include "powermanagement/IPowerSyscall.h"
+
+#include <list>
+#include <string>
+
+class CUPowerSource
+{
+public:
+ CUPowerSource(const char *powerSource);
+ ~CUPowerSource();
+
+ void Update();
+ bool IsRechargeable();
+ double BatteryLevel();
+
+private:
+ std::string m_powerSource;
+ bool m_isRechargeable;
+ double m_batteryLevel;
+};
+
+class CUPowerSyscall : public CAbstractPowerSyscall
+{
+public:
+ CUPowerSyscall();
+ bool Powerdown() override;
+ bool Suspend() override;
+ bool Hibernate() override;
+ bool Reboot() override;
+ bool CanPowerdown() override;
+ bool CanSuspend() override;
+ bool CanHibernate() override;
+ bool CanReboot() override;
+ int BatteryLevel() override;
+ bool PumpPowerEvents(IPowerEventsCallback *callback) override;
+ static bool HasUPower();
+protected:
+ bool m_CanPowerdown;
+ bool m_CanSuspend;
+ bool m_CanHibernate;
+ bool m_CanReboot;
+
+ void UpdateCapabilities();
+private:
+ std::list<CUPowerSource> m_powerSources;
+ CDBusConnection m_connection;
+
+ bool m_lowBattery;
+ void EnumeratePowerSources();
+};