objc2_io_kit/generated/
pwr_mgt.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5#[cfg(feature = "objc2")]
6use objc2::__framework_prelude::*;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kappleclamshellstatekey?language=objc)
12pub const kAppleClamshellStateKey: &CStr =
13    unsafe { CStr::from_bytes_with_nul_unchecked(b"AppleClamshellState\0") };
14/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kappleclamshellcausessleepkey?language=objc)
15pub const kAppleClamshellCausesSleepKey: &CStr =
16    unsafe { CStr::from_bytes_with_nul_unchecked(b"AppleClamshellCausesSleep\0") };
17/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepwakeuuidkey?language=objc)
18pub const kIOPMSleepWakeUUIDKey: &CStr =
19    unsafe { CStr::from_bytes_with_nul_unchecked(b"SleepWakeUUID\0") };
20/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbootsessionuuidkey?language=objc)
21pub const kIOPMBootSessionUUIDKey: &CStr =
22    unsafe { CStr::from_bytes_with_nul_unchecked(b"BootSessionUUID\0") };
23/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepenabledkey?language=objc)
24pub const kIOPMDeepSleepEnabledKey: &CStr =
25    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Enabled\0") };
26/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepdelaykey?language=objc)
27pub const kIOPMDeepSleepDelayKey: &CStr =
28    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Delay\0") };
29/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepdelayhighkey?language=objc)
30pub const kIOPMDeepSleepDelayHighKey: &CStr =
31    unsafe { CStr::from_bytes_with_nul_unchecked(b"High Standby Delay\0") };
32/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmstandbybatterythresholdkey?language=objc)
33pub const kIOPMStandbyBatteryThresholdKey: &CStr =
34    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Battery Threshold\0") };
35/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdestroyfvkeyonstandbykey?language=objc)
36pub const kIOPMDestroyFVKeyOnStandbyKey: &CStr =
37    unsafe { CStr::from_bytes_with_nul_unchecked(b"DestroyFVKeyOnStandby\0") };
38/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmresetpowerstateonwakekey?language=objc)
39pub const kIOPMResetPowerStateOnWakeKey: &CStr =
40    unsafe { CStr::from_bytes_with_nul_unchecked(b"IOPMResetPowerStateOnWake\0") };
41/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionsdriverkey?language=objc)
42pub const kIOPMAssertionsDriverKey: &CStr =
43    unsafe { CStr::from_bytes_with_nul_unchecked(b"DriverPMAssertions\0") };
44/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionsdriverdetailedkey?language=objc)
45pub const kIOPMAssertionsDriverDetailedKey: &CStr =
46    unsafe { CStr::from_bytes_with_nul_unchecked(b"DriverPMAssertionsDetailed\0") };
47/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionidkey?language=objc)
48pub const kIOPMDriverAssertionIDKey: &CStr =
49    unsafe { CStr::from_bytes_with_nul_unchecked(b"ID\0") };
50/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertioncreatedtimekey?language=objc)
51pub const kIOPMDriverAssertionCreatedTimeKey: &CStr =
52    unsafe { CStr::from_bytes_with_nul_unchecked(b"CreatedTime\0") };
53/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionmodifiedtimekey?language=objc)
54pub const kIOPMDriverAssertionModifiedTimeKey: &CStr =
55    unsafe { CStr::from_bytes_with_nul_unchecked(b"ModifiedTime\0") };
56/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionownerstringkey?language=objc)
57pub const kIOPMDriverAssertionOwnerStringKey: &CStr =
58    unsafe { CStr::from_bytes_with_nul_unchecked(b"Owner\0") };
59/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionownerservicekey?language=objc)
60pub const kIOPMDriverAssertionOwnerServiceKey: &CStr =
61    unsafe { CStr::from_bytes_with_nul_unchecked(b"ServicePtr\0") };
62/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionregistryentryidkey?language=objc)
63pub const kIOPMDriverAssertionRegistryEntryIDKey: &CStr =
64    unsafe { CStr::from_bytes_with_nul_unchecked(b"RegistryEntryID\0") };
65/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionlevelkey?language=objc)
66pub const kIOPMDriverAssertionLevelKey: &CStr =
67    unsafe { CStr::from_bytes_with_nul_unchecked(b"Level\0") };
68/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionassertedkey?language=objc)
69pub const kIOPMDriverAssertionAssertedKey: &CStr =
70    unsafe { CStr::from_bytes_with_nul_unchecked(b"Assertions\0") };
71/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessageclamshellstatechange?language=objc)
72pub const kIOPMMessageClamshellStateChange: c_uint =
73    iokit_family_msg!(sub_iokit_powermanagement, 0x100);
74/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagefeaturechange?language=objc)
75pub const kIOPMMessageFeatureChange: c_uint = iokit_family_msg!(sub_iokit_powermanagement, 0x110);
76/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessageinternalbatteryfullydischarged?language=objc)
77pub const kIOPMMessageInternalBatteryFullyDischarged: c_uint =
78    iokit_family_msg!(sub_iokit_powermanagement, 0x120);
79/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagesystempowereventoccurred?language=objc)
80pub const kIOPMMessageSystemPowerEventOccurred: c_uint =
81    iokit_family_msg!(sub_iokit_powermanagement, 0x130);
82/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagesleepwakeuuidchange?language=objc)
83pub const kIOPMMessageSleepWakeUUIDChange: c_uint =
84    iokit_family_msg!(sub_iokit_powermanagement, 0x140);
85/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagedriverassertionschanged?language=objc)
86pub const kIOPMMessageDriverAssertionsChanged: c_uint =
87    iokit_family_msg!(sub_iokit_powermanagement, 0x150);
88/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagedarkwakethermalemergency?language=objc)
89pub const kIOPMMessageDarkWakeThermalEmergency: c_uint =
90    iokit_family_msg!(sub_iokit_powermanagement, 0x160);
91/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsexternalconnectedkey?language=objc)
92pub const kIOPMPSExternalConnectedKey: &CStr =
93    unsafe { CStr::from_bytes_with_nul_unchecked(b"ExternalConnected\0") };
94/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsexternalchargecapablekey?language=objc)
95pub const kIOPMPSExternalChargeCapableKey: &CStr =
96    unsafe { CStr::from_bytes_with_nul_unchecked(b"ExternalChargeCapable\0") };
97/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatteryinstalledkey?language=objc)
98pub const kIOPMPSBatteryInstalledKey: &CStr =
99    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryInstalled\0") };
100/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsischargingkey?language=objc)
101pub const kIOPMPSIsChargingKey: &CStr =
102    unsafe { CStr::from_bytes_with_nul_unchecked(b"IsCharging\0") };
103/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmfullychargedkey?language=objc)
104pub const kIOPMFullyChargedKey: &CStr =
105    unsafe { CStr::from_bytes_with_nul_unchecked(b"FullyCharged\0") };
106/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsatwarnlevelkey?language=objc)
107pub const kIOPMPSAtWarnLevelKey: &CStr =
108    unsafe { CStr::from_bytes_with_nul_unchecked(b"AtWarnLevel\0") };
109/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsatcriticallevelkey?language=objc)
110pub const kIOPMPSAtCriticalLevelKey: &CStr =
111    unsafe { CStr::from_bytes_with_nul_unchecked(b"AtCriticalLevel\0") };
112/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscurrentcapacitykey?language=objc)
113pub const kIOPMPSCurrentCapacityKey: &CStr =
114    unsafe { CStr::from_bytes_with_nul_unchecked(b"CurrentCapacity\0") };
115/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmaxcapacitykey?language=objc)
116pub const kIOPMPSMaxCapacityKey: &CStr =
117    unsafe { CStr::from_bytes_with_nul_unchecked(b"MaxCapacity\0") };
118/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsdesigncapacitykey?language=objc)
119pub const kIOPMPSDesignCapacityKey: &CStr =
120    unsafe { CStr::from_bytes_with_nul_unchecked(b"DesignCapacity\0") };
121/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpstimeremainingkey?language=objc)
122pub const kIOPMPSTimeRemainingKey: &CStr =
123    unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeRemaining\0") };
124/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsamperagekey?language=objc)
125pub const kIOPMPSAmperageKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Amperage\0") };
126/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsvoltagekey?language=objc)
127pub const kIOPMPSVoltageKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Voltage\0") };
128/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscyclecountkey?language=objc)
129pub const kIOPMPSCycleCountKey: &CStr =
130    unsafe { CStr::from_bytes_with_nul_unchecked(b"CycleCount\0") };
131/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmaxerrkey?language=objc)
132pub const kIOPMPSMaxErrKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"MaxErr\0") };
133/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterinfokey?language=objc)
134pub const kIOPMPSAdapterInfoKey: &CStr =
135    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterInfo\0") };
136/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationkey?language=objc)
137pub const kIOPMPSLocationKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Location\0") };
138/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpserrorconditionkey?language=objc)
139pub const kIOPMPSErrorConditionKey: &CStr =
140    unsafe { CStr::from_bytes_with_nul_unchecked(b"ErrorCondition\0") };
141/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmanufacturerkey?language=objc)
142pub const kIOPMPSManufacturerKey: &CStr =
143    unsafe { CStr::from_bytes_with_nul_unchecked(b"Manufacturer\0") };
144/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmanufacturedatekey?language=objc)
145pub const kIOPMPSManufactureDateKey: &CStr =
146    unsafe { CStr::from_bytes_with_nul_unchecked(b"ManufactureDate\0") };
147/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmodelkey?language=objc)
148pub const kIOPMPSModelKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Model\0") };
149/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsserialkey?language=objc)
150pub const kIOPMPSSerialKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Serial\0") };
151/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdevicenamekey?language=objc)
152pub const kIOPMDeviceNameKey: &CStr =
153    unsafe { CStr::from_bytes_with_nul_unchecked(b"DeviceName\0") };
154/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslegacybatteryinfokey?language=objc)
155pub const kIOPMPSLegacyBatteryInfoKey: &CStr =
156    unsafe { CStr::from_bytes_with_nul_unchecked(b"LegacyBatteryInfo\0") };
157/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatteryhealthkey?language=objc)
158pub const kIOPMPSBatteryHealthKey: &CStr =
159    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryHealth\0") };
160/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpshealthconfidencekey?language=objc)
161pub const kIOPMPSHealthConfidenceKey: &CStr =
162    unsafe { CStr::from_bytes_with_nul_unchecked(b"HealthConfidence\0") };
163/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscapacityestimatedkey?language=objc)
164pub const kIOPMPSCapacityEstimatedKey: &CStr =
165    unsafe { CStr::from_bytes_with_nul_unchecked(b"CapacityEstimated\0") };
166/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatterychargestatuskey?language=objc)
167pub const kIOPMPSBatteryChargeStatusKey: &CStr =
168    unsafe { CStr::from_bytes_with_nul_unchecked(b"ChargeStatus\0") };
169/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatterytemperaturekey?language=objc)
170pub const kIOPMPSBatteryTemperatureKey: &CStr =
171    unsafe { CStr::from_bytes_with_nul_unchecked(b"Temperature\0") };
172/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailskey?language=objc)
173pub const kIOPMPSAdapterDetailsKey: &CStr =
174    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterDetails\0") };
175/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpschargerconfigurationkey?language=objc)
176pub const kIOPMPSChargerConfigurationKey: &CStr =
177    unsafe { CStr::from_bytes_with_nul_unchecked(b"ChargerConfiguration\0") };
178/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoohot?language=objc)
179pub const kIOPMBatteryChargeStatusTooHot: &CStr =
180    unsafe { CStr::from_bytes_with_nul_unchecked(b"HighTemperature\0") };
181/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoocold?language=objc)
182pub const kIOPMBatteryChargeStatusTooCold: &CStr =
183    unsafe { CStr::from_bytes_with_nul_unchecked(b"LowTemperature\0") };
184/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoohotorcold?language=objc)
185pub const kIOPMBatteryChargeStatusTooHotOrCold: &CStr =
186    unsafe { CStr::from_bytes_with_nul_unchecked(b"HighOrLowTemperature\0") };
187/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatusgradient?language=objc)
188pub const kIOPMBatteryChargeStatusGradient: &CStr =
189    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryTemperatureGradient\0") };
190/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsidkey?language=objc)
191pub const kIOPMPSAdapterDetailsIDKey: &CStr =
192    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterID\0") };
193/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailswattskey?language=objc)
194pub const kIOPMPSAdapterDetailsWattsKey: &CStr =
195    unsafe { CStr::from_bytes_with_nul_unchecked(b"Watts\0") };
196/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsrevisionkey?language=objc)
197pub const kIOPMPSAdapterDetailsRevisionKey: &CStr =
198    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterRevision\0") };
199/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsserialnumberkey?language=objc)
200pub const kIOPMPSAdapterDetailsSerialNumberKey: &CStr =
201    unsafe { CStr::from_bytes_with_nul_unchecked(b"SerialNumber\0") };
202/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsfamilykey?language=objc)
203pub const kIOPMPSAdapterDetailsFamilyKey: &CStr =
204    unsafe { CStr::from_bytes_with_nul_unchecked(b"FamilyCode\0") };
205/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsamperagekey?language=objc)
206pub const kIOPMPSAdapterDetailsAmperageKey: &CStr =
207    unsafe { CStr::from_bytes_with_nul_unchecked(b"Current\0") };
208/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsdescriptionkey?language=objc)
209pub const kIOPMPSAdapterDetailsDescriptionKey: &CStr =
210    unsafe { CStr::from_bytes_with_nul_unchecked(b"Description\0") };
211/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailspmuconfigurationkey?language=objc)
212pub const kIOPMPSAdapterDetailsPMUConfigurationKey: &CStr =
213    unsafe { CStr::from_bytes_with_nul_unchecked(b"PMUConfiguration\0") };
214/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsvoltage?language=objc)
215pub const kIOPMPSAdapterDetailsVoltage: &CStr =
216    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterVoltage\0") };
217/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailssourceidkey?language=objc)
218pub const kIOPMPSAdapterDetailsSourceIDKey: &CStr =
219    unsafe { CStr::from_bytes_with_nul_unchecked(b"Source\0") };
220/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailserrorflagskey?language=objc)
221pub const kIOPMPSAdapterDetailsErrorFlagsKey: &CStr =
222    unsafe { CStr::from_bytes_with_nul_unchecked(b"ErrorFlags\0") };
223/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailssharedsourcekey?language=objc)
224pub const kIOPMPSAdapterDetailsSharedSourceKey: &CStr =
225    unsafe { CStr::from_bytes_with_nul_unchecked(b"SharedSource\0") };
226/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailscloakedkey?language=objc)
227pub const kIOPMPSAdapterDetailsCloakedKey: &CStr =
228    unsafe { CStr::from_bytes_with_nul_unchecked(b"CloakedSource\0") };
229/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsinvalidwakesecondskey?language=objc)
230pub const kIOPMPSInvalidWakeSecondsKey: &CStr =
231    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryInvalidWakeSeconds\0") };
232/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpspostchargewaitsecondskey?language=objc)
233pub const kIOPMPSPostChargeWaitSecondsKey: &CStr =
234    unsafe { CStr::from_bytes_with_nul_unchecked(b"PostChargeWaitSeconds\0") };
235/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpspostdishargewaitsecondskey?language=objc)
236pub const kIOPMPSPostDishargeWaitSecondsKey: &CStr =
237    unsafe { CStr::from_bytes_with_nul_unchecked(b"PostDischargeWaitSeconds\0") };
238/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgraphicspowerlimitskey?language=objc)
239pub const kIOPMGraphicsPowerLimitsKey: &CStr =
240    unsafe { CStr::from_bytes_with_nul_unchecked(b"Graphics_Power_Limits\0") };
241/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgraphicspowerlimitperformancekey?language=objc)
242pub const kIOPMGraphicsPowerLimitPerformanceKey: &CStr =
243    unsafe { CStr::from_bytes_with_nul_unchecked(b"Graphics_Power_Performance\0") };
244/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitskey?language=objc)
245pub const kIOPMCPUPowerLimitsKey: &CStr =
246    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Power_Limits\0") };
247/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitprocessorspeedkey?language=objc)
248pub const kIOPMCPUPowerLimitProcessorSpeedKey: &CStr =
249    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Speed_Limit\0") };
250/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitprocessorcountkey?language=objc)
251pub const kIOPMCPUPowerLimitProcessorCountKey: &CStr =
252    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Available_CPUs\0") };
253/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitschedulertimekey?language=objc)
254pub const kIOPMCPUPowerLimitSchedulerTimeKey: &CStr =
255    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Scheduler_Limit\0") };
256/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelwarningkey?language=objc)
257pub const kIOPMThermalLevelWarningKey: &CStr =
258    unsafe { CStr::from_bytes_with_nul_unchecked(b"Thermal_Level_Warning\0") };
259/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarninglevelnormal?language=objc)
260pub const kIOPMThermalWarningLevelNormal: c_uint = kIOPMThermalLevelNormal;
261/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarningleveldanger?language=objc)
262pub const kIOPMThermalWarningLevelDanger: c_uint = kIOPMThermalLevelWarning;
263/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarninglevelcrisis?language=objc)
264pub const kIOPMThermalWarningLevelCrisis: c_uint = kIOPMThermalLevelCritical;
265/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonringkey?language=objc)
266pub const kIOPMSettingWakeOnRingKey: &CStr =
267    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On Modem Ring\0") };
268/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingrestartonpowerlosskey?language=objc)
269pub const kIOPMSettingRestartOnPowerLossKey: &CStr =
270    unsafe { CStr::from_bytes_with_nul_unchecked(b"Automatic Restart On Power Loss\0") };
271/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonacchangekey?language=objc)
272pub const kIOPMSettingWakeOnACChangeKey: &CStr =
273    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On AC Change\0") };
274/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingsleeponpowerbuttonkey?language=objc)
275pub const kIOPMSettingSleepOnPowerButtonKey: &CStr =
276    unsafe { CStr::from_bytes_with_nul_unchecked(b"Sleep On Power Button\0") };
277/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonclamshellkey?language=objc)
278pub const kIOPMSettingWakeOnClamshellKey: &CStr =
279    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On Clamshell Open\0") };
280/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingreducebrightnesskey?language=objc)
281pub const kIOPMSettingReduceBrightnessKey: &CStr =
282    unsafe { CStr::from_bytes_with_nul_unchecked(b"ReduceBrightness\0") };
283/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdisplaysleepusesdimkey?language=objc)
284pub const kIOPMSettingDisplaySleepUsesDimKey: &CStr =
285    unsafe { CStr::from_bytes_with_nul_unchecked(b"Display Sleep Uses Dim\0") };
286/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingtimezoneoffsetkey?language=objc)
287pub const kIOPMSettingTimeZoneOffsetKey: &CStr =
288    unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeZoneOffsetSeconds\0") };
289/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingmobilemotionmodulekey?language=objc)
290pub const kIOPMSettingMobileMotionModuleKey: &CStr =
291    unsafe { CStr::from_bytes_with_nul_unchecked(b"MobileMotionModule\0") };
292/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettinggraphicsswitchkey?language=objc)
293pub const kIOPMSettingGraphicsSwitchKey: &CStr =
294    unsafe { CStr::from_bytes_with_nul_unchecked(b"GPUSwitch\0") };
295/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingpromodecontrol?language=objc)
296pub const kIOPMSettingProModeControl: &CStr =
297    unsafe { CStr::from_bytes_with_nul_unchecked(b"ProModeControl\0") };
298/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingpromodedefer?language=objc)
299pub const kIOPMSettingProModeDefer: &CStr =
300    unsafe { CStr::from_bytes_with_nul_unchecked(b"ProModeDefer\0") };
301/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautowakesecondskey?language=objc)
302pub const kIOPMSettingAutoWakeSecondsKey: &CStr =
303    unsafe { CStr::from_bytes_with_nul_unchecked(b"wake\0") };
304/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautowakecalendarkey?language=objc)
305pub const kIOPMSettingAutoWakeCalendarKey: &CStr =
306    unsafe { CStr::from_bytes_with_nul_unchecked(b"WakeByCalendarDate\0") };
307/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautopowersecondskey?language=objc)
308pub const kIOPMSettingAutoPowerSecondsKey: &CStr =
309    unsafe { CStr::from_bytes_with_nul_unchecked(b"poweron\0") };
310/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautopowercalendarkey?language=objc)
311pub const kIOPMSettingAutoPowerCalendarKey: &CStr =
312    unsafe { CStr::from_bytes_with_nul_unchecked(b"PowerByCalendarDate\0") };
313/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdebugwakerelativekey?language=objc)
314pub const kIOPMSettingDebugWakeRelativeKey: &CStr =
315    unsafe { CStr::from_bytes_with_nul_unchecked(b"WakeRelativeToSleep\0") };
316/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdebugpowerrelativekey?language=objc)
317pub const kIOPMSettingDebugPowerRelativeKey: &CStr =
318    unsafe { CStr::from_bytes_with_nul_unchecked(b"PowerRelativeToShutdown\0") };
319/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingmaintenancewakecalendarkey?language=objc)
320pub const kIOPMSettingMaintenanceWakeCalendarKey: &CStr =
321    unsafe { CStr::from_bytes_with_nul_unchecked(b"MaintenanceWakeCalendarDate\0") };
322/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kmaxtype?language=objc)
323pub const kMaxType: c_uint = kPMLastAggressivenessType - 1;
324/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kioremsleepenabledkey?language=objc)
325pub const kIOREMSleepEnabledKey: &CStr =
326    unsafe { CStr::from_bytes_with_nul_unchecked(b"REMSleepEnabled\0") };
327/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryinfokey?language=objc)
328pub const kIOBatteryInfoKey: &CStr =
329    unsafe { CStr::from_bytes_with_nul_unchecked(b"IOBatteryInfo\0") };
330/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycurrentchargekey?language=objc)
331pub const kIOBatteryCurrentChargeKey: &CStr =
332    unsafe { CStr::from_bytes_with_nul_unchecked(b"Current\0") };
333/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycapacitykey?language=objc)
334pub const kIOBatteryCapacityKey: &CStr =
335    unsafe { CStr::from_bytes_with_nul_unchecked(b"Capacity\0") };
336/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryflagskey?language=objc)
337pub const kIOBatteryFlagsKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Flags\0") };
338/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryvoltagekey?language=objc)
339pub const kIOBatteryVoltageKey: &CStr =
340    unsafe { CStr::from_bytes_with_nul_unchecked(b"Voltage\0") };
341/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryamperagekey?language=objc)
342pub const kIOBatteryAmperageKey: &CStr =
343    unsafe { CStr::from_bytes_with_nul_unchecked(b"Amperage\0") };
344/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycyclecountkey?language=objc)
345pub const kIOBatteryCycleCountKey: &CStr =
346    unsafe { CStr::from_bytes_with_nul_unchecked(b"Cycle Count\0") };
347/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagebatterystatushaschanged?language=objc)
348pub const kIOPMMessageBatteryStatusHasChanged: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x100);
349/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmumessagelegacyautowake?language=objc)
350pub const kIOPMUMessageLegacyAutoWake: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x200);
351/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmumessagelegacyautopower?language=objc)
352pub const kIOPMUMessageLegacyAutoPower: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x210);
353/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautowake?language=objc)
354pub const kIOPMAutoWake: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"wake\0") };
355/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautopoweron?language=objc)
356pub const kIOPMAutoPowerOn: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"poweron\0") };
357/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautowakeorpoweron?language=objc)
358pub const kIOPMAutoWakeOrPowerOn: &CStr =
359    unsafe { CStr::from_bytes_with_nul_unchecked(b"wakepoweron\0") };
360/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautosleep?language=objc)
361pub const kIOPMAutoSleep: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"sleep\0") };
362/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautoshutdown?language=objc)
363pub const kIOPMAutoShutdown: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"shutdown\0") };
364/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautorestart?language=objc)
365pub const kIOPMAutoRestart: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"restart\0") };
366/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventtimekey?language=objc)
367pub const kIOPMPowerEventTimeKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"time\0") };
368/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventappnamekey?language=objc)
369pub const kIOPMPowerEventAppNameKey: &CStr =
370    unsafe { CStr::from_bytes_with_nul_unchecked(b"scheduledby\0") };
371/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventapppidkey?language=objc)
372pub const kIOPMPowerEventAppPIDKey: &CStr =
373    unsafe { CStr::from_bytes_with_nul_unchecked(b"appPID\0") };
374/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventtypekey?language=objc)
375pub const kIOPMPowerEventTypeKey: &CStr =
376    unsafe { CStr::from_bytes_with_nul_unchecked(b"eventtype\0") };
377/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetaggressiveness?language=objc)
378pub const kPMSetAggressiveness: c_uint = 0;
379/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgetaggressiveness?language=objc)
380pub const kPMGetAggressiveness: c_uint = 1;
381/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepsystem?language=objc)
382pub const kPMSleepSystem: c_uint = 2;
383/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmallowpowerchange?language=objc)
384pub const kPMAllowPowerChange: c_uint = 3;
385/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmcancelpowerchange?language=objc)
386pub const kPMCancelPowerChange: c_uint = 4;
387/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmshutdownsystem?language=objc)
388pub const kPMShutdownSystem: c_uint = 5;
389/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmrestartsystem?language=objc)
390pub const kPMRestartSystem: c_uint = 6;
391/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepsystemoptions?language=objc)
392pub const kPMSleepSystemOptions: c_uint = 7;
393/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetmaintenancewakecalendar?language=objc)
394pub const kPMSetMaintenanceWakeCalendar: c_uint = 8;
395/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetuserassertionlevels?language=objc)
396pub const kPMSetUserAssertionLevels: c_uint = 9;
397/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmactivitytickle?language=objc)
398pub const kPMActivityTickle: c_uint = 10;
399/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgetsystemsleeptype?language=objc)
400pub const kPMGetSystemSleepType: c_uint = 11;
401/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetclamshellsleepstate?language=objc)
402pub const kPMSetClamshellSleepState: c_uint = 12;
403/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepwakewatchdogenable?language=objc)
404pub const kPMSleepWakeWatchdogEnable: c_uint = 13;
405/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepwakedebugtrig?language=objc)
406pub const kPMSleepWakeDebugTrig: c_uint = 14;
407/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetdisplaypoweron?language=objc)
408pub const kPMSetDisplayPowerOn: c_uint = 15;
409/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetdisplaystate?language=objc)
410pub const kPMSetDisplayState: c_uint = 16;
411/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmrequestidlesleeprevert?language=objc)
412pub const kPMRequestIdleSleepRevert: c_uint = 17;
413/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetldmhibernationdisable?language=objc)
414pub const kPMSetLDMHibernationDisable: c_uint = 18;
415/// [Apple's documentation](https://developer.apple.com/documentation/iokit/knumpmmethods?language=objc)
416pub const kNumPMMethods: c_uint = 19;
417/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorynotifyname?language=objc)
418pub const kIOSystemLoadAdvisoryNotifyName: &CStr = unsafe {
419    CStr::from_bytes_with_nul_unchecked(b"com.apple.system.powermanagement.SystemLoadAdvisory\0")
420};
421/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowernotificationkey?language=objc)
422pub const kIOPMCPUPowerNotificationKey: &CStr =
423    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.system.power.CPU\0") };
424/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarningnotificationkey?language=objc)
425pub const kIOPMThermalWarningNotificationKey: &CStr =
426    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.system.power.thermal_warning\0") };
427/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmaxpowerstates?language=objc)
428pub const kIOPMMaxPowerStates: c_uint = 10;
429/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmmaxpowerstates?language=objc)
430pub const IOPMMaxPowerStates: c_uint = kIOPMMaxPowerStates;
431
432/// Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
433///
434/// These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
435///
436/// The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
437///
438/// The value of capabilityFlags, inputPowerRequirement or outputPowerCharacter may be 0. Most drivers implement their 'OFF' state, used when asleep, by defininf each of the 3 fields as 0.
439///
440/// The bits listed below are only the most common bits used to define a device's power states. Your device's IO family may require that your device specify other input or output power flags to interact properly. Consult family-specific documentation to determine if your IOPower plane parents or children require other power flags; they probably don't.
441///
442///
443///
444///
445/// Indicates device is in a low power state. May be bitwis-OR'd together
446/// with kIOPMDeviceUsable flag, to indicate the device is still usable.
447///
448/// A device with a capability of kIOPMLowPower may:
449/// Require either 0 or kIOPMPowerOn from its power parent
450/// Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
451/// to its power plane children.
452///
453/// Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
454///
455///
456/// In the capability field of a power state, disallows idle system sleep while the device is in that state.
457///
458/// For example, displays and disks set this capability for their ON power state; since the system may not idle sleep while the display (and thus keyboard or mouse) or the disk is active.
459///
460/// Useful only as a Capability.
461///
462///
463/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
464///
465///
466/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
467///
468///
469/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
470///
471///
472/// Used only by certain IOKit Families (USB). Not defined or used by generic Power Management. Read your family documentation to see if you should define a powerstate using these capabilities.
473///
474///
475/// Indicates the initial power state for the device. If
476/// <code>
477/// initialPowerStateForDomainState()
478/// </code>
479/// returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's
480/// <code>
481/// setPowerState()
482/// </code>
483/// .
484///
485///
486/// An indication that the power flags represent the state of the root power
487/// domain. This bit must not be set in the IOPMPowerState structure.
488/// Power Management may pass this bit to initialPowerStateForDomainState()
489/// to map from a global system state to the desired device state.
490///
491/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmpowerflags?language=objc)
492pub type IOPMPowerFlags = c_ulong;
493
494/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoweron?language=objc)
495pub const kIOPMPowerOn: c_uint = 0x00000002;
496/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeviceusable?language=objc)
497pub const kIOPMDeviceUsable: c_uint = 0x00008000;
498/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmlowpower?language=objc)
499pub const kIOPMLowPower: c_uint = 0x00010000;
500/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventidlesleep?language=objc)
501pub const kIOPMPreventIdleSleep: c_uint = 0x00000040;
502/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepcapability?language=objc)
503pub const kIOPMSleepCapability: c_uint = 0x00000004;
504/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrestartcapability?language=objc)
505pub const kIOPMRestartCapability: c_uint = 0x00000080;
506/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleep?language=objc)
507pub const kIOPMSleep: c_uint = 0x00000001;
508/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrestart?language=objc)
509pub const kIOPMRestart: c_uint = 0x00000080;
510/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopminitialdevicestate?language=objc)
511pub const kIOPMInitialDeviceState: c_uint = 0x00000100;
512/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrootdomainstate?language=objc)
513pub const kIOPMRootDomainState: c_uint = 0x00000200;
514
515/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclocknormal?language=objc)
516pub const kIOPMClockNormal: c_uint = 0x0004;
517/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclockrunning?language=objc)
518pub const kIOPMClockRunning: c_uint = 0x0008;
519/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventsystemsleep?language=objc)
520pub const kIOPMPreventSystemSleep: c_uint = 0x0010;
521/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdoze?language=objc)
522pub const kIOPMDoze: c_uint = 0x0400;
523/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmchildclamp?language=objc)
524pub const kIOPMChildClamp: c_uint = 0x0080;
525/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmchildclamp2?language=objc)
526pub const kIOPMChildClamp2: c_uint = 0x0200;
527/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotpowermanaged?language=objc)
528pub const kIOPMNotPowerManaged: c_uint = 0x0800;
529
530/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmaxperformance?language=objc)
531pub const kIOPMMaxPerformance: c_uint = 0x4000;
532/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpassthrough?language=objc)
533pub const kIOPMPassThrough: c_uint = 0x0100;
534/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmauxpoweron?language=objc)
535pub const kIOPMAuxPowerOn: c_uint = 0x0020;
536/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotattainable?language=objc)
537pub const kIOPMNotAttainable: c_uint = 0x0001;
538/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcontextretained?language=objc)
539pub const kIOPMContextRetained: c_uint = 0x2000;
540/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmconfigretained?language=objc)
541pub const kIOPMConfigRetained: c_uint = 0x1000;
542/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmstaticpowervalid?language=objc)
543pub const kIOPMStaticPowerValid: c_uint = 0x0800;
544/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsoftsleep?language=objc)
545pub const kIOPMSoftSleep: c_uint = 0x0400;
546/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcapabilitiesmask?language=objc)
547pub const kIOPMCapabilitiesMask: c_uint = kIOPMPowerOn
548    | kIOPMDeviceUsable
549    | kIOPMMaxPerformance
550    | kIOPMContextRetained
551    | kIOPMConfigRetained
552    | kIOPMSleepCapability
553    | kIOPMRestartCapability;
554
555/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotattainable?language=objc)
556pub const IOPMNotAttainable: c_uint = kIOPMNotAttainable;
557/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmpoweron?language=objc)
558pub const IOPMPowerOn: c_uint = kIOPMPowerOn;
559/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmclocknormal?language=objc)
560pub const IOPMClockNormal: c_uint = kIOPMClockNormal;
561/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmclockrunning?language=objc)
562pub const IOPMClockRunning: c_uint = kIOPMClockRunning;
563/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmauxpoweron?language=objc)
564pub const IOPMAuxPowerOn: c_uint = kIOPMAuxPowerOn;
565/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmdeviceusable?language=objc)
566pub const IOPMDeviceUsable: c_uint = kIOPMDeviceUsable;
567/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmmaxperformance?language=objc)
568pub const IOPMMaxPerformance: c_uint = kIOPMMaxPerformance;
569/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcontextretained?language=objc)
570pub const IOPMContextRetained: c_uint = kIOPMContextRetained;
571/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmconfigretained?language=objc)
572pub const IOPMConfigRetained: c_uint = kIOPMConfigRetained;
573/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotpowermanaged?language=objc)
574pub const IOPMNotPowerManaged: c_uint = kIOPMNotPowerManaged;
575/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmsoftsleep?language=objc)
576pub const IOPMSoftSleep: c_uint = kIOPMSoftSleep;
577
578/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnexthigherstate?language=objc)
579pub const kIOPMNextHigherState: c_uint = 1;
580/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmhigheststate?language=objc)
581pub const kIOPMHighestState: c_uint = 2;
582/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnextlowerstate?language=objc)
583pub const kIOPMNextLowerState: c_uint = 3;
584/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmloweststate?language=objc)
585pub const kIOPMLowestState: c_uint = 4;
586
587/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnexthigherstate?language=objc)
588pub const IOPMNextHigherState: c_uint = kIOPMNextHigherState;
589/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmhigheststate?language=objc)
590pub const IOPMHighestState: c_uint = kIOPMHighestState;
591/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnextlowerstate?language=objc)
592pub const IOPMNextLowerState: c_uint = kIOPMNextLowerState;
593/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmloweststate?language=objc)
594pub const IOPMLowestState: c_uint = kIOPMLowestState;
595
596/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbroadcastaggressiveness?language=objc)
597pub const kIOPMBroadcastAggressiveness: c_uint = 1;
598/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmunidledevice?language=objc)
599pub const kIOPMUnidleDevice: c_uint = 2;
600
601/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmunknown?language=objc)
602pub const kIOPMUnknown: c_uint = 0xFFFF;
603
604/// kIOPMDriverAssertionCPUBit
605/// When set, PM kernel will prefer to leave the CPU and core hardware
606/// running in "Dark Wake" state, instead of sleeping.
607///
608/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertioncpubit?language=objc)
609pub const kIOPMDriverAssertionCPUBit: c_uint = 0x01;
610/// kIOPMDriverAssertionPreventSystemIdleSleepBit
611/// When set, the system should not idle sleep. This does not prevent
612/// demand sleep.
613///
614/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionpreventsystemidlesleepbit?language=objc)
615pub const kIOPMDriverAssertionPreventSystemIdleSleepBit: c_uint = 0x02;
616/// kIOPMDriverAssertionUSBExternalDeviceBit
617/// When set, driver is informing PM that an external USB device is attached.
618///
619/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionusbexternaldevicebit?language=objc)
620pub const kIOPMDriverAssertionUSBExternalDeviceBit: c_uint = 0x04;
621/// kIOPMDriverAssertionBluetoothHIDDevicePairedBit
622/// When set, driver is informing PM that a Bluetooth HID device is paired.
623///
624/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionbluetoothhiddevicepairedbit?language=objc)
625pub const kIOPMDriverAssertionBluetoothHIDDevicePairedBit: c_uint = 0x08;
626/// kIOPMDriverAssertionExternalMediaMountedBit
627/// When set, driver is informing PM that an external media is mounted.
628///
629/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionexternalmediamountedbit?language=objc)
630pub const kIOPMDriverAssertionExternalMediaMountedBit: c_uint = 0x10;
631/// kIOPMDriverAssertionReservedBit5
632/// Reserved for Thunderbolt.
633///
634/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionreservedbit5?language=objc)
635pub const kIOPMDriverAssertionReservedBit5: c_uint = 0x20;
636/// kIOPMDriverAssertionPreventDisplaySleepBit
637/// When set, the display should remain powered on while the system's awake.
638///
639/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionpreventdisplaysleepbit?language=objc)
640pub const kIOPMDriverAssertionPreventDisplaySleepBit: c_uint = 0x40;
641/// kIOPMDriverAssertionReservedBit7
642/// Reserved for storage family.
643///
644/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionreservedbit7?language=objc)
645pub const kIOPMDriverAssertionReservedBit7: c_uint = 0x80;
646/// kIOPMDriverAssertionMagicPacketWakeEnabledBit
647/// When set, driver is informing PM that magic packet wake is enabled.
648///
649/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionmagicpacketwakeenabledbit?language=objc)
650pub const kIOPMDriverAssertionMagicPacketWakeEnabledBit: c_uint = 0x100;
651/// kIOPMDriverAssertionNetworkKeepAliveActiveBit
652/// When set, driver is informing PM that it is holding the network
653/// interface up to do TCPKeepAlive
654///
655/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionnetworkkeepaliveactivebit?language=objc)
656pub const kIOPMDriverAssertionNetworkKeepAliveActiveBit: c_uint = 0x200;
657/// kIOPMDriverAssertionForceWakeupBit
658/// When set, the system will immediately wake up the CPU after going to sleep.
659///
660/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionforcewakeupbit?language=objc)
661pub const kIOPMDriverAssertionForceWakeupBit: c_uint = 0x400;
662/// kIOPMDriverAssertionForceFullWakeupBit
663/// When set, the system will immediately do a full wakeup after going to sleep.
664///
665/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionforcefullwakeupbit?language=objc)
666pub const kIOPMDriverAssertionForceFullWakeupBit: c_uint = 0x800;
667
668/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kclamshellstatebit?language=objc)
669pub const kClamshellStateBit: c_uint = 1 << 0;
670/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kclamshellsleepbit?language=objc)
671pub const kClamshellSleepBit: c_uint = 1 << 1;
672
673/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kinflowforciblyenabledbit?language=objc)
674pub const kInflowForciblyEnabledBit: c_uint = 1 << 0;
675
676/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepnow?language=objc)
677pub const kIOPMSleepNow: c_uint = 1 << 0;
678/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmallowsleep?language=objc)
679pub const kIOPMAllowSleep: c_uint = 1 << 1;
680/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventsleep?language=objc)
681pub const kIOPMPreventSleep: c_uint = 1 << 2;
682/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowerbutton?language=objc)
683pub const kIOPMPowerButton: c_uint = 1 << 3;
684/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellclosed?language=objc)
685pub const kIOPMClamshellClosed: c_uint = 1 << 4;
686/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoweremergency?language=objc)
687pub const kIOPMPowerEmergency: c_uint = 1 << 5;
688/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdisableclamshell?language=objc)
689pub const kIOPMDisableClamshell: c_uint = 1 << 6;
690/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmenableclamshell?language=objc)
691pub const kIOPMEnableClamshell: c_uint = 1 << 7;
692/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmprocessorspeedchange?language=objc)
693pub const kIOPMProcessorSpeedChange: c_uint = 1 << 8;
694/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmovertemp?language=objc)
695pub const kIOPMOverTemp: c_uint = 1 << 9;
696/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellopened?language=objc)
697pub const kIOPMClamshellOpened: c_uint = 1 << 10;
698/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdwovertemp?language=objc)
699pub const kIOPMDWOverTemp: c_uint = 1 << 11;
700/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowerbuttonup?language=objc)
701pub const kIOPMPowerButtonUp: c_uint = 1 << 12;
702/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpromodeengaged?language=objc)
703pub const kIOPMProModeEngaged: c_uint = 1 << 13;
704/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpromodedisengaged?language=objc)
705pub const kIOPMProModeDisengaged: c_uint = 1 << 14;
706
707/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnoerr?language=objc)
708pub const kIOPMNoErr: c_uint = 0;
709/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmackimplied?language=objc)
710pub const kIOPMAckImplied: c_uint = 0;
711/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmwillacklater?language=objc)
712pub const kIOPMWillAckLater: c_uint = 1;
713/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbadspecification?language=objc)
714pub const kIOPMBadSpecification: c_uint = 4;
715/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnosuchstate?language=objc)
716pub const kIOPMNoSuchState: c_uint = 5;
717/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcannotraisepower?language=objc)
718pub const kIOPMCannotRaisePower: c_uint = 6;
719/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmparametererror?language=objc)
720pub const kIOPMParameterError: c_uint = 7;
721/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotyetinitialized?language=objc)
722pub const kIOPMNotYetInitialized: c_uint = 8;
723/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnoerr?language=objc)
724pub const IOPMNoErr: c_uint = kIOPMNoErr;
725/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmackimplied?language=objc)
726pub const IOPMAckImplied: c_uint = kIOPMAckImplied;
727/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmwillacklater?language=objc)
728pub const IOPMWillAckLater: c_uint = kIOPMWillAckLater;
729/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmbadspecification?language=objc)
730pub const IOPMBadSpecification: c_uint = kIOPMBadSpecification;
731/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnosuchstate?language=objc)
732pub const IOPMNoSuchState: c_uint = kIOPMNoSuchState;
733/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcannotraisepower?language=objc)
734pub const IOPMCannotRaisePower: c_uint = kIOPMCannotRaisePower;
735/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmparametererror?language=objc)
736pub const IOPMParameterError: c_uint = kIOPMParameterError;
737/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotyetinitialized?language=objc)
738pub const IOPMNotYetInitialized: c_uint = kIOPMNotYetInitialized;
739
740/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationleft?language=objc)
741pub const kIOPMPSLocationLeft: c_uint = 1001;
742/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationright?language=objc)
743pub const kIOPMPSLocationRight: c_uint = 1002;
744
745/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmundefinedvalue?language=objc)
746pub const kIOPMUndefinedValue: c_uint = 0;
747/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoorvalue?language=objc)
748pub const kIOPMPoorValue: c_uint = 1;
749/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmfairvalue?language=objc)
750pub const kIOPMFairValue: c_uint = 2;
751/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgoodvalue?language=objc)
752pub const kIOPMGoodValue: c_uint = 3;
753
754/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodedisconnected?language=objc)
755pub const kIOPSFamilyCodeDisconnected: c_int = 0;
756/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodefirewire?language=objc)
757pub const kIOPSFamilyCodeFirewire: c_int = iokit_family_err!(sub_iokit_firewire, 0);
758/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbhost?language=objc)
759pub const kIOPSFamilyCodeUSBHost: c_int = iokit_family_err!(sub_iokit_usb, 0);
760/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbhostsuspended?language=objc)
761pub const kIOPSFamilyCodeUSBHostSuspended: c_int = iokit_family_err!(sub_iokit_usb, 1);
762/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbdevice?language=objc)
763pub const kIOPSFamilyCodeUSBDevice: c_int = iokit_family_err!(sub_iokit_usb, 2);
764/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbadapter?language=objc)
765pub const kIOPSFamilyCodeUSBAdapter: c_int = iokit_family_err!(sub_iokit_usb, 3);
766/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingportdedicated?language=objc)
767pub const kIOPSFamilyCodeUSBChargingPortDedicated: c_int = iokit_family_err!(sub_iokit_usb, 4);
768/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingportdownstream?language=objc)
769pub const kIOPSFamilyCodeUSBChargingPortDownstream: c_int = iokit_family_err!(sub_iokit_usb, 5);
770/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingport?language=objc)
771pub const kIOPSFamilyCodeUSBChargingPort: c_int = iokit_family_err!(sub_iokit_usb, 6);
772/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbunknown?language=objc)
773pub const kIOPSFamilyCodeUSBUnknown: c_int = iokit_family_err!(sub_iokit_usb, 7);
774/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbcbrick?language=objc)
775pub const kIOPSFamilyCodeUSBCBrick: c_int = iokit_family_err!(sub_iokit_usb, 8);
776/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbctypec?language=objc)
777pub const kIOPSFamilyCodeUSBCTypeC: c_int = iokit_family_err!(sub_iokit_usb, 9);
778/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbcpd?language=objc)
779pub const kIOPSFamilyCodeUSBCPD: c_int = iokit_family_err!(sub_iokit_usb, 10);
780/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeac?language=objc)
781pub const kIOPSFamilyCodeAC: c_int = iokit_family_err!(sub_iokit_pmu, 0);
782/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal?language=objc)
783pub const kIOPSFamilyCodeExternal: c_int = iokit_family_err!(sub_iokit_pmu, 1);
784/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal2?language=objc)
785pub const kIOPSFamilyCodeExternal2: c_int = iokit_family_err!(sub_iokit_pmu, 2);
786/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal3?language=objc)
787pub const kIOPSFamilyCodeExternal3: c_int = iokit_family_err!(sub_iokit_pmu, 3);
788/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal4?language=objc)
789pub const kIOPSFamilyCodeExternal4: c_int = iokit_family_err!(sub_iokit_pmu, 4);
790/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal5?language=objc)
791pub const kIOPSFamilyCodeExternal5: c_int = iokit_family_err!(sub_iokit_pmu, 5);
792/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal6?language=objc)
793pub const kIOPSFamilyCodeExternal6: c_int = iokit_family_err!(sub_iokit_pmu, 6);
794/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal7?language=objc)
795pub const kIOPSFamilyCodeExternal7: c_int = iokit_family_err!(sub_iokit_pmu, 7);
796/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal8?language=objc)
797pub const kIOPSFamilyCodeExternal8: c_int = iokit_family_err!(sub_iokit_pmu, 8);
798/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeunsupportedregion?language=objc)
799pub const kIOPSFamilyCodeUnsupportedRegion: c_int = iokit_family_err!(sub_iokit_pmu, 9);
800
801/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagnoerrors?language=objc)
802pub const kIOPSAdapterErrorFlagNoErrors: c_uint = 0;
803/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflaginsufficientavailablepower?language=objc)
804pub const kIOPSAdapterErrorFlagInsufficientAvailablePower: c_uint = 1 << 1;
805/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagforeignobjectdetected?language=objc)
806pub const kIOPSAdapterErrorFlagForeignObjectDetected: c_uint = 1 << 2;
807/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagdeviceneedstoberepositioned?language=objc)
808pub const kIOPSAdapterErrorFlagDeviceNeedsToBeRepositioned: c_uint = 1 << 3;
809
810/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelnormal?language=objc)
811pub const kIOPMThermalLevelNormal: c_uint = 0;
812/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalleveldanger?language=objc)
813pub const kIOPMThermalLevelDanger: c_uint = 5;
814/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelcritical?language=objc)
815pub const kIOPMThermalLevelCritical: c_uint = 10;
816/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelwarning?language=objc)
817pub const kIOPMThermalLevelWarning: c_uint = 100;
818/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalleveltrap?language=objc)
819pub const kIOPMThermalLevelTrap: c_uint = 110;
820/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelunknown?language=objc)
821pub const kIOPMThermalLevelUnknown: c_uint = 255;
822
823/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcalendarstruct?language=objc)
824#[repr(C)]
825#[derive(Clone, Copy, Debug, PartialEq)]
826pub struct IOPMCalendarStruct {
827    pub year: u32,
828    pub month: u8,
829    pub day: u8,
830    pub hour: u8,
831    pub minute: u8,
832    pub second: u8,
833    pub selector: u8,
834}
835
836#[cfg(feature = "objc2")]
837unsafe impl Encode for IOPMCalendarStruct {
838    const ENCODING: Encoding = Encoding::Struct(
839        "IOPMCalendarStruct",
840        &[
841            <u32>::ENCODING,
842            <u8>::ENCODING,
843            <u8>::ENCODING,
844            <u8>::ENCODING,
845            <u8>::ENCODING,
846            <u8>::ENCODING,
847            <u8>::ENCODING,
848        ],
849    );
850}
851
852#[cfg(feature = "objc2")]
853unsafe impl RefEncode for IOPMCalendarStruct {
854    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
855}
856
857/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgeneralaggressiveness?language=objc)
858pub const kPMGeneralAggressiveness: c_uint = 0;
859/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestodim?language=objc)
860pub const kPMMinutesToDim: c_uint = 1;
861/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestospindown?language=objc)
862pub const kPMMinutesToSpinDown: c_uint = 2;
863/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestosleep?language=objc)
864pub const kPMMinutesToSleep: c_uint = 3;
865/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmethernetwakeonlansettings?language=objc)
866pub const kPMEthernetWakeOnLANSettings: c_uint = 4;
867/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetprocessorspeed?language=objc)
868pub const kPMSetProcessorSpeed: c_uint = 5;
869/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmpowersource?language=objc)
870pub const kPMPowerSource: c_uint = 6;
871/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmmotionsensor?language=objc)
872pub const kPMMotionSensor: c_uint = 7;
873/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmlastaggressivenesstype?language=objc)
874pub const kPMLastAggressivenessType: c_uint = 8;
875
876/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopminternalpower?language=objc)
877pub const kIOPMInternalPower: c_uint = 1;
878/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmexternalpower?language=objc)
879pub const kIOPMExternalPower: c_uint = 2;
880
881/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryinstalled?language=objc)
882pub const kIOBatteryInstalled: c_uint = 1 << 2;
883/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycharge?language=objc)
884pub const kIOBatteryCharge: c_uint = 1 << 1;
885/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterychargerconnect?language=objc)
886pub const kIOBatteryChargerConnect: c_uint = 1 << 0;
887
888/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmacinstalled?language=objc)
889pub const kIOPMACInstalled: c_uint = kIOBatteryChargerConnect;
890/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterycharging?language=objc)
891pub const kIOPMBatteryCharging: c_uint = kIOBatteryCharge;
892/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatteryinstalled?language=objc)
893pub const kIOPMBatteryInstalled: c_uint = kIOBatteryInstalled;
894/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmupsinstalled?language=objc)
895pub const kIOPMUPSInstalled: c_uint = 1 << 3;
896/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatteryatwarn?language=objc)
897pub const kIOPMBatteryAtWarn: c_uint = 1 << 4;
898/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterydepleted?language=objc)
899pub const kIOPMBatteryDepleted: c_uint = 1 << 5;
900/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmacnochargecapability?language=objc)
901pub const kIOPMACnoChargeCapability: c_uint = 1 << 6;
902/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrawlowbattery?language=objc)
903pub const kIOPMRawLowBattery: c_uint = 1 << 7;
904/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmforcelowspeed?language=objc)
905pub const kIOPMForceLowSpeed: c_uint = 1 << 8;
906/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclosedclamshell?language=objc)
907pub const kIOPMClosedClamshell: c_uint = 1 << 9;
908/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellstateonwake?language=objc)
909pub const kIOPMClamshellStateOnWake: c_uint = 1 << 10;
910
911/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopowerstatechangenotification?language=objc)
912#[repr(C)]
913#[derive(Clone, Copy, Debug, PartialEq)]
914pub struct IOPowerStateChangeNotification {
915    pub powerRef: *mut c_void,
916    pub returnValue: c_ulong,
917    pub stateNumber: c_ulong,
918    pub stateFlags: IOPMPowerFlags,
919}
920
921#[cfg(feature = "objc2")]
922unsafe impl Encode for IOPowerStateChangeNotification {
923    const ENCODING: Encoding = Encoding::Struct(
924        "IOPowerStateChangeNotification",
925        &[
926            <*mut c_void>::ENCODING,
927            Encoding::C_ULONG,
928            Encoding::C_ULONG,
929            <IOPMPowerFlags>::ENCODING,
930        ],
931    );
932}
933
934#[cfg(feature = "objc2")]
935unsafe impl RefEncode for IOPowerStateChangeNotification {
936    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
937}
938
939/// [Apple's documentation](https://developer.apple.com/documentation/iokit/sleepwakenote?language=objc)
940pub type sleepWakeNote = IOPowerStateChangeNotification;
941
942/// A structure describing a system capability change.
943///
944/// A system capability change is a system level transition from a set
945/// of system capabilities to a new set of system capabilities. Power management
946/// sends a
947/// <code>
948/// kIOMessageSystemCapabilityChange
949/// </code>
950/// message and provides
951/// this structure as the message data (by reference) to
952/// <code>
953/// gIOPriorityPowerStateInterest
954/// </code>
955/// clients when system capability
956/// changes.
957/// Field: notifyRef An identifier for this message notification. Clients with pending
958/// I/O can signal completion by calling
959/// <code>
960/// allowPowerChange()
961/// </code>
962/// with this
963/// value as the argument. Clients that are able to process the notification
964/// synchronously should ignore this field.
965/// Field: maxWaitForReply A return value to the caller indicating the maximum time in
966/// microseconds to wait for the
967/// <code>
968/// allowPowerChange()
969/// </code>
970/// call. The default
971/// value is zero, which indicates the client processing has finished, and power
972/// management should not wait for an
973/// <code>
974/// allowPowerChange()
975/// </code>
976/// call.
977/// Field: changeFlags Flags will be set to indicate whether the notification precedes
978/// the capability change (
979/// <code>
980/// kIOPMSystemCapabilityWillChange
981/// </code>
982/// ), or after
983/// the capability change has occurred (
984/// <code>
985/// kIOPMSystemCapabilityDidChange
986/// </code>
987/// ).
988/// Field: __reserved1 Set to zero.
989/// Field: fromCapabilities The system capabilities at the start of the transition.
990/// Field: toCapabilities The system capabilities at the end of the transition.
991/// Field: __reserved2 Set to zero.
992///
993/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmsystemcapabilitychangeparameters?language=objc)
994#[repr(C)]
995#[derive(Clone, Copy, Debug, PartialEq)]
996pub struct IOPMSystemCapabilityChangeParameters {
997    pub notifyRef: u32,
998    pub maxWaitForReply: u32,
999    pub changeFlags: u32,
1000    pub(crate) __reserved1: u32,
1001    pub fromCapabilities: u32,
1002    pub toCapabilities: u32,
1003    pub(crate) __reserved2: [u32; 4],
1004}
1005
1006#[cfg(feature = "objc2")]
1007unsafe impl Encode for IOPMSystemCapabilityChangeParameters {
1008    const ENCODING: Encoding = Encoding::Struct(
1009        "IOPMSystemCapabilityChangeParameters",
1010        &[
1011            <u32>::ENCODING,
1012            <u32>::ENCODING,
1013            <u32>::ENCODING,
1014            <u32>::ENCODING,
1015            <u32>::ENCODING,
1016            <u32>::ENCODING,
1017            <[u32; 4]>::ENCODING,
1018        ],
1019    );
1020}
1021
1022#[cfg(feature = "objc2")]
1023unsafe impl RefEncode for IOPMSystemCapabilityChangeParameters {
1024    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1025}
1026
1027/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitywillchange?language=objc)
1028pub const kIOPMSystemCapabilityWillChange: c_uint = 0x01;
1029/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitydidchange?language=objc)
1030pub const kIOPMSystemCapabilityDidChange: c_uint = 0x02;
1031
1032/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitycpu?language=objc)
1033pub const kIOPMSystemCapabilityCPU: c_uint = 0x01;
1034/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitygraphics?language=objc)
1035pub const kIOPMSystemCapabilityGraphics: c_uint = 0x02;
1036/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilityaudio?language=objc)
1037pub const kIOPMSystemCapabilityAudio: c_uint = 0x04;
1038/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitynetwork?language=objc)
1039pub const kIOPMSystemCapabilityNetwork: c_uint = 0x08;
1040/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilityaot?language=objc)
1041pub const kIOPMSystemCapabilityAOT: c_uint = 0x10;
1042
1043/// Finds the Root Power Domain IOService.
1044///
1045/// Parameter `master_device_port`: Just pass in MACH_PORT_NULL for master device port.
1046///
1047/// Returns: Returns a io_connect_t handle on the root domain. Must be released with IOServiceClose() when done.
1048#[cfg(feature = "libc")]
1049#[inline]
1050pub extern "C-unwind" fn IOPMFindPowerManagement(
1051    master_device_port: libc::mach_port_t,
1052) -> io_connect_t {
1053    extern "C-unwind" {
1054        fn IOPMFindPowerManagement(master_device_port: libc::mach_port_t) -> io_connect_t;
1055    }
1056    unsafe { IOPMFindPowerManagement(master_device_port) }
1057}
1058
1059/// Sets one of the aggressiveness factors in IOKit Power Management.
1060///
1061/// Parameter `fb`: Representation of the Root Power Domain from IOPMFindPowerManagement.
1062///
1063/// Parameter `type`: Specifies which aggressiveness factor is being set.
1064///
1065/// Parameter `aggressiveness`: New value of the aggressiveness factor.
1066///
1067/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1068#[cfg(feature = "libc")]
1069#[inline]
1070pub extern "C-unwind" fn IOPMSetAggressiveness(
1071    fb: io_connect_t,
1072    r#type: c_ulong,
1073    aggressiveness: c_ulong,
1074) -> IOReturn {
1075    extern "C-unwind" {
1076        fn IOPMSetAggressiveness(
1077            fb: io_connect_t,
1078            r#type: c_ulong,
1079            aggressiveness: c_ulong,
1080        ) -> IOReturn;
1081    }
1082    unsafe { IOPMSetAggressiveness(fb, r#type, aggressiveness) }
1083}
1084
1085extern "C-unwind" {
1086    /// Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.
1087    ///
1088    /// Parameter `fb`: Representation of the Root Power Domain from IOPMFindPowerManagement.
1089    ///
1090    /// Parameter `type`: Specifies which aggressiveness factor is being retrieved.
1091    ///
1092    /// Parameter `aggressiveness`: Points to where to store the retrieved value of the aggressiveness factor.
1093    ///
1094    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1095    ///
1096    /// # Safety
1097    ///
1098    /// `aggressiveness` must be a valid pointer.
1099    #[cfg(feature = "libc")]
1100    pub fn IOPMGetAggressiveness(
1101        fb: io_connect_t,
1102        r#type: c_ulong,
1103        aggressiveness: *mut c_ulong,
1104    ) -> IOReturn;
1105}
1106
1107/// Tells whether the system supports full sleep, or just doze
1108///
1109/// Returns: Returns true if the system supports sleep, false if some hardware prevents full sleep.
1110#[cfg(feature = "libc")]
1111#[inline]
1112pub extern "C-unwind" fn IOPMSleepEnabled() -> bool {
1113    extern "C-unwind" {
1114        fn IOPMSleepEnabled() -> libc::boolean_t;
1115    }
1116    let ret = unsafe { IOPMSleepEnabled() };
1117    ret != 0
1118}
1119
1120/// Request that the system initiate sleep.
1121///
1122/// For security purposes, caller must be root or the console user.
1123///
1124/// Parameter `fb`: Port used to communicate to the kernel,  from IOPMFindPowerManagement.
1125///
1126/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1127#[cfg(feature = "libc")]
1128#[inline]
1129pub extern "C-unwind" fn IOPMSleepSystem(fb: io_connect_t) -> IOReturn {
1130    extern "C-unwind" {
1131        fn IOPMSleepSystem(fb: io_connect_t) -> IOReturn;
1132    }
1133    unsafe { IOPMSleepSystem(fb) }
1134}
1135
1136extern "C-unwind" {
1137    /// Request battery data from the system.
1138    ///
1139    /// This API is supported, but not recommended. Developers should prefer to use
1140    /// the IOPowerSources API. IOPowerSources provides more battery data, and notifications
1141    /// when battery state changes)
1142    ///
1143    /// Parameter `masterPort`: The master port obtained from IOMasterPort(). Just pass MACH_PORT_NULL.
1144    ///
1145    /// Parameter `info`: A CFArray of CFDictionaries containing raw battery data. Use these keys, defined in IOPM.h
1146    /// to read from the dictionary:
1147    /// <pre>
1148    /// <code>
1149    ///
1150    /// ```text
1151    ///  kIOBatteryInfoKey
1152    /// ```
1153    ///
1154    /// </code>
1155    /// <code>
1156    ///
1157    /// ```text
1158    ///  kIOBatteryCurrentChargeKey
1159    /// ```
1160    ///
1161    /// </code>
1162    /// <code>
1163    ///
1164    /// ```text
1165    ///  kIOBatteryCapacityKey
1166    /// ```
1167    ///
1168    /// </code>
1169    /// <code>
1170    ///
1171    /// ```text
1172    ///  kIOBatteryFlagsKey
1173    /// ```
1174    ///
1175    /// </code>
1176    /// <code>
1177    ///
1178    /// ```text
1179    ///  kIOBatteryVoltageKey
1180    /// ```
1181    ///
1182    /// </code>
1183    /// <code>
1184    ///
1185    /// ```text
1186    ///  kIOBatteryAmperageKey
1187    /// ```
1188    ///
1189    /// </code>
1190    /// <code>
1191    ///
1192    /// ```text
1193    ///  kIOBatteryCycleCountKey
1194    /// ```
1195    ///
1196    /// </code>
1197    /// </pre>
1198    ///
1199    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1200    ///
1201    /// # Safety
1202    ///
1203    /// `info` must be a valid pointer.
1204    #[cfg(feature = "libc")]
1205    pub fn IOPMCopyBatteryInfo(
1206        master_port: libc::mach_port_t,
1207        info: *mut *const CFArray,
1208    ) -> IOReturn;
1209}
1210
1211extern "C-unwind" {
1212    /// DEPRECATED - An obsolete method for interacting with driver power state changes.
1213    ///
1214    /// This function is obsolete and deprecated. To receive notifications of driver power state changes,
1215    /// Please use IOServiceAddInterestNotification with interest type gIOGeneralInterest instead.
1216    ///
1217    /// # Safety
1218    ///
1219    /// - `refcon` must be a valid pointer.
1220    /// - `the_port_ref` must be a valid pointer.
1221    /// - `callback` must be implemented correctly.
1222    /// - `notifier` must be a valid pointer.
1223    #[cfg(feature = "libc")]
1224    #[deprecated]
1225    pub fn IORegisterApp(
1226        refcon: *mut c_void,
1227        the_driver: io_service_t,
1228        the_port_ref: *mut IONotificationPortRef,
1229        callback: IOServiceInterestCallback,
1230        notifier: *mut io_object_t,
1231    ) -> io_connect_t;
1232}
1233
1234extern "C-unwind" {
1235    /// Connects the caller to the Root Power Domain IOService for the purpose of receiving sleep
1236    /// &
1237    /// wake notifications for the system.
1238    /// Does not provide system shutdown and restart notifications.
1239    ///
1240    /// Provides sleep/wake notifications to applications. Requires that applications acknowledge
1241    /// some, but not all notifications. Register for sleep/wake notifications will deliver these messages
1242    /// over the sleep/wake lifecycle:
1243    /// <ul>
1244    /// <li>
1245    /// kIOMessageSystemWillSleep is delivered at the point the system is initiating a
1246    /// non-abortable sleep.
1247    /// Callers MUST acknowledge this event by calling
1248    ///
1249    /// ```text
1250    ///  IOAllowPowerChange
1251    /// ```
1252    ///
1253    /// .
1254    /// If a caller does not acknowledge the sleep notification, the sleep will continue anyway after
1255    /// a 30 second timeout (resulting in bad user experience).
1256    /// Delivered before any hardware is powered off.
1257    ///
1258    /// <li>
1259    /// kIOMessageSystemWillPowerOn is delivered at early wakeup time, before most hardware has been
1260    /// powered on. Be aware that any attempts to access disk, network, the display, etc. may result
1261    /// in errors or blocking your process until those resources become available.
1262    /// Caller must NOT acknowledge kIOMessageSystemWillPowerOn; the caller must simply return from its handler.
1263    ///
1264    /// <li>
1265    /// kIOMessageSystemHasPoweredOn is delivered at wakeup completion time, after all device drivers and
1266    /// hardware have handled the wakeup event. Expect this event 1-5 or more seconds after initiating
1267    /// system wakeup.
1268    /// Caller must NOT acknowledge kIOMessageSystemHasPoweredOn; the caller must simply return from its handler.
1269    ///
1270    /// <li>
1271    /// kIOMessageCanSystemSleep indicates the system is pondering an idle sleep, but gives apps the
1272    /// chance to veto that sleep attempt.
1273    /// Caller must acknowledge kIOMessageCanSystemSleep by calling
1274    ///
1275    /// ```text
1276    ///  IOAllowPowerChange
1277    /// ```
1278    ///
1279    /// or
1280    ///
1281    /// ```text
1282    ///  IOCancelPowerChange
1283    /// ```
1284    ///
1285    /// . Calling IOAllowPowerChange will not veto the sleep; any
1286    /// app that calls IOCancelPowerChange will veto the idle sleep. A kIOMessageCanSystemSleep
1287    /// notification will be followed up to 30 seconds later by a kIOMessageSystemWillSleep message.
1288    /// or a kIOMessageSystemWillNotSleep message.
1289    ///
1290    /// <li>
1291    /// kIOMessageSystemWillNotSleep is delivered when some app client has vetoed an idle sleep
1292    /// request. kIOMessageSystemWillNotSleep may follow a kIOMessageCanSystemSleep notification,
1293    /// but will not otherwise be sent.
1294    /// Caller must NOT acknowledge kIOMessageSystemWillNotSleep; the caller must simply return from its handler.
1295    /// </ul>
1296    /// To deregister for sleep/wake notifications, the caller must make two calls, in this order:
1297    /// <ol>
1298    /// <li>
1299    /// Call IODeregisterForSystemPower with the 'notifier' argument returned here.
1300    /// <li>
1301    /// Then call IONotificationPortDestroy passing the 'thePortRef' argument
1302    /// returned here.
1303    /// </ol>
1304    ///
1305    /// Parameter `refcon`: Caller may provide data to receive as an argument to 'callback' on power state changes.
1306    ///
1307    /// Parameter `thePortRef`: On return, thePortRef is a pointer to an IONotificationPortRef, which will deliver the power notifications.
1308    /// The port is allocated by this function and must be later released by the caller (after calling
1309    /// <code>
1310    ///
1311    /// ```text
1312    ///  IODeregisterForSystemPower
1313    /// ```
1314    ///
1315    /// </code>
1316    /// ).
1317    /// The caller should also enable IONotificationPortRef by calling
1318    /// <code>
1319    ///
1320    /// ```text
1321    ///  IONotificationPortGetRunLoopSource
1322    /// ```
1323    ///
1324    /// </code>
1325    /// , or
1326    /// <code>
1327    ///
1328    /// ```text
1329    ///  IONotificationPortGetMachPort
1330    /// ```
1331    ///
1332    /// </code>
1333    /// , or
1334    /// <code>
1335    ///
1336    /// ```text
1337    ///  IONotificationPortSetDispatchQueue
1338    /// ```
1339    ///
1340    /// </code>
1341    /// .
1342    ///
1343    /// Parameter `callback`: A c-function which is called during the notification.
1344    ///
1345    /// Parameter `notifier`: On success, returns a pointer to a unique notifier which caller must keep and pass to a subsequent call to IODeregisterForSystemPower.
1346    ///
1347    /// Returns: Returns a io_connect_t session for the IOPMrootDomain or IO_OBJECT_NULL if request failed.
1348    /// Caller must close return value via IOServiceClose() after calling IODeregisterForSystemPower on the notifier argument.
1349    ///
1350    /// # Safety
1351    ///
1352    /// - `refcon` must be a valid pointer.
1353    /// - `the_port_ref` must be a valid pointer.
1354    /// - `callback` must be implemented correctly.
1355    /// - `notifier` must be a valid pointer.
1356    #[cfg(feature = "libc")]
1357    pub fn IORegisterForSystemPower(
1358        refcon: *mut c_void,
1359        the_port_ref: *mut IONotificationPortRef,
1360        callback: IOServiceInterestCallback,
1361        notifier: *mut io_object_t,
1362    ) -> io_connect_t;
1363}
1364
1365extern "C-unwind" {
1366    /// Disconnects the caller from an IOService after receiving power state change notifications from the IOService. (Caller must also release IORegisterApp's return io_connect_t and returned IONotificationPortRef for complete clean-up).
1367    ///
1368    /// Parameter `notifier`: An object from IORegisterApp.
1369    ///
1370    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1371    ///
1372    /// # Safety
1373    ///
1374    /// `notifier` must be a valid pointer.
1375    #[cfg(feature = "libc")]
1376    pub fn IODeregisterApp(notifier: *mut io_object_t) -> IOReturn;
1377}
1378
1379extern "C-unwind" {
1380    /// Disconnects the caller from the Root Power Domain IOService after receiving system power state change notifications. (Caller must also destroy the IONotificationPortRef returned from IORegisterForSystemPower.)
1381    ///
1382    /// Parameter `notifier`: The object returned from IORegisterForSystemPower.
1383    ///
1384    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1385    ///
1386    /// # Safety
1387    ///
1388    /// `notifier` must be a valid pointer.
1389    #[cfg(feature = "libc")]
1390    pub fn IODeregisterForSystemPower(notifier: *mut io_object_t) -> IOReturn;
1391}
1392
1393/// The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.
1394///
1395/// Must be used when handling kIOMessageCanSystemSleep and kIOMessageSystemWillSleep messages from IOPMrootDomain system power. The caller should not call IOAllowPowerChange in response to any messages
1396/// except for these two.
1397///
1398/// Parameter `kernelPort`: Port used to communicate to the kernel,  from IORegisterApp or IORegisterForSystemPower.
1399///
1400/// Parameter `notificationID`: A copy of the notification ID which came as part of the power state change notification being acknowledged.
1401///
1402/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1403#[cfg(feature = "libc")]
1404#[inline]
1405pub extern "C-unwind" fn IOAllowPowerChange(
1406    kernel_port: io_connect_t,
1407    notification_id: isize,
1408) -> IOReturn {
1409    extern "C-unwind" {
1410        fn IOAllowPowerChange(kernel_port: io_connect_t, notification_id: isize) -> IOReturn;
1411    }
1412    unsafe { IOAllowPowerChange(kernel_port, notification_id) }
1413}
1414
1415/// The caller denies an idle system sleep power state change.
1416///
1417/// Should only called in response to kIOMessageCanSystemSleep messages from IOPMrootDomain. IOCancelPowerChange has no meaning for responding to kIOMessageSystemWillSleep (which is non-abortable) or any other messages.
1418///
1419/// When an app responds to a kIOMessageCanSystemSleep message by calling IOCancelPowerChange, the app
1420/// vetoes the idle sleep request. The system will stay awake.
1421/// The idle timer will elapse again after a period of inactivity, and the system will
1422/// send out the same kIOMessageCanSystemSleep message, and interested applications will respond gain.
1423///
1424///
1425/// Parameter `kernelPort`: Port used to communicate to the kernel,  from IORegisterApp or IORegisterForSystemPower.
1426///
1427/// Parameter `notificationID`: A copy of the notification ID which came as part of the power state change notification being acknowledged.
1428///
1429/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
1430#[cfg(feature = "libc")]
1431#[inline]
1432pub extern "C-unwind" fn IOCancelPowerChange(
1433    kernel_port: io_connect_t,
1434    notification_id: isize,
1435) -> IOReturn {
1436    extern "C-unwind" {
1437        fn IOCancelPowerChange(kernel_port: io_connect_t, notification_id: isize) -> IOReturn;
1438    }
1439    unsafe { IOCancelPowerChange(kernel_port, notification_id) }
1440}
1441
1442extern "C-unwind" {
1443    /// Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.
1444    ///
1445    /// This event will be added to the system's queue of power events and stored persistently on disk. The sleep and shutdown events present a graphical warning and allow a console user to cancel the event. Must be called as root.
1446    ///
1447    /// Parameter `time_to_wake`: Date and time that the system will power on/off.
1448    ///
1449    /// Parameter `my_id`: A CFStringRef identifying the calling app by CFBundleIdentifier. May be NULL.
1450    ///
1451    /// Parameter `type`: The type of power on you desire, either wake from sleep or power on. Choose from:
1452    /// <ul>
1453    /// <li>
1454    /// CFSTR(
1455    /// <code>
1456    /// kIOPMAutoWake
1457    /// </code>
1458    /// ) == wake machine,
1459    /// <li>
1460    /// CFSTR(
1461    /// <code>
1462    /// kIOPMAutoPowerOn
1463    /// </code>
1464    /// ) == power on machine,
1465    /// <li>
1466    /// CFSTR(
1467    /// <code>
1468    /// kIOPMAutoWakeOrPowerOn
1469    /// </code>
1470    /// ) == wake or power on,
1471    /// <li>
1472    /// CFSTR(
1473    /// <code>
1474    /// kIOPMAutoSleep
1475    /// </code>
1476    /// ) == sleep machine,
1477    /// <li>
1478    /// CFSTR(
1479    /// <code>
1480    /// kIOPMAutoShutdown
1481    /// </code>
1482    /// ) == power off machine,
1483    /// <li>
1484    /// CFSTR(
1485    /// <code>
1486    /// kIOPMAutoRestart
1487    /// </code>
1488    /// ) == restart the machine.
1489    /// </ul>
1490    ///
1491    /// Returns: kIOReturnSuccess on success, otherwise on failure
1492    ///
1493    /// # Safety
1494    ///
1495    /// - `time_to_wake` might not allow `None`.
1496    /// - `my_id` might not allow `None`.
1497    /// - `type` might not allow `None`.
1498    pub fn IOPMSchedulePowerEvent(
1499        time_to_wake: Option<&CFDate>,
1500        my_id: Option<&CFString>,
1501        r#type: Option<&CFString>,
1502    ) -> IOReturn;
1503}
1504
1505extern "C-unwind" {
1506    /// Cancel a previously scheduled power event.
1507    ///
1508    /// Arguments mirror those to IOPMSchedulePowerEvent. All arguments must match the original arguments from when the power on was scheduled. Must be called as root.
1509    ///
1510    /// Parameter `time_to_wake`: Cancel entry with this date and time.
1511    ///
1512    /// Parameter `my_id`: Cancel entry with this name.
1513    ///
1514    /// Parameter `type`: Type to cancel
1515    ///
1516    /// Returns: kIOReturnSuccess on success, otherwise on failure
1517    ///
1518    /// # Safety
1519    ///
1520    /// - `time_to_wake` might not allow `None`.
1521    /// - `my_id` might not allow `None`.
1522    /// - `type` might not allow `None`.
1523    pub fn IOPMCancelScheduledPowerEvent(
1524        time_to_wake: Option<&CFDate>,
1525        my_id: Option<&CFString>,
1526        r#type: Option<&CFString>,
1527    ) -> IOReturn;
1528}
1529
1530/// List all scheduled system power events
1531///
1532/// Returns a CFArray of CFDictionaries of power events. Each CFDictionary  contains keys for CFSTR(kIOPMPowerEventTimeKey), CFSTR(kIOPMPowerEventAppNameKey), and CFSTR(kIOPMPowerEventTypeKey).
1533///
1534/// Returns: A CFArray of CFDictionaries of power events. The CFArray must be released by the caller. NULL if there are no scheduled events.
1535#[inline]
1536pub extern "C-unwind" fn IOPMCopyScheduledPowerEvents() -> Option<CFRetained<CFArray>> {
1537    extern "C-unwind" {
1538        fn IOPMCopyScheduledPowerEvents() -> Option<NonNull<CFArray>>;
1539    }
1540    let ret = unsafe { IOPMCopyScheduledPowerEvents() };
1541    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
1542}
1543
1544/// Type for AssertionID arguments to
1545/// <code>
1546///
1547/// ```text
1548///  IOPMAssertionCreateWithProperties
1549/// ```
1550///
1551/// </code>
1552/// and
1553/// <code>
1554///
1555/// ```text
1556///  IOPMAssertionRelease
1557/// ```
1558///
1559/// </code>
1560///
1561/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmassertionid?language=objc)
1562pub type IOPMAssertionID = u32;
1563
1564/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnullassertionid?language=objc)
1565pub const kIOPMNullAssertionID: c_uint = 0;
1566
1567/// Type for AssertionLevel argument to IOPMAssertionCreate
1568///
1569///
1570/// Possible values for
1571/// <code>
1572/// IOPMAssertionLevel
1573/// </code>
1574/// are
1575/// <code>
1576///
1577/// ```text
1578///  kIOPMAssertionLevelOff
1579/// ```
1580///
1581/// </code>
1582/// and
1583/// <code>
1584///
1585/// ```text
1586///  kIOPMAssertionLevelOn
1587/// ```
1588///
1589/// </code>
1590///
1591/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmassertionlevel?language=objc)
1592pub type IOPMAssertionLevel = u32;
1593
1594/// Level for a disabled assertion, passed as an argument to IOPMAssertionCreate.
1595///
1596/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionleveloff?language=objc)
1597pub const kIOPMAssertionLevelOff: c_uint = 0;
1598/// Level for an enabled assertion, passed as an argument to IOPMAssertionCreate.
1599///
1600/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionlevelon?language=objc)
1601pub const kIOPMAssertionLevelOn: c_uint = 255;
1602
1603/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmuseractivetype?language=objc)
1604#[repr(transparent)]
1605#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
1606pub struct IOPMUserActiveType(pub c_uint);
1607impl IOPMUserActiveType {
1608    #[doc(alias = "kIOPMUserActiveLocal")]
1609    pub const Local: Self = Self(0);
1610    #[doc(alias = "kIOPMUserActiveRemote")]
1611    pub const Remote: Self = Self(1);
1612}
1613
1614#[cfg(feature = "objc2")]
1615unsafe impl Encode for IOPMUserActiveType {
1616    const ENCODING: Encoding = c_uint::ENCODING;
1617}
1618
1619#[cfg(feature = "objc2")]
1620unsafe impl RefEncode for IOPMUserActiveType {
1621    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
1622}
1623
1624extern "C-unwind" {
1625    /// The preferred API to create a power assertion.
1626    ///
1627    /// Creates an IOPMAssertion. This is the preferred API to call to create an assertion.
1628    /// It allows the caller to specify the Name, Details, and HumanReadableReason at creation time.
1629    /// There are other keys that can further describe an assertion, but most developers don't need
1630    /// to use them. Use
1631    /// <code>
1632    ///
1633    /// ```text
1634    ///  IOPMAssertionSetProperty
1635    /// ```
1636    ///
1637    /// </code>
1638    /// or
1639    /// <code>
1640    ///
1641    /// ```text
1642    ///  IOPMAssertionCreateWithProperties
1643    /// ```
1644    ///
1645    /// </code>
1646    /// if you need to specify properties
1647    /// that aren't available here.
1648    ///
1649    ///
1650    /// Parameter `AssertionType`: An assertion type constant.
1651    /// Caller must specify this argument.
1652    ///
1653    ///
1654    /// Parameter `Name`: A CFString value to correspond to key
1655    /// <code>
1656    ///
1657    /// ```text
1658    ///  kIOPMAssertionNameKey
1659    /// ```
1660    ///
1661    /// </code>
1662    /// .
1663    /// Caller must specify this argument.
1664    ///
1665    ///
1666    /// Parameter `Details`: A CFString value to correspond to key
1667    /// <code>
1668    ///
1669    /// ```text
1670    ///  kIOPMAssertionDetailsKey
1671    /// ```
1672    ///
1673    /// </code>
1674    /// .
1675    /// Caller may pass NULL, but it helps power users and administrators identify the
1676    /// reasons for this assertion.
1677    ///
1678    ///
1679    /// Parameter `HumanReadableReason`: A CFString value to correspond to key
1680    /// <code>
1681    ///
1682    /// ```text
1683    ///  kIOPMAssertionHumanReadableReasonKey
1684    /// ```
1685    ///
1686    /// </code>
1687    /// .
1688    /// Caller may pass NULL, but if it's specified OS X may display it to users
1689    /// to describe the active assertions on their system.
1690    ///
1691    ///
1692    /// Parameter `LocalizationBundlePath`: A CFString value to correspond to key
1693    /// <code>
1694    ///
1695    /// ```text
1696    ///  kIOPMAssertionLocalizationBundlePathKey
1697    /// ```
1698    ///
1699    /// </code>
1700    /// .
1701    /// This bundle path should include a localization for the string
1702    /// <code>
1703    /// HumanReadableReason
1704    /// </code>
1705    /// Caller may pass NULL, but this argument is required if caller specifies
1706    /// <code>
1707    /// HumanReadableReason
1708    /// </code>
1709    ///
1710    ///
1711    /// Parameter `Timeout`: Specifies a timeout for this assertion. Pass 0 for no timeout.
1712    ///
1713    ///
1714    /// Parameter `TimeoutAction`: Specifies a timeout action. Caller my pass NULL. If a timeout is specified but a TimeoutAction is not,
1715    /// the default timeout action is
1716    /// <code>
1717    /// kIOPMAssertionTimeoutActionTurnOff
1718    /// </code>
1719    ///
1720    ///
1721    /// Parameter `AssertionID`: (Output) On successful return, contains a unique reference to a PM assertion.
1722    ///
1723    ///
1724    /// Returns: kIOReturnSuccess, or another IOKit return code on error.
1725    ///
1726    /// # Safety
1727    ///
1728    /// - `assertion_type` might not allow `None`.
1729    /// - `name` might not allow `None`.
1730    /// - `details` might not allow `None`.
1731    /// - `human_readable_reason` might not allow `None`.
1732    /// - `localization_bundle_path` might not allow `None`.
1733    /// - `timeout_action` might not allow `None`.
1734    /// - `assertion_id` must be a valid pointer.
1735    pub fn IOPMAssertionCreateWithDescription(
1736        assertion_type: Option<&CFString>,
1737        name: Option<&CFString>,
1738        details: Option<&CFString>,
1739        human_readable_reason: Option<&CFString>,
1740        localization_bundle_path: Option<&CFString>,
1741        timeout: CFTimeInterval,
1742        timeout_action: Option<&CFString>,
1743        assertion_id: *mut IOPMAssertionID,
1744    ) -> IOReturn;
1745}
1746
1747extern "C-unwind" {
1748    /// Creates an IOPMAssertion with more flexibility than
1749    /// <code>
1750    ///
1751    /// ```text
1752    ///  IOPMAssertionCreateWithDescription
1753    /// ```
1754    ///
1755    /// </code>
1756    /// .
1757    ///
1758    /// Parameter `AssertionProperties`: Dictionary providing the properties of the assertion that need to be created.
1759    ///
1760    /// Parameter `AssertionID`: (Output) On successful return, contains a unique reference to a PM assertion.
1761    ///
1762    ///
1763    /// Create a new PM assertion - the caller must specify the type of assertion, initial level, and its
1764    /// properties as
1765    ///
1766    /// ```text
1767    ///  IOPMAssertionDictionaryKeys
1768    /// ```
1769    ///
1770    /// keys in the
1771    /// <code>
1772    /// AssertionProperties
1773    /// </code>
1774    /// dictionary.
1775    /// The following keys are recommend and/or required to be specified in the AssertionProperties
1776    /// dictionary argument.
1777    /// <ul>
1778    /// <li>
1779    /// REQUIRED:
1780    /// <code>
1781    /// kIOPMAssertionTypeKey
1782    /// </code>
1783    /// define the assertion type.
1784    ///
1785    /// <li>
1786    /// REQUIRED:
1787    /// <code>
1788    /// kIOPMAssertionNameKey
1789    /// </code>
1790    /// Caller must describe the name for the activity that
1791    /// requires the change in behavior provided by the assertion.
1792    ///
1793    /// <li>
1794    /// OPTIONAL:
1795    /// <code>
1796    /// kIOPMAssertionLevelKey
1797    /// </code>
1798    /// define an inital value. If not set, assertion is
1799    /// turned on after creation.
1800    ///
1801    /// <li>
1802    /// OPTIONAL:
1803    /// <code>
1804    /// kIOPMAssertionDetailsKey
1805    /// </code>
1806    /// Caller may describe context-specific data about the
1807    /// assertion.
1808    ///
1809    /// <li>
1810    /// OPTIONAL:
1811    /// <code>
1812    /// kIOPMAssertionHumanReadableReasonKey
1813    /// </code>
1814    /// Caller may describe the reason for creating the assertion
1815    /// in a localizable CFString. This should be a human readable phrase that describes the actions the
1816    /// calling process is taking while the assertion is held, like "Downloading TV episodes", or "Compiling Projects"
1817    ///
1818    /// <li>
1819    /// OPTIONAL:
1820    /// <code>
1821    /// kIOPMAssertionLocalizationBundlePathKey
1822    /// </code>
1823    /// Caller may provide its bundle's path, where OS X
1824    /// can localize for GUI display the CFString specified by
1825    /// <code>
1826    ///
1827    /// ```text
1828    ///  kIOPMAssertionHumanReadableReasonKey
1829    /// ```
1830    ///
1831    /// </code>
1832    /// .
1833    ///
1834    /// <li>
1835    /// OPTIONAL:
1836    /// <code>
1837    /// kIOPMAssertionPlugInIDKey
1838    /// </code>
1839    /// if the caller is a plugin with a different identity than the process
1840    /// it's loaded in.
1841    ///
1842    /// <li>
1843    /// OPTIONAL:
1844    /// <code>
1845    /// kIOPMAssertionFrameworkIDKey
1846    /// </code>
1847    /// if the caller is a framework acting on behalf of a process.
1848    ///
1849    /// <li>
1850    /// OPTIONAL:
1851    /// <code>
1852    /// kIOPMAssertionTimeoutKey
1853    /// </code>
1854    /// The caller may specify a timeout.
1855    /// </ul>
1856    ///
1857    /// # Safety
1858    ///
1859    /// - `assertion_properties` generics must be of the correct type.
1860    /// - `assertion_properties` might not allow `None`.
1861    /// - `assertion_id` must be a valid pointer.
1862    pub fn IOPMAssertionCreateWithProperties(
1863        assertion_properties: Option<&CFDictionary>,
1864        assertion_id: *mut IOPMAssertionID,
1865    ) -> IOReturn;
1866}
1867
1868extern "C-unwind" {
1869    /// Declares that the user is active on the system.
1870    ///
1871    ///
1872    /// This causes the display to power on and postpone display sleep,
1873    /// up to the user's display sleep Energy Saver settings.
1874    ///
1875    /// If you need to hold the display awake for a longer period and you know
1876    /// how long you'd like to hold it, consider taking assertion
1877    /// <code>
1878    ///
1879    /// ```text
1880    ///  kIOPMAssertPreventUserIdleDisplaySleep
1881    /// ```
1882    ///
1883    /// </code>
1884    /// using
1885    /// <code>
1886    ///
1887    /// ```text
1888    ///  IOPMAssertionCreateWithDescription
1889    /// ```
1890    ///
1891    /// </code>
1892    /// API instead.
1893    ///
1894    /// No special privileges are necessary to make this call - any process may
1895    /// call this API. Caller must specify an AssertionName - NULL is not
1896    /// a valid input.
1897    ///
1898    ///
1899    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
1900    /// handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer
1901    /// than 128 characters.
1902    ///
1903    ///
1904    /// Parameter `userType`: This parameter specifies if the active user is located locally in front of the
1905    /// system or connected to the system over the network. Various components of the system
1906    /// are maintained at different power levels depending on user location.
1907    ///
1908    ///
1909    /// Parameter `AssertionID`: On Success, unique id will be returned in this parameter. Caller
1910    /// may call this function again with the unique id retured previously to report continous
1911    /// user activity. The unique id returned by this function may change on each call depending
1912    /// on how frequently this function call is repeated and the current display sleep timer value.
1913    /// If you make this call more than once, track the returned value for
1914    /// assertionID, and pass it in as an argument on each call.
1915    ///
1916    ///
1917    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
1918    /// PM could not successfully activate the specified assertion.
1919    ///
1920    /// # Safety
1921    ///
1922    /// - `assertion_name` might not allow `None`.
1923    /// - `assertion_id` must be a valid pointer.
1924    pub fn IOPMAssertionDeclareUserActivity(
1925        assertion_name: Option<&CFString>,
1926        user_type: IOPMUserActiveType,
1927        assertion_id: *mut IOPMAssertionID,
1928    ) -> IOReturn;
1929}
1930
1931extern "C-unwind" {
1932    /// A convenience function for handling remote network clients; this is a wrapper for
1933    /// holding
1934    /// <code>
1935    ///
1936    /// ```text
1937    ///  kIOPMAssertNetworkClientActive
1938    /// ```
1939    ///
1940    /// </code>
1941    ///
1942    ///
1943    /// Call this whenever you detect activity from your remote network clients.
1944    /// This call generates an IPC call, and may block.
1945    ///
1946    /// On the first invocation, this will populate parameter
1947    /// <code>
1948    /// AssertionID
1949    /// </code>
1950    /// with a new assertion ID.
1951    /// You should pass in this returned assertion ID on every access.
1952    ///
1953    /// When system is on AC power, every call to
1954    /// <code>
1955    /// IOPMDeclareNetworkClientActivity
1956    /// </code>
1957    /// prevents system from idle sleeping and from demand sleeping for the duration of
1958    /// system sleep timer. When system is on Battery power, every call to
1959    /// <code>
1960    /// IOPMDeclareNetworkClientActivity
1961    /// </code>
1962    /// prevents system from idle sleeping for the
1963    /// duration of system sleep timer.
1964    ///
1965    /// Assertion created by this interface is valid only for the duration of system sleep timer
1966    /// from the last call. IOKit will disable
1967    /// <code>
1968    /// AssertionID
1969    /// </code>
1970    /// after that duration.
1971    ///
1972    /// If you detect that your remote client is no longer active, please immediately call
1973    /// <code>
1974    ///
1975    /// ```text
1976    ///  IOPMAssertionRelease
1977    /// ```
1978    ///
1979    /// </code>
1980    /// . Do not wait for the timeout.
1981    ///
1982    /// If your process can detect when remote clients are active and idle, you can skip
1983    /// this API and directly create
1984    /// <code>
1985    ///
1986    /// ```text
1987    ///  kIOPMAssertNetworkClientActive
1988    /// ```
1989    ///
1990    /// </code>
1991    /// yourself.
1992    ///
1993    /// If your remote clients require access to the framebuffer or the GPU, then this
1994    /// isn't the appropriate call for you. Please see
1995    /// <code>
1996    ///
1997    /// ```text
1998    ///  IOPMAssertionDeclareUserActivity
1999    /// ```
2000    ///
2001    /// </code>
2002    /// and pass in argument
2003    /// <code>
2004    ///
2005    /// ```text
2006    ///  kIOPMUserActiveRemote
2007    /// ```
2008    ///
2009    /// </code>
2010    /// .
2011    ///
2012    ///
2013    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
2014    /// handled by this assertion (e.g. "Serving a podcast"). The name must be less than
2015    /// 128 characters.
2016    /// *
2017    ///
2018    /// Parameter `AssertionID`: On Success, unique id will be returned in this parameter. Caller
2019    /// may call this function again with the unique id retured previously to report additional
2020    /// user activity. The unique id returned by this function may change on each call depending
2021    /// on how frequently this function call is repeated and the current system sleep timer value.
2022    /// If you make this call more than once, track the returned value for
2023    /// assertionID, and pass it in as an argument on each call.
2024    ///
2025    ///
2026    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
2027    /// PM could not successfully activate the specified assertion.
2028    ///
2029    /// # Safety
2030    ///
2031    /// - `assertion_name` might not allow `None`.
2032    /// - `assertion_id` must be a valid pointer.
2033    pub fn IOPMDeclareNetworkClientActivity(
2034        assertion_name: Option<&CFString>,
2035        assertion_id: *mut IOPMAssertionID,
2036    ) -> IOReturn;
2037}
2038
2039/// Increments the assertion's retain count.
2040///
2041/// Increments the retain count according to CoreFoundation style retain/release semantics.
2042/// Retain count can be inspected in the assertion's info dictionary at
2043/// key
2044/// <code>
2045///
2046/// ```text
2047///  kIOPMAssertionRetainCountKey
2048/// ```
2049///
2050/// </code>
2051///
2052/// Parameter `theAssertion`: The assertion ID to retain.
2053#[inline]
2054pub extern "C-unwind" fn IOPMAssertionRetain(the_assertion: IOPMAssertionID) {
2055    extern "C-unwind" {
2056        fn IOPMAssertionRetain(the_assertion: IOPMAssertionID);
2057    }
2058    unsafe { IOPMAssertionRetain(the_assertion) }
2059}
2060
2061/// Decrements the assertion's retain count.
2062///
2063///
2064/// If the retain count becomes zero, then this also frees and deactivates
2065/// the assertion referred to by
2066/// <code>
2067/// assertionID
2068/// </code>
2069///
2070/// Calls to
2071/// <code>
2072///
2073/// ```text
2074///  IOPMAssertionCreate
2075/// ```
2076///
2077/// </code>
2078/// and
2079/// <code>
2080///
2081/// ```text
2082///  IOPMAssertionRetain
2083/// ```
2084///
2085/// </code>
2086/// must each be paired with calls to IOPMAssertionRelease.
2087///
2088///
2089/// Parameter `AssertionID`: The assertion_id, returned from IOPMAssertionCreate, to cancel.
2090///
2091///
2092/// Returns: Returns kIOReturnSuccess on success.
2093#[inline]
2094pub extern "C-unwind" fn IOPMAssertionRelease(assertion_id: IOPMAssertionID) -> IOReturn {
2095    extern "C-unwind" {
2096        fn IOPMAssertionRelease(assertion_id: IOPMAssertionID) -> IOReturn;
2097    }
2098    unsafe { IOPMAssertionRelease(assertion_id) }
2099}
2100
2101/// Copies details about an
2102/// <code>
2103/// IOPMAssertion
2104/// </code>
2105/// .
2106///
2107/// Returns a dictionary describing an IOPMAssertion's specifications and current state.
2108///
2109/// Parameter `theAssertion`: The assertion ID to copy info about.
2110///
2111/// Returns: A dictionary describing the assertion with keys specified in See
2112///
2113/// ```text
2114///  IOPMAssertionDictionaryKeys
2115/// ```
2116///
2117/// .
2118/// It's the caller's responsibility to release this dictionary.
2119#[inline]
2120pub extern "C-unwind" fn IOPMAssertionCopyProperties(
2121    the_assertion: IOPMAssertionID,
2122) -> Option<CFRetained<CFDictionary>> {
2123    extern "C-unwind" {
2124        fn IOPMAssertionCopyProperties(
2125            the_assertion: IOPMAssertionID,
2126        ) -> Option<NonNull<CFDictionary>>;
2127    }
2128    let ret = unsafe { IOPMAssertionCopyProperties(the_assertion) };
2129    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2130}
2131
2132extern "C-unwind" {
2133    /// Sets a property in the assertion.
2134    ///
2135    /// Only the process that created an assertion may change its properties.
2136    ///
2137    /// Parameter `theAssertion`: The
2138    /// <code>
2139    ///
2140    /// ```text
2141    ///  IOPMAssertionID
2142    /// ```
2143    ///
2144    /// </code>
2145    /// of the assertion to modify.
2146    ///
2147    /// Parameter `theProperty`: The CFString key, from
2148    /// <code>
2149    ///
2150    /// ```text
2151    ///  IOPMAssertionDictionaryKeys
2152    /// ```
2153    ///
2154    /// </code>
2155    /// to modify.
2156    ///
2157    /// Parameter `theValue`: The property to set. The value must match the CF type expected for the specified key.
2158    ///
2159    /// Returns: Returns
2160    /// <code>
2161    ///
2162    /// ```text
2163    ///  kIOReturnNotPriviliged
2164    /// ```
2165    ///
2166    /// </code>
2167    /// if the caller doesn't
2168    /// have permission to modify this assertion.
2169    /// Returns
2170    /// <code>
2171    ///
2172    /// ```text
2173    ///  kIOReturnNotFound
2174    /// ```
2175    ///
2176    /// </code>
2177    /// if PM can't locate this assertion.
2178    /// Returns
2179    /// <code>
2180    ///
2181    /// ```text
2182    ///  kIOReturnError
2183    /// ```
2184    ///
2185    /// </code>
2186    /// upon an unidentified error.
2187    /// Returns
2188    /// <code>
2189    ///
2190    /// ```text
2191    ///  kIOReturnSuccess
2192    /// ```
2193    ///
2194    /// </code>
2195    /// otherwise.
2196    ///
2197    /// # Safety
2198    ///
2199    /// - `the_property` might not allow `None`.
2200    /// - `the_value` should be of the correct type.
2201    /// - `the_value` might not allow `None`.
2202    pub fn IOPMAssertionSetProperty(
2203        the_assertion: IOPMAssertionID,
2204        the_property: Option<&CFString>,
2205        the_value: Option<&CFType>,
2206    ) -> IOReturn;
2207}
2208
2209extern "C-unwind" {
2210    /// Returns a dictionary listing all assertions, grouped by their owning process.
2211    ///
2212    ///
2213    /// Notes: One process may have multiple assertions. Several processes may
2214    /// have asserted the same assertion to different levels.
2215    ///
2216    ///
2217    /// Parameter `AssertionsByPID`: On success, this returns a dictionary of assertions per process.
2218    /// At the top level, keys to the CFDictionary are pids stored as CFNumbers (kCFNumberIntType).
2219    /// The value associated with each CFNumber pid is a CFArray of active assertions.
2220    /// Each entry in the CFArray is an assertion represented as a CFDictionary. See the keys
2221    /// kIOPMAssertionTypeKey and kIOPMAssertionLevelKey.
2222    /// Caller must CFRelease() this dictionary when done.
2223    ///
2224    ///
2225    /// Returns: Returns kIOReturnSuccess on success.
2226    ///
2227    /// # Safety
2228    ///
2229    /// `assertions_by_pid` must be a valid pointer.
2230    pub fn IOPMCopyAssertionsByProcess(assertions_by_pid: *mut *const CFDictionary) -> IOReturn;
2231}
2232
2233extern "C-unwind" {
2234    /// Returns a list of available assertions and their system-wide levels.
2235    ///
2236    ///
2237    /// The system-wide level is the maximum of all individual assertions' levels.
2238    ///
2239    ///
2240    /// Parameter `AssertionsStatus`: On success, this returns a CFDictionary of all assertions currently available.
2241    /// The keys in the dictionary are the assertion types, and the value of each is a CFNumber that
2242    /// represents the aggregate level for that assertion.  Caller must CFRelease() this dictionary when done.
2243    ///
2244    ///
2245    /// Returns: Returns      kIOReturnSuccess on success.
2246    ///
2247    /// # Safety
2248    ///
2249    /// `assertions_status` must be a valid pointer.
2250    pub fn IOPMCopyAssertionsStatus(assertions_status: *mut *const CFDictionary) -> IOReturn;
2251}
2252
2253extern "C-unwind" {
2254    /// This is a deprecated call to create a power assertion.
2255    ///
2256    ///
2257    /// ```text
2258    ///  IOPMAssertionCreateWithProperties
2259    /// ```
2260    ///
2261    /// </code>
2262    /// .
2263    /// Please use that version of this API instead.
2264    ///
2265    ///
2266    /// No special privileges necessary to make this call - any process may
2267    /// activate a power assertion.
2268    ///
2269    ///
2270    /// Parameter `AssertionType`: The CFString assertion type to request from the PM system.
2271    ///
2272    /// Parameter `AssertionLevel`: Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.
2273    ///
2274    /// Parameter `AssertionID`: On success, a unique id will be returned in this parameter.
2275    ///
2276    ///
2277    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
2278    /// PM could not successfully activate the specified assertion.
2279    ///
2280    /// # Safety
2281    ///
2282    /// - `assertion_type` might not allow `None`.
2283    /// - `assertion_id` must be a valid pointer.
2284    #[deprecated]
2285    pub fn IOPMAssertionCreate(
2286        assertion_type: Option<&CFString>,
2287        assertion_level: IOPMAssertionLevel,
2288        assertion_id: *mut IOPMAssertionID,
2289    ) -> IOReturn;
2290}
2291
2292extern "C-unwind" {
2293    /// The simplest API to create a power assertion.
2294    ///
2295    ///
2296    /// No special privileges are necessary to make this call - any process may
2297    /// activate a power assertion. Caller must specify an AssertionName - NULL is not
2298    /// a valid input.
2299    ///
2300    ///
2301    /// Parameter `AssertionType`: The CFString assertion type to request from the PM system.
2302    ///
2303    /// Parameter `AssertionLevel`: Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.
2304    ///
2305    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
2306    /// handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer
2307    /// than 128 characters.
2308    ///
2309    ///
2310    /// Parameter `AssertionID`: On success, a unique id will be returned in this parameter.
2311    ///
2312    ///
2313    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
2314    /// PM could not successfully activate the specified assertion.
2315    ///
2316    /// # Safety
2317    ///
2318    /// - `assertion_type` might not allow `None`.
2319    /// - `assertion_name` might not allow `None`.
2320    /// - `assertion_id` must be a valid pointer.
2321    pub fn IOPMAssertionCreateWithName(
2322        assertion_type: Option<&CFString>,
2323        assertion_level: IOPMAssertionLevel,
2324        assertion_name: Option<&CFString>,
2325        assertion_id: *mut IOPMAssertionID,
2326    ) -> IOReturn;
2327}
2328
2329/// Return type for IOGetSystemLoadAdvisory
2330///
2331/// Value is one of kIOSystemLoadAdvisoryLevelGreat, kIOSystemLoadAdvisoryLevelOK,
2332/// or kIOSystemLoadAdvisoryLevelBad.
2333///
2334/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iosystemloadadvisorylevel?language=objc)
2335pub type IOSystemLoadAdvisoryLevel = c_int;
2336
2337/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelbad?language=objc)
2338pub const kIOSystemLoadAdvisoryLevelBad: c_uint = 1;
2339/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelok?language=objc)
2340pub const kIOSystemLoadAdvisoryLevelOK: c_uint = 2;
2341/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelgreat?language=objc)
2342pub const kIOSystemLoadAdvisoryLevelGreat: c_uint = 3;
2343
2344/// Returns a hint about whether now would be a good time to perform time-insensitive
2345/// work.
2346///
2347/// Based on user and system load, IOGetSystemLoadAdvisory determines "better" and "worse"
2348/// times to run optional or time-insensitive CPU or disk work.
2349///
2350/// Applications may use this result to avoid degrading the user experience. If it is a
2351/// "Bad" or "OK" time to perform work, applications should slow down and perform work
2352/// less aggressively.
2353///
2354/// There is no guarantee that the system will ever be in "Great" condition to perform work -
2355/// all essential work must still be performed even in "Bad", or "OK" times.
2356/// Completely optional work, such as updating caches, may be postponed indefinitely.
2357///
2358/// Note: You may more efficiently read the SystemLoadAdvisory level using notify_get_state() instead
2359/// of IOGetSystemLoadAdvisory. The results are identical. notify_get_state() requires that you
2360/// pass the token argument received by registering for SystemLoadAdvisory notifications.
2361///
2362///
2363/// Returns: IOSystemLoadAdvisoryLevel - one of:
2364/// <ul>
2365/// <li>
2366/// kIOSystemLoadAdvisoryLevelGreat - A Good time to perform time-insensitive work.
2367/// <li>
2368/// kIOSystemLoadAdvisoryLevelOK - An OK time to perform time-insensitive work.
2369/// <li>
2370/// kIOSystemLoadAdvisoryLevelBad - A Bad time to perform time-insensitive work.
2371/// </ul>
2372#[inline]
2373pub extern "C-unwind" fn IOGetSystemLoadAdvisory() -> IOSystemLoadAdvisoryLevel {
2374    extern "C-unwind" {
2375        fn IOGetSystemLoadAdvisory() -> IOSystemLoadAdvisoryLevel;
2376    }
2377    unsafe { IOGetSystemLoadAdvisory() }
2378}
2379
2380/// Indicates how user activity, battery level, and thermal level each
2381/// contribute to the overall "SystemLoadAdvisory" level. In the future,
2382/// this combined level may represent new levels as well.
2383///
2384/// See dictionary keys defined above.
2385///
2386/// Returns: Returns a CFDictionaryRef, or NULL on error. Caller must release the
2387/// returned dictionary.
2388#[inline]
2389pub extern "C-unwind" fn IOCopySystemLoadAdvisoryDetailed() -> Option<CFRetained<CFDictionary>> {
2390    extern "C-unwind" {
2391        fn IOCopySystemLoadAdvisoryDetailed() -> Option<NonNull<CFDictionary>>;
2392    }
2393    let ret = unsafe { IOCopySystemLoadAdvisoryDetailed() };
2394    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
2395}
2396
2397extern "C-unwind" {
2398    /// Copy status of all current CPU power levels.
2399    ///
2400    /// The returned dictionary may define some of these keys,
2401    /// as defined in IOPM.h:
2402    /// <ul>
2403    /// <li>
2404    /// kIOPMCPUPowerLimitProcessorSpeedKey
2405    /// <li>
2406    /// kIOPMCPUPowerLimitProcessorCountKey
2407    /// <li>
2408    /// kIOPMCPUPowerLimitSchedulerTimeKey
2409    /// </ul>
2410    ///
2411    /// Parameter `cpuPowerStatus`: Upon success, a pointer to a dictionary defining CPU power;
2412    /// otherwise NULL. Pointer will be populated with a newly created dictionary
2413    /// upon successful return. Caller must release dictionary.
2414    ///
2415    /// Returns: kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if
2416    /// CPU PowerStatus has not been published.
2417    ///
2418    /// # Safety
2419    ///
2420    /// `cpu_power_status` must be a valid pointer.
2421    pub fn IOPMCopyCPUPowerStatus(cpu_power_status: *mut *const CFDictionary) -> IOReturn;
2422}
2423
2424extern "C-unwind" {
2425    /// Get thermal warning level of the system.
2426    ///
2427    /// Returns: An integer pointer declaring the power warning level of the system.
2428    /// The value of the integer is one of (defined in IOPM.h):
2429    /// <ul>
2430    /// <li>
2431    /// kIOPMThermalWarningLevelNormal
2432    /// <li>
2433    /// kIOPMThermalWarningLevelDanger
2434    /// <li>
2435    /// kIOPMThermalWarningLevelCrisis
2436    /// </ul>
2437    /// Upon success the thermal level value will be found at the
2438    /// pointer argument.
2439    ///
2440    /// Returns: kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if
2441    /// thermal warning level has not been published.
2442    ///
2443    /// # Safety
2444    ///
2445    /// `thermal_level` must be a valid pointer.
2446    pub fn IOPMGetThermalWarningLevel(thermal_level: *mut u32) -> IOReturn;
2447}