]> git.saurik.com Git - apple/libc.git/blame_incremental - include/libkern/OSThermalNotification.h
Libc-1439.100.3.tar.gz
[apple/libc.git] / include / libkern / OSThermalNotification.h
... / ...
CommitLineData
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/* Define pressure levels usable by OSThermalPressureLevel */
42typedef enum {
43#if TARGET_OS_OSX || TARGET_OS_MACCATALYST
44 kOSThermalPressureLevelNominal = 0,
45 kOSThermalPressureLevelModerate,
46 kOSThermalPressureLevelHeavy,
47 kOSThermalPressureLevelTrapping,
48 kOSThermalPressureLevelSleeping
49#else
50 kOSThermalPressureLevelNominal = 0,
51 kOSThermalPressureLevelLight = 10,
52 kOSThermalPressureLevelModerate = 20,
53 kOSThermalPressureLevelHeavy = 30,
54 kOSThermalPressureLevelTrapping = 40,
55 kOSThermalPressureLevelSleeping = 50
56#endif
57} OSThermalPressureLevel;
58
59/*
60 ** External notify(3) string for thermal pressure level notification
61 */
62__OSX_AVAILABLE_STARTING(__MAC_10_10, __IPHONE_7_0)
63extern const char * const kOSThermalNotificationPressureLevelName;
64
65
66#if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && \
67 __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_2_0
68
69typedef enum {
70 OSThermalNotificationLevelAny = -1,
71 OSThermalNotificationLevelNormal = 0,
72} OSThermalNotificationLevel;
73
74extern OSThermalNotificationLevel _OSThermalNotificationLevelForBehavior(int) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_2);
75extern void _OSThermalNotificationSetLevelForBehavior(int, int) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_4_2);
76
77enum {
78 kOSThermalMitigationNone,
79 kOSThermalMitigation70PercentTorch,
80 kOSThermalMitigation70PercentBacklight,
81 kOSThermalMitigation50PercentTorch,
82 kOSThermalMitigation50PercentBacklight,
83 kOSThermalMitigationDisableTorch,
84 kOSThermalMitigation25PercentBacklight,
85 kOSThermalMitigationDisableMapsHalo,
86 kOSThermalMitigationAppTerminate,
87 kOSThermalMitigationDeviceRestart,
88 kOSThermalMitigationThermalTableReady,
89 kOSThermalMitigationCount
90};
91
92#define OSThermalNotificationLevel70PercentTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigation70PercentTorch)
93#define OSThermalNotificationLevel70PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation70PercentBacklight)
94#define OSThermalNotificationLevel50PercentTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigation50PercentTorch)
95#define OSThermalNotificationLevel50PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation50PercentBacklight)
96#define OSThermalNotificationLevelDisableTorch _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDisableTorch)
97#define OSThermalNotificationLevel25PercentBacklight _OSThermalNotificationLevelForBehavior(kOSThermalMitigation25PercentBacklight)
98#define OSThermalNotificationLevelDisableMapsHalo _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDisableMapsHalo)
99#define OSThermalNotificationLevelAppTerminate _OSThermalNotificationLevelForBehavior(kOSThermalMitigationAppTerminate)
100#define OSThermalNotificationLevelDeviceRestart _OSThermalNotificationLevelForBehavior(kOSThermalMitigationDeviceRestart)
101
102/* Backwards compatibility */
103#define OSThermalNotificationLevelWarning OSThermalNotificationLevel70PercentBacklight
104#define OSThermalNotificationLevelUrgent OSThermalNotificationLevelAppTerminate
105#define OSThermalNotificationLevelCritical OSThermalNotificationLevelDeviceRestart
106
107/*
108** Simple polling interface to detect current thermal level
109*/
110__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0)
111extern OSThermalNotificationLevel OSThermalNotificationCurrentLevel(void);
112
113/*
114** External notify(3) string for manual notification setup
115*/
116__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_2_0)
117extern const char * const kOSThermalNotificationName;
118
119/*
120** External notify(3) string for alerting user of a thermal condition
121*/
122__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0)
123extern const char * const kOSThermalNotificationAlert;
124
125/*
126** External notify(3) string for notifying system the options taken to resolve thermal condition
127*/
128__OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_6_0)
129extern const char * const kOSThermalNotificationDecision;
130
131#endif // __IPHONE_OS_VERSION_MIN_REQUIRED
132
133__END_DECLS
134
135#endif /* _OSTHERMALNOTIFICATION_H_ */