]> git.saurik.com Git - apple/libc.git/blob - include/libkern/OSThermalNotification.h
Libc-825.24.tar.gz
[apple/libc.git] / include / libkern / OSThermalNotification.h
1 /*
2 * Copyright (c) 2007 Apple Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 #ifndef _OSTHERMALNOTIFICATION_H_
25 #define _OSTHERMALNOTIFICATION_H_
26
27 #include <sys/cdefs.h>
28 #include <Availability.h>
29
30 /*
31 ** OSThermalNotification.h
32 **
33 ** Notification mechanism to alert registered tasks when device thermal conditions
34 ** reach certain thresholds. Notifications are triggered in both directions
35 ** so clients can manage their memory usage more and less aggressively.
36 **
37 */
38
39 __BEGIN_DECLS
40
41 typedef enum {
42 OSThermalNotificationLevelAny = -1,
43 OSThermalNotificationLevelNormal = 0,
44 } OSThermalNotificationLevel;
45
46 extern OSThermalNotificationLevel _OSThermalNotificationLevelForBehavior(int) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_2);
47 extern void _OSThermalNotificationSetLevelForBehavior(int, int) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_2);
48
49 enum {
50 kOSThermalMitigationNone,
51 kOSThermalMitigation70PercentTorch,
52 kOSThermalMitigation70PercentBacklight,
53 kOSThermalMitigation50PercentTorch,
54 kOSThermalMitigation50PercentBacklight,
55 kOSThermalMitigationDisableTorch,
56 kOSThermalMitigation25PercentBacklight,
57 kOSThermalMitigationDisableMapsHalo,
58 kOSThermalMitigationAppTerminate,
59 kOSThermalMitigationDeviceRestart,
60 kOSThermalMitigationThermalTableReady,
61 kOSThermalMitigationCount
62 };
63
64 #define OSThermalNotificationLevel70PercentTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigation70PercentTorch)
65 #define OSThermalNotificationLevel70PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation70PercentBacklight)
66 #define OSThermalNotificationLevel50PercentTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigation50PercentTorch)
67 #define OSThermalNotificationLevel50PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation50PercentBacklight)
68 #define OSThermalNotificationLevelDisableTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDisableTorch)
69 #define OSThermalNotificationLevel25PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation25PercentBacklight)
70 #define OSThermalNotificationLevelDisableMapsHalo _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDisableMapsHalo)
71 #define OSThermalNotificationLevelAppTerminate _OSThermalNotificationLevelForBehavior(kOSThermalMitigationAppTerminate)
72 #define OSThermalNotificationLevelDeviceRestart _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDeviceRestart)
73
74 /* Backwards compatibility */
75 #define OSThermalNotificationLevelWarning OSThermalNotificationLevel70PercentBacklight
76 #define OSThermalNotificationLevelUrgent OSThermalNotificationLevelAppTerminate
77 #define OSThermalNotificationLevelCritical OSThermalNotificationLevelDeviceRestart
78
79 /*
80 ** Simple polling interface to detect current thermal level
81 */
82
83 extern OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0);
84
85 /*
86 ** External notify(3) string for manual notification setup
87 */
88
89 extern const char * const kOSThermalNotificationName __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0);
90
91 __END_DECLS
92
93 #endif /* _OSTHERMALNOTIFICATION_H_ */