]> git.saurik.com Git - apple/libc.git/blob - include/libkern/OSThermalNotification.h
cc81223254a2347d27eca3cdca7834a98f000654
[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 /* Define pressure levels usable by OSThermalPressureLevel */
80 typedef enum {
81 kOSThermalPressureLevelNominal = 0,
82 kOSThermalPressureLevelModerate,
83 kOSThermalPressureLevelHeavy,
84 kOSThermalPressureLevelTrapping,
85 kOSThermalPressureLevelSleeping
86 } OSThermalPressureLevel;
87
88 /*
89 ** Simple polling interface to detect current thermal level
90 */
91
92 extern OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0);
93
94 /*
95 ** External notify(3) string for manual notification setup
96 */
97
98 extern const char * const kOSThermalNotificationName __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0);
99
100 /*
101 ** External notify(3) string for alerting user of a thermal condition
102 */
103
104 extern const char * const kOSThermalNotificationAlert __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0);
105
106 /*
107 ** External notify(3) string for notifying system the options taken to resolve thermal condition
108 */
109
110 extern const char * const kOSThermalNotificationDecision __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0);
111
112 /*
113 ** External notify(3) string for thermal pressure level notification
114 */
115
116 extern const char * const kOSThermalNotificationPressureLevelName __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_7_0);
117
118
119 __END_DECLS
120
121 #endif /* _OSTHERMALNOTIFICATION_H_ */