xbmc
UPowerSyscall.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 "DBusUtil.h"
12 #include "powermanagement/IPowerSyscall.h"
13 
14 #include <list>
15 #include <string>
16 
18 {
19 public:
20  CUPowerSource(const char *powerSource);
21  ~CUPowerSource();
22 
23  void Update();
24  bool IsRechargeable();
25  double BatteryLevel();
26 
27 private:
28  std::string m_powerSource;
29  bool m_isRechargeable;
30  double m_batteryLevel;
31 };
32 
34 {
35 public:
37  bool Powerdown() override;
38  bool Suspend() override;
39  bool Hibernate() override;
40  bool Reboot() override;
41  bool CanPowerdown() override;
42  bool CanSuspend() override;
43  bool CanHibernate() override;
44  bool CanReboot() override;
45  int BatteryLevel() override;
46  bool PumpPowerEvents(IPowerEventsCallback *callback) override;
47  static bool HasUPower();
48 protected:
49  bool m_CanPowerdown;
50  bool m_CanSuspend;
51  bool m_CanHibernate;
52  bool m_CanReboot;
53 
54  void UpdateCapabilities();
55 private:
56  std::list<CUPowerSource> m_powerSources;
57  CDBusConnection m_connection;
58 
59  bool m_lowBattery;
60  void EnumeratePowerSources();
61 };
Definition: DBusUtil.h:38
Definition: IPowerSyscall.h:70
Definition: IPowerSyscall.h:11
Definition: UPowerSyscall.h:33
Definition: UPowerSyscall.h:17