2 * Copyright (c) 2007 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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
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.
21 * @APPLE_LICENSE_HEADER_END@
24 #ifndef _OSTHERMALNOTIFICATION_H_
25 #define _OSTHERMALNOTIFICATION_H_
27 #include <sys/cdefs.h>
28 #include <Availability.h>
31 ** OSThermalNotification.h
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.
42 OSThermalNotificationLevelAny
= -1,
43 OSThermalNotificationLevelNormal
= 0,
44 } OSThermalNotificationLevel
;
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
);
50 kOSThermalMitigationNone
,
51 kOSThermalMitigation70PercentTorch
,
52 kOSThermalMitigation70PercentBacklight
,
53 kOSThermalMitigation50PercentTorch
,
54 kOSThermalMitigation50PercentBacklight
,
55 kOSThermalMitigationDisableTorch
,
56 kOSThermalMitigation25PercentBacklight
,
57 kOSThermalMitigationDisableMapsHalo
,
58 kOSThermalMitigationAppTerminate
,
59 kOSThermalMitigationDeviceRestart
,
60 kOSThermalMitigationThermalTableReady
,
61 kOSThermalMitigationCount
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)
74 /* Backwards compatibility */
75 #define OSThermalNotificationLevelWarning OSThermalNotificationLevel70PercentBacklight
76 #define OSThermalNotificationLevelUrgent OSThermalNotificationLevelAppTerminate
77 #define OSThermalNotificationLevelCritical OSThermalNotificationLevelDeviceRestart
80 ** Simple polling interface to detect current thermal level
83 extern OSThermalNotificationLevel
OSThermalNotificationCurrentLevel(void) __OSX_AVAILABLE_STARTING(__MAC_NA
, __IPHONE_2_0
);
86 ** External notify(3) string for manual notification setup
89 extern const char * const kOSThermalNotificationName
__OSX_AVAILABLE_STARTING(__MAC_NA
, __IPHONE_2_0
);
93 #endif /* _OSTHERMALNOTIFICATION_H_ */