]>
git.saurik.com Git - apple/xnu.git/blob - iokit/IOKit/pwr_mgt/IOPMPowerSource.h
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * The contents of this file constitute Original Code as defined in and
7 * are subject to the Apple Public Source License Version 1.1 (the
8 * "License"). You may not use this file except in compliance with the
9 * License. Please obtain a copy of the License at
10 * http://www.apple.com/publicsource and read it before using this file.
12 * This Original Code and all software distributed under the License are
13 * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
22 #include <libkern/c++/OSObject.h>
23 #include <IOKit/IOTypes.h>
24 #include <IOKit/IOReturn.h>
31 kBatteryInstalled
= (1<<0),
32 kBatteryCharging
= (1<<1),
33 kACInstalled
= (1<<2),
34 kUPSInstalled
= (1<<3),
35 kBatteryAtWarn
= (1<<4),
36 kBatteryDepleted
= (1<<5)
39 const unsigned long kSecondsPerHour
= (60*60);
40 const unsigned long kTenMinutesInSeconds
= (10 * 60);
42 // our battery (power source) object
44 class IOPMPowerSource
: public OSObject
46 OSDeclareDefaultStructors(IOPMPowerSource
)
51 UInt32 bTimeRemaining
;
60 IOPMPowerSource
* nextInList
;
62 bool init (unsigned short whichBatteryIndex
);
63 unsigned long capacityPercentRemaining (void);
64 bool atWarnLevel (void);
69 bool isInstalled (void);
70 bool isCharging (void);
71 bool acConnected (void);
72 unsigned long timeRemaining (void);
73 unsigned long maxCapacity (void);
74 unsigned long curCapacity (void);
75 long currentDrawn (void);
76 unsigned long voltage (void);
80 // function updateStatus is called whenever the system needs
81 // to obtain the latest power source state...must be overridden
83 virtual void updateStatus (void);