summaryrefslogtreecommitdiff
path: root/library/power.h
Unidiff
Diffstat (limited to 'library/power.h') (more/less context) (ignore whitespace changes)
-rw-r--r--library/power.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/library/power.h b/library/power.h
index 99d3595..04499a8 100644
--- a/library/power.h
+++ b/library/power.h
@@ -1,85 +1,85 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef POWER_H 21#ifndef POWER_H
22#define POWER_H 22#define POWER_H
23 23
24#include <qobject.h> 24#include <qobject.h>
25 25
26class PowerStatus 26class PowerStatus
27{ 27{
28public: 28public:
29 PowerStatus() { 29 PowerStatus() {
30 ac = Offline; 30 ac = Offline;
31 bs = NotPresent; 31 bs = NotPresent;
32 bbs = NotPresent; 32 bbs = NotPresent;
33 percentRemain = -1; 33 percentRemain = -1;
34 secsRemain = -1; 34 secsRemain = -1;
35 } 35 }
36 36
37 enum ACStatus { Offline, Online, Backup }; 37 enum ACStatus { Offline, Online, Backup };
38 ACStatus acStatus() const { return ac; } 38 ACStatus acStatus() const { return ac; }
39 39
40 enum BatteryStatus { High=0x01, Low=0x02, VeryLow=0x04, Critical=0x08, 40 enum BatteryStatus { High=0x01, Low=0x02, VeryLow=0x04, Critical=0x08,
41 Charging=0x10, NotPresent=0x20 }; 41 Charging=0x10, NotPresent=0x20 };
42 BatteryStatus batteryStatus() const { return bs; } 42 BatteryStatus batteryStatus() const { return bs; }
43 BatteryStatus backupBatteryStatus() const { return bbs; } 43 BatteryStatus backupBatteryStatus() const { return bbs; }
44 44
45 bool batteryPercentAccurate() const { return percentAccurate; } 45 bool batteryPercentAccurate() const { return percentAccurate; }
46 int batteryPercentRemaining() const { return percentRemain; } 46 int batteryPercentRemaining() const { return percentRemain; }
47 int batteryTimeRemaining() const { return secsRemain; } 47 int batteryTimeRemaining() const { return secsRemain; }
48 48
49 bool operator!=( const PowerStatus &ps ) { 49 bool operator!=( const PowerStatus &ps ) {
50 return (ps.ac != ac) || (ps.bs != bs) || (ps.bbs != bbs) || 50 return (ps.ac != ac) || (ps.bs != bs) || (ps.bbs != bbs) ||
51 (ps.percentRemain != percentRemain) || 51 (ps.percentRemain != percentRemain) ||
52 (ps.secsRemain != secsRemain ); 52 (ps.secsRemain != secsRemain );
53 } 53 }
54 54
55private: 55private:
56 ACStatus ac; 56 ACStatus ac;
57 BatteryStatus bs; 57 BatteryStatus bs;
58 BatteryStatus bbs; 58 BatteryStatus bbs;
59 int percentRemain; 59 int percentRemain;
60 int secsRemain; 60 int secsRemain;
61 bool percentAccurate; 61 bool percentAccurate;
62 62
63 friend class PowerStatusManager; 63 friend class PowerStatusManager;
64}; 64};
65 65
66 66
67class PowerStatusManager 67class PowerStatusManager
68{ 68{
69public: 69public:
70 PowerStatusManager(); 70 PowerStatusManager();
71 71
72 static const PowerStatus &readStatus(); 72 static const PowerStatus &readStatus();
73 73
74protected: 74protected:
75 bool getProcApmStatus( int &ac, int &bs, int &bf, int &pc, int &sec ); 75 bool getProcApmStatus( int &ac, int &bs, int &bf, int &pc, int &sec );
76 void getStatus(); 76 void getStatus();
77 77
78private: 78private:
79 static PowerStatus *ps; 79 static PowerStatus *ps;
80 static PowerStatusManager *powerManager; 80 static PowerStatusManager *powerManager;
81}; 81};
82 82
83 83
84#endif 84#endif
85 85