//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kappleclamshellstatekey?language=objc)
pub const kAppleClamshellStateKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AppleClamshellState\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kappleclamshellcausessleepkey?language=objc)
pub const kAppleClamshellCausesSleepKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AppleClamshellCausesSleep\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepwakeuuidkey?language=objc)
pub const kIOPMSleepWakeUUIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"SleepWakeUUID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbootsessionuuidkey?language=objc)
pub const kIOPMBootSessionUUIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BootSessionUUID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepenabledkey?language=objc)
pub const kIOPMDeepSleepEnabledKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Enabled\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepdelaykey?language=objc)
pub const kIOPMDeepSleepDelayKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Delay\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeepsleepdelayhighkey?language=objc)
pub const kIOPMDeepSleepDelayHighKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"High Standby Delay\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmstandbybatterythresholdkey?language=objc)
pub const kIOPMStandbyBatteryThresholdKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Standby Battery Threshold\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdestroyfvkeyonstandbykey?language=objc)
pub const kIOPMDestroyFVKeyOnStandbyKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DestroyFVKeyOnStandby\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmresetpowerstateonwakekey?language=objc)
pub const kIOPMResetPowerStateOnWakeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"IOPMResetPowerStateOnWake\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionsdriverkey?language=objc)
pub const kIOPMAssertionsDriverKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DriverPMAssertions\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionsdriverdetailedkey?language=objc)
pub const kIOPMAssertionsDriverDetailedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DriverPMAssertionsDetailed\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionidkey?language=objc)
pub const kIOPMDriverAssertionIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertioncreatedtimekey?language=objc)
pub const kIOPMDriverAssertionCreatedTimeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CreatedTime\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionmodifiedtimekey?language=objc)
pub const kIOPMDriverAssertionModifiedTimeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ModifiedTime\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionownerstringkey?language=objc)
pub const kIOPMDriverAssertionOwnerStringKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Owner\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionownerservicekey?language=objc)
pub const kIOPMDriverAssertionOwnerServiceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ServicePtr\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionregistryentryidkey?language=objc)
pub const kIOPMDriverAssertionRegistryEntryIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"RegistryEntryID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionlevelkey?language=objc)
pub const kIOPMDriverAssertionLevelKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Level\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionassertedkey?language=objc)
pub const kIOPMDriverAssertionAssertedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Assertions\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessageclamshellstatechange?language=objc)
pub const kIOPMMessageClamshellStateChange: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x100);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagefeaturechange?language=objc)
pub const kIOPMMessageFeatureChange: c_uint = iokit_family_msg!(sub_iokit_powermanagement, 0x110);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessageinternalbatteryfullydischarged?language=objc)
pub const kIOPMMessageInternalBatteryFullyDischarged: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x120);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagesystempowereventoccurred?language=objc)
pub const kIOPMMessageSystemPowerEventOccurred: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x130);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagesleepwakeuuidchange?language=objc)
pub const kIOPMMessageSleepWakeUUIDChange: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x140);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagedriverassertionschanged?language=objc)
pub const kIOPMMessageDriverAssertionsChanged: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x150);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagedarkwakethermalemergency?language=objc)
pub const kIOPMMessageDarkWakeThermalEmergency: c_uint =
    iokit_family_msg!(sub_iokit_powermanagement, 0x160);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsexternalconnectedkey?language=objc)
pub const kIOPMPSExternalConnectedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ExternalConnected\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsexternalchargecapablekey?language=objc)
pub const kIOPMPSExternalChargeCapableKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ExternalChargeCapable\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatteryinstalledkey?language=objc)
pub const kIOPMPSBatteryInstalledKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryInstalled\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsischargingkey?language=objc)
pub const kIOPMPSIsChargingKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"IsCharging\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmfullychargedkey?language=objc)
pub const kIOPMFullyChargedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"FullyCharged\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsatwarnlevelkey?language=objc)
pub const kIOPMPSAtWarnLevelKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AtWarnLevel\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsatcriticallevelkey?language=objc)
pub const kIOPMPSAtCriticalLevelKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AtCriticalLevel\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscurrentcapacitykey?language=objc)
pub const kIOPMPSCurrentCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CurrentCapacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmaxcapacitykey?language=objc)
pub const kIOPMPSMaxCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"MaxCapacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsdesigncapacitykey?language=objc)
pub const kIOPMPSDesignCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DesignCapacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpstimeremainingkey?language=objc)
pub const kIOPMPSTimeRemainingKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeRemaining\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsamperagekey?language=objc)
pub const kIOPMPSAmperageKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Amperage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsvoltagekey?language=objc)
pub const kIOPMPSVoltageKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Voltage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscyclecountkey?language=objc)
pub const kIOPMPSCycleCountKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CycleCount\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmaxerrkey?language=objc)
pub const kIOPMPSMaxErrKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"MaxErr\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterinfokey?language=objc)
pub const kIOPMPSAdapterInfoKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterInfo\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationkey?language=objc)
pub const kIOPMPSLocationKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Location\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpserrorconditionkey?language=objc)
pub const kIOPMPSErrorConditionKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ErrorCondition\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmanufacturerkey?language=objc)
pub const kIOPMPSManufacturerKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Manufacturer\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmanufacturedatekey?language=objc)
pub const kIOPMPSManufactureDateKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ManufactureDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsmodelkey?language=objc)
pub const kIOPMPSModelKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Model\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsserialkey?language=objc)
pub const kIOPMPSSerialKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Serial\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdevicenamekey?language=objc)
pub const kIOPMDeviceNameKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"DeviceName\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslegacybatteryinfokey?language=objc)
pub const kIOPMPSLegacyBatteryInfoKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"LegacyBatteryInfo\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatteryhealthkey?language=objc)
pub const kIOPMPSBatteryHealthKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryHealth\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpshealthconfidencekey?language=objc)
pub const kIOPMPSHealthConfidenceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"HealthConfidence\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpscapacityestimatedkey?language=objc)
pub const kIOPMPSCapacityEstimatedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CapacityEstimated\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatterychargestatuskey?language=objc)
pub const kIOPMPSBatteryChargeStatusKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ChargeStatus\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsbatterytemperaturekey?language=objc)
pub const kIOPMPSBatteryTemperatureKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Temperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailskey?language=objc)
pub const kIOPMPSAdapterDetailsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterDetails\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpschargerconfigurationkey?language=objc)
pub const kIOPMPSChargerConfigurationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ChargerConfiguration\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoohot?language=objc)
pub const kIOPMBatteryChargeStatusTooHot: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"HighTemperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoocold?language=objc)
pub const kIOPMBatteryChargeStatusTooCold: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"LowTemperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatustoohotorcold?language=objc)
pub const kIOPMBatteryChargeStatusTooHotOrCold: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"HighOrLowTemperature\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterychargestatusgradient?language=objc)
pub const kIOPMBatteryChargeStatusGradient: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryTemperatureGradient\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsidkey?language=objc)
pub const kIOPMPSAdapterDetailsIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailswattskey?language=objc)
pub const kIOPMPSAdapterDetailsWattsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Watts\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsrevisionkey?language=objc)
pub const kIOPMPSAdapterDetailsRevisionKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterRevision\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsserialnumberkey?language=objc)
pub const kIOPMPSAdapterDetailsSerialNumberKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"SerialNumber\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsfamilykey?language=objc)
pub const kIOPMPSAdapterDetailsFamilyKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"FamilyCode\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsamperagekey?language=objc)
pub const kIOPMPSAdapterDetailsAmperageKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Current\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsdescriptionkey?language=objc)
pub const kIOPMPSAdapterDetailsDescriptionKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Description\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailspmuconfigurationkey?language=objc)
pub const kIOPMPSAdapterDetailsPMUConfigurationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PMUConfiguration\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailsvoltage?language=objc)
pub const kIOPMPSAdapterDetailsVoltage: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"AdapterVoltage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailssourceidkey?language=objc)
pub const kIOPMPSAdapterDetailsSourceIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Source\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailserrorflagskey?language=objc)
pub const kIOPMPSAdapterDetailsErrorFlagsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ErrorFlags\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailssharedsourcekey?language=objc)
pub const kIOPMPSAdapterDetailsSharedSourceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"SharedSource\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsadapterdetailscloakedkey?language=objc)
pub const kIOPMPSAdapterDetailsCloakedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CloakedSource\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpsinvalidwakesecondskey?language=objc)
pub const kIOPMPSInvalidWakeSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"BatteryInvalidWakeSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpspostchargewaitsecondskey?language=objc)
pub const kIOPMPSPostChargeWaitSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PostChargeWaitSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpspostdishargewaitsecondskey?language=objc)
pub const kIOPMPSPostDishargeWaitSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PostDischargeWaitSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgraphicspowerlimitskey?language=objc)
pub const kIOPMGraphicsPowerLimitsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Graphics_Power_Limits\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgraphicspowerlimitperformancekey?language=objc)
pub const kIOPMGraphicsPowerLimitPerformanceKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Graphics_Power_Performance\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitskey?language=objc)
pub const kIOPMCPUPowerLimitsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Power_Limits\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitprocessorspeedkey?language=objc)
pub const kIOPMCPUPowerLimitProcessorSpeedKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Speed_Limit\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitprocessorcountkey?language=objc)
pub const kIOPMCPUPowerLimitProcessorCountKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Available_CPUs\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowerlimitschedulertimekey?language=objc)
pub const kIOPMCPUPowerLimitSchedulerTimeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"CPU_Scheduler_Limit\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelwarningkey?language=objc)
pub const kIOPMThermalLevelWarningKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Thermal_Level_Warning\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarninglevelnormal?language=objc)
pub const kIOPMThermalWarningLevelNormal: c_uint = kIOPMThermalLevelNormal;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarningleveldanger?language=objc)
pub const kIOPMThermalWarningLevelDanger: c_uint = kIOPMThermalLevelWarning;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarninglevelcrisis?language=objc)
pub const kIOPMThermalWarningLevelCrisis: c_uint = kIOPMThermalLevelCritical;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonringkey?language=objc)
pub const kIOPMSettingWakeOnRingKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On Modem Ring\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingrestartonpowerlosskey?language=objc)
pub const kIOPMSettingRestartOnPowerLossKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Automatic Restart On Power Loss\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonacchangekey?language=objc)
pub const kIOPMSettingWakeOnACChangeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On AC Change\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingsleeponpowerbuttonkey?language=objc)
pub const kIOPMSettingSleepOnPowerButtonKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Sleep On Power Button\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingwakeonclamshellkey?language=objc)
pub const kIOPMSettingWakeOnClamshellKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Wake On Clamshell Open\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingreducebrightnesskey?language=objc)
pub const kIOPMSettingReduceBrightnessKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ReduceBrightness\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdisplaysleepusesdimkey?language=objc)
pub const kIOPMSettingDisplaySleepUsesDimKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Display Sleep Uses Dim\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingtimezoneoffsetkey?language=objc)
pub const kIOPMSettingTimeZoneOffsetKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"TimeZoneOffsetSeconds\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingmobilemotionmodulekey?language=objc)
pub const kIOPMSettingMobileMotionModuleKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"MobileMotionModule\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettinggraphicsswitchkey?language=objc)
pub const kIOPMSettingGraphicsSwitchKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"GPUSwitch\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingpromodecontrol?language=objc)
pub const kIOPMSettingProModeControl: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ProModeControl\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingpromodedefer?language=objc)
pub const kIOPMSettingProModeDefer: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"ProModeDefer\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautowakesecondskey?language=objc)
pub const kIOPMSettingAutoWakeSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"wake\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautowakecalendarkey?language=objc)
pub const kIOPMSettingAutoWakeCalendarKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"WakeByCalendarDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautopowersecondskey?language=objc)
pub const kIOPMSettingAutoPowerSecondsKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"poweron\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingautopowercalendarkey?language=objc)
pub const kIOPMSettingAutoPowerCalendarKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PowerByCalendarDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdebugwakerelativekey?language=objc)
pub const kIOPMSettingDebugWakeRelativeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"WakeRelativeToSleep\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingdebugpowerrelativekey?language=objc)
pub const kIOPMSettingDebugPowerRelativeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"PowerRelativeToShutdown\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsettingmaintenancewakecalendarkey?language=objc)
pub const kIOPMSettingMaintenanceWakeCalendarKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"MaintenanceWakeCalendarDate\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kmaxtype?language=objc)
pub const kMaxType: c_uint = kPMLastAggressivenessType - 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kioremsleepenabledkey?language=objc)
pub const kIOREMSleepEnabledKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"REMSleepEnabled\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryinfokey?language=objc)
pub const kIOBatteryInfoKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"IOBatteryInfo\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycurrentchargekey?language=objc)
pub const kIOBatteryCurrentChargeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Current\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycapacitykey?language=objc)
pub const kIOBatteryCapacityKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Capacity\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryflagskey?language=objc)
pub const kIOBatteryFlagsKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"Flags\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryvoltagekey?language=objc)
pub const kIOBatteryVoltageKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Voltage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryamperagekey?language=objc)
pub const kIOBatteryAmperageKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Amperage\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycyclecountkey?language=objc)
pub const kIOBatteryCycleCountKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"Cycle Count\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmessagebatterystatushaschanged?language=objc)
pub const kIOPMMessageBatteryStatusHasChanged: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x100);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmumessagelegacyautowake?language=objc)
pub const kIOPMUMessageLegacyAutoWake: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x200);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmumessagelegacyautopower?language=objc)
pub const kIOPMUMessageLegacyAutoPower: c_uint = iokit_family_msg!(sub_iokit_pmu, 0x210);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautowake?language=objc)
pub const kIOPMAutoWake: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"wake\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautopoweron?language=objc)
pub const kIOPMAutoPowerOn: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"poweron\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautowakeorpoweron?language=objc)
pub const kIOPMAutoWakeOrPowerOn: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"wakepoweron\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautosleep?language=objc)
pub const kIOPMAutoSleep: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"sleep\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautoshutdown?language=objc)
pub const kIOPMAutoShutdown: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"shutdown\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmautorestart?language=objc)
pub const kIOPMAutoRestart: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"restart\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventtimekey?language=objc)
pub const kIOPMPowerEventTimeKey: &CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"time\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventappnamekey?language=objc)
pub const kIOPMPowerEventAppNameKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"scheduledby\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventapppidkey?language=objc)
pub const kIOPMPowerEventAppPIDKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"appPID\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowereventtypekey?language=objc)
pub const kIOPMPowerEventTypeKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"eventtype\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetaggressiveness?language=objc)
pub const kPMSetAggressiveness: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgetaggressiveness?language=objc)
pub const kPMGetAggressiveness: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepsystem?language=objc)
pub const kPMSleepSystem: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmallowpowerchange?language=objc)
pub const kPMAllowPowerChange: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmcancelpowerchange?language=objc)
pub const kPMCancelPowerChange: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmshutdownsystem?language=objc)
pub const kPMShutdownSystem: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmrestartsystem?language=objc)
pub const kPMRestartSystem: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepsystemoptions?language=objc)
pub const kPMSleepSystemOptions: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetmaintenancewakecalendar?language=objc)
pub const kPMSetMaintenanceWakeCalendar: c_uint = 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetuserassertionlevels?language=objc)
pub const kPMSetUserAssertionLevels: c_uint = 9;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmactivitytickle?language=objc)
pub const kPMActivityTickle: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgetsystemsleeptype?language=objc)
pub const kPMGetSystemSleepType: c_uint = 11;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetclamshellsleepstate?language=objc)
pub const kPMSetClamshellSleepState: c_uint = 12;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepwakewatchdogenable?language=objc)
pub const kPMSleepWakeWatchdogEnable: c_uint = 13;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsleepwakedebugtrig?language=objc)
pub const kPMSleepWakeDebugTrig: c_uint = 14;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetdisplaypoweron?language=objc)
pub const kPMSetDisplayPowerOn: c_uint = 15;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetdisplaystate?language=objc)
pub const kPMSetDisplayState: c_uint = 16;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmrequestidlesleeprevert?language=objc)
pub const kPMRequestIdleSleepRevert: c_uint = 17;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetldmhibernationdisable?language=objc)
pub const kPMSetLDMHibernationDisable: c_uint = 18;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/knumpmmethods?language=objc)
pub const kNumPMMethods: c_uint = 19;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorynotifyname?language=objc)
pub const kIOSystemLoadAdvisoryNotifyName: &CStr = unsafe {
    CStr::from_bytes_with_nul_unchecked(b"com.apple.system.powermanagement.SystemLoadAdvisory\0")
};
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcpupowernotificationkey?language=objc)
pub const kIOPMCPUPowerNotificationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.system.power.CPU\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalwarningnotificationkey?language=objc)
pub const kIOPMThermalWarningNotificationKey: &CStr =
    unsafe { CStr::from_bytes_with_nul_unchecked(b"com.apple.system.power.thermal_warning\0") };
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmaxpowerstates?language=objc)
pub const kIOPMMaxPowerStates: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmmaxpowerstates?language=objc)
pub const IOPMMaxPowerStates: c_uint = kIOPMMaxPowerStates;

/// Bits are used in defining capabilityFlags, inputPowerRequirements, and outputPowerCharacter in the IOPMPowerState structure.
///
/// These bits may be bitwise-OR'd together in the IOPMPowerState capabilityFlags field, the outputPowerCharacter field, and/or the inputPowerRequirement field.
///
/// The comments clearly mark whether each flag should be used in the capabilityFlags field, outputPowerCharacter field, and inputPowerRequirement field, or all three.
///
/// 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.
///
/// 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.
///
///
///
///
/// Indicates device is in a low power state. May be bitwis-OR'd together
/// with kIOPMDeviceUsable flag, to indicate the device is still usable.
///
/// A device with a capability of kIOPMLowPower may:
/// Require either 0 or kIOPMPowerOn from its power parent
/// Offer either kIOPMLowPower, kIOPMPowerOn, or 0 (no power at all)
/// to its power plane children.
///
/// Useful only as a Capability, although USB drivers should consult USB family documentation for other valid circumstances to use the kIOPMLowPower bit.
///
///
/// In the capability field of a power state, disallows idle system sleep while the device is in that state.
///
/// 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.
///
/// Useful only as a Capability.
///
///
/// 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.
///
///
/// 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.
///
///
/// 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.
///
///
/// 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.
///
///
/// Indicates the initial power state for the device. If
/// <code>
/// initialPowerStateForDomainState()
/// </code>
/// returns a power state with this flag set in the capability field, then the initial power change is performed without calling the driver's
/// <code>
/// setPowerState()
/// </code>
/// .
///
///
/// An indication that the power flags represent the state of the root power
/// domain. This bit must not be set in the IOPMPowerState structure.
/// Power Management may pass this bit to initialPowerStateForDomainState()
/// to map from a global system state to the desired device state.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmpowerflags?language=objc)
pub type IOPMPowerFlags = c_ulong;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoweron?language=objc)
pub const kIOPMPowerOn: c_uint = 0x00000002;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdeviceusable?language=objc)
pub const kIOPMDeviceUsable: c_uint = 0x00008000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmlowpower?language=objc)
pub const kIOPMLowPower: c_uint = 0x00010000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventidlesleep?language=objc)
pub const kIOPMPreventIdleSleep: c_uint = 0x00000040;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepcapability?language=objc)
pub const kIOPMSleepCapability: c_uint = 0x00000004;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrestartcapability?language=objc)
pub const kIOPMRestartCapability: c_uint = 0x00000080;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleep?language=objc)
pub const kIOPMSleep: c_uint = 0x00000001;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrestart?language=objc)
pub const kIOPMRestart: c_uint = 0x00000080;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopminitialdevicestate?language=objc)
pub const kIOPMInitialDeviceState: c_uint = 0x00000100;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrootdomainstate?language=objc)
pub const kIOPMRootDomainState: c_uint = 0x00000200;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclocknormal?language=objc)
pub const kIOPMClockNormal: c_uint = 0x0004;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclockrunning?language=objc)
pub const kIOPMClockRunning: c_uint = 0x0008;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventsystemsleep?language=objc)
pub const kIOPMPreventSystemSleep: c_uint = 0x0010;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdoze?language=objc)
pub const kIOPMDoze: c_uint = 0x0400;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmchildclamp?language=objc)
pub const kIOPMChildClamp: c_uint = 0x0080;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmchildclamp2?language=objc)
pub const kIOPMChildClamp2: c_uint = 0x0200;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotpowermanaged?language=objc)
pub const kIOPMNotPowerManaged: c_uint = 0x0800;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmmaxperformance?language=objc)
pub const kIOPMMaxPerformance: c_uint = 0x4000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpassthrough?language=objc)
pub const kIOPMPassThrough: c_uint = 0x0100;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmauxpoweron?language=objc)
pub const kIOPMAuxPowerOn: c_uint = 0x0020;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotattainable?language=objc)
pub const kIOPMNotAttainable: c_uint = 0x0001;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcontextretained?language=objc)
pub const kIOPMContextRetained: c_uint = 0x2000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmconfigretained?language=objc)
pub const kIOPMConfigRetained: c_uint = 0x1000;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmstaticpowervalid?language=objc)
pub const kIOPMStaticPowerValid: c_uint = 0x0800;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsoftsleep?language=objc)
pub const kIOPMSoftSleep: c_uint = 0x0400;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcapabilitiesmask?language=objc)
pub const kIOPMCapabilitiesMask: c_uint = kIOPMPowerOn
    | kIOPMDeviceUsable
    | kIOPMMaxPerformance
    | kIOPMContextRetained
    | kIOPMConfigRetained
    | kIOPMSleepCapability
    | kIOPMRestartCapability;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotattainable?language=objc)
pub const IOPMNotAttainable: c_uint = kIOPMNotAttainable;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmpoweron?language=objc)
pub const IOPMPowerOn: c_uint = kIOPMPowerOn;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmclocknormal?language=objc)
pub const IOPMClockNormal: c_uint = kIOPMClockNormal;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmclockrunning?language=objc)
pub const IOPMClockRunning: c_uint = kIOPMClockRunning;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmauxpoweron?language=objc)
pub const IOPMAuxPowerOn: c_uint = kIOPMAuxPowerOn;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmdeviceusable?language=objc)
pub const IOPMDeviceUsable: c_uint = kIOPMDeviceUsable;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmmaxperformance?language=objc)
pub const IOPMMaxPerformance: c_uint = kIOPMMaxPerformance;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcontextretained?language=objc)
pub const IOPMContextRetained: c_uint = kIOPMContextRetained;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmconfigretained?language=objc)
pub const IOPMConfigRetained: c_uint = kIOPMConfigRetained;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotpowermanaged?language=objc)
pub const IOPMNotPowerManaged: c_uint = kIOPMNotPowerManaged;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmsoftsleep?language=objc)
pub const IOPMSoftSleep: c_uint = kIOPMSoftSleep;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnexthigherstate?language=objc)
pub const kIOPMNextHigherState: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmhigheststate?language=objc)
pub const kIOPMHighestState: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnextlowerstate?language=objc)
pub const kIOPMNextLowerState: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmloweststate?language=objc)
pub const kIOPMLowestState: c_uint = 4;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnexthigherstate?language=objc)
pub const IOPMNextHigherState: c_uint = kIOPMNextHigherState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmhigheststate?language=objc)
pub const IOPMHighestState: c_uint = kIOPMHighestState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnextlowerstate?language=objc)
pub const IOPMNextLowerState: c_uint = kIOPMNextLowerState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmloweststate?language=objc)
pub const IOPMLowestState: c_uint = kIOPMLowestState;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbroadcastaggressiveness?language=objc)
pub const kIOPMBroadcastAggressiveness: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmunidledevice?language=objc)
pub const kIOPMUnidleDevice: c_uint = 2;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmunknown?language=objc)
pub const kIOPMUnknown: c_uint = 0xFFFF;

/// kIOPMDriverAssertionCPUBit
/// When set, PM kernel will prefer to leave the CPU and core hardware
/// running in "Dark Wake" state, instead of sleeping.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertioncpubit?language=objc)
pub const kIOPMDriverAssertionCPUBit: c_uint = 0x01;
/// kIOPMDriverAssertionPreventSystemIdleSleepBit
/// When set, the system should not idle sleep. This does not prevent
/// demand sleep.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionpreventsystemidlesleepbit?language=objc)
pub const kIOPMDriverAssertionPreventSystemIdleSleepBit: c_uint = 0x02;
/// kIOPMDriverAssertionUSBExternalDeviceBit
/// When set, driver is informing PM that an external USB device is attached.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionusbexternaldevicebit?language=objc)
pub const kIOPMDriverAssertionUSBExternalDeviceBit: c_uint = 0x04;
/// kIOPMDriverAssertionBluetoothHIDDevicePairedBit
/// When set, driver is informing PM that a Bluetooth HID device is paired.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionbluetoothhiddevicepairedbit?language=objc)
pub const kIOPMDriverAssertionBluetoothHIDDevicePairedBit: c_uint = 0x08;
/// kIOPMDriverAssertionExternalMediaMountedBit
/// When set, driver is informing PM that an external media is mounted.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionexternalmediamountedbit?language=objc)
pub const kIOPMDriverAssertionExternalMediaMountedBit: c_uint = 0x10;
/// kIOPMDriverAssertionReservedBit5
/// Reserved for Thunderbolt.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionreservedbit5?language=objc)
pub const kIOPMDriverAssertionReservedBit5: c_uint = 0x20;
/// kIOPMDriverAssertionPreventDisplaySleepBit
/// When set, the display should remain powered on while the system's awake.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionpreventdisplaysleepbit?language=objc)
pub const kIOPMDriverAssertionPreventDisplaySleepBit: c_uint = 0x40;
/// kIOPMDriverAssertionReservedBit7
/// Reserved for storage family.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionreservedbit7?language=objc)
pub const kIOPMDriverAssertionReservedBit7: c_uint = 0x80;
/// kIOPMDriverAssertionMagicPacketWakeEnabledBit
/// When set, driver is informing PM that magic packet wake is enabled.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionmagicpacketwakeenabledbit?language=objc)
pub const kIOPMDriverAssertionMagicPacketWakeEnabledBit: c_uint = 0x100;
/// kIOPMDriverAssertionNetworkKeepAliveActiveBit
/// When set, driver is informing PM that it is holding the network
/// interface up to do TCPKeepAlive
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionnetworkkeepaliveactivebit?language=objc)
pub const kIOPMDriverAssertionNetworkKeepAliveActiveBit: c_uint = 0x200;
/// kIOPMDriverAssertionForceWakeupBit
/// When set, the system will immediately wake up the CPU after going to sleep.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionforcewakeupbit?language=objc)
pub const kIOPMDriverAssertionForceWakeupBit: c_uint = 0x400;
/// kIOPMDriverAssertionForceFullWakeupBit
/// When set, the system will immediately do a full wakeup after going to sleep.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdriverassertionforcefullwakeupbit?language=objc)
pub const kIOPMDriverAssertionForceFullWakeupBit: c_uint = 0x800;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kclamshellstatebit?language=objc)
pub const kClamshellStateBit: c_uint = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kclamshellsleepbit?language=objc)
pub const kClamshellSleepBit: c_uint = 1 << 1;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kinflowforciblyenabledbit?language=objc)
pub const kInflowForciblyEnabledBit: c_uint = 1 << 0;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsleepnow?language=objc)
pub const kIOPMSleepNow: c_uint = 1 << 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmallowsleep?language=objc)
pub const kIOPMAllowSleep: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpreventsleep?language=objc)
pub const kIOPMPreventSleep: c_uint = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowerbutton?language=objc)
pub const kIOPMPowerButton: c_uint = 1 << 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellclosed?language=objc)
pub const kIOPMClamshellClosed: c_uint = 1 << 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoweremergency?language=objc)
pub const kIOPMPowerEmergency: c_uint = 1 << 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdisableclamshell?language=objc)
pub const kIOPMDisableClamshell: c_uint = 1 << 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmenableclamshell?language=objc)
pub const kIOPMEnableClamshell: c_uint = 1 << 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmprocessorspeedchange?language=objc)
pub const kIOPMProcessorSpeedChange: c_uint = 1 << 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmovertemp?language=objc)
pub const kIOPMOverTemp: c_uint = 1 << 9;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellopened?language=objc)
pub const kIOPMClamshellOpened: c_uint = 1 << 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmdwovertemp?language=objc)
pub const kIOPMDWOverTemp: c_uint = 1 << 11;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpowerbuttonup?language=objc)
pub const kIOPMPowerButtonUp: c_uint = 1 << 12;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpromodeengaged?language=objc)
pub const kIOPMProModeEngaged: c_uint = 1 << 13;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpromodedisengaged?language=objc)
pub const kIOPMProModeDisengaged: c_uint = 1 << 14;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnoerr?language=objc)
pub const kIOPMNoErr: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmackimplied?language=objc)
pub const kIOPMAckImplied: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmwillacklater?language=objc)
pub const kIOPMWillAckLater: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbadspecification?language=objc)
pub const kIOPMBadSpecification: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnosuchstate?language=objc)
pub const kIOPMNoSuchState: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmcannotraisepower?language=objc)
pub const kIOPMCannotRaisePower: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmparametererror?language=objc)
pub const kIOPMParameterError: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnotyetinitialized?language=objc)
pub const kIOPMNotYetInitialized: c_uint = 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnoerr?language=objc)
pub const IOPMNoErr: c_uint = kIOPMNoErr;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmackimplied?language=objc)
pub const IOPMAckImplied: c_uint = kIOPMAckImplied;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmwillacklater?language=objc)
pub const IOPMWillAckLater: c_uint = kIOPMWillAckLater;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmbadspecification?language=objc)
pub const IOPMBadSpecification: c_uint = kIOPMBadSpecification;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnosuchstate?language=objc)
pub const IOPMNoSuchState: c_uint = kIOPMNoSuchState;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcannotraisepower?language=objc)
pub const IOPMCannotRaisePower: c_uint = kIOPMCannotRaisePower;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmparametererror?language=objc)
pub const IOPMParameterError: c_uint = kIOPMParameterError;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmnotyetinitialized?language=objc)
pub const IOPMNotYetInitialized: c_uint = kIOPMNotYetInitialized;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationleft?language=objc)
pub const kIOPMPSLocationLeft: c_uint = 1001;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpslocationright?language=objc)
pub const kIOPMPSLocationRight: c_uint = 1002;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmundefinedvalue?language=objc)
pub const kIOPMUndefinedValue: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmpoorvalue?language=objc)
pub const kIOPMPoorValue: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmfairvalue?language=objc)
pub const kIOPMFairValue: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmgoodvalue?language=objc)
pub const kIOPMGoodValue: c_uint = 3;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodedisconnected?language=objc)
pub const kIOPSFamilyCodeDisconnected: c_int = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodefirewire?language=objc)
pub const kIOPSFamilyCodeFirewire: c_int = iokit_family_err!(sub_iokit_firewire, 0);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbhost?language=objc)
pub const kIOPSFamilyCodeUSBHost: c_int = iokit_family_err!(sub_iokit_usb, 0);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbhostsuspended?language=objc)
pub const kIOPSFamilyCodeUSBHostSuspended: c_int = iokit_family_err!(sub_iokit_usb, 1);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbdevice?language=objc)
pub const kIOPSFamilyCodeUSBDevice: c_int = iokit_family_err!(sub_iokit_usb, 2);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbadapter?language=objc)
pub const kIOPSFamilyCodeUSBAdapter: c_int = iokit_family_err!(sub_iokit_usb, 3);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingportdedicated?language=objc)
pub const kIOPSFamilyCodeUSBChargingPortDedicated: c_int = iokit_family_err!(sub_iokit_usb, 4);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingportdownstream?language=objc)
pub const kIOPSFamilyCodeUSBChargingPortDownstream: c_int = iokit_family_err!(sub_iokit_usb, 5);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbchargingport?language=objc)
pub const kIOPSFamilyCodeUSBChargingPort: c_int = iokit_family_err!(sub_iokit_usb, 6);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbunknown?language=objc)
pub const kIOPSFamilyCodeUSBUnknown: c_int = iokit_family_err!(sub_iokit_usb, 7);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbcbrick?language=objc)
pub const kIOPSFamilyCodeUSBCBrick: c_int = iokit_family_err!(sub_iokit_usb, 8);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbctypec?language=objc)
pub const kIOPSFamilyCodeUSBCTypeC: c_int = iokit_family_err!(sub_iokit_usb, 9);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeusbcpd?language=objc)
pub const kIOPSFamilyCodeUSBCPD: c_int = iokit_family_err!(sub_iokit_usb, 10);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeac?language=objc)
pub const kIOPSFamilyCodeAC: c_int = iokit_family_err!(sub_iokit_pmu, 0);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal?language=objc)
pub const kIOPSFamilyCodeExternal: c_int = iokit_family_err!(sub_iokit_pmu, 1);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal2?language=objc)
pub const kIOPSFamilyCodeExternal2: c_int = iokit_family_err!(sub_iokit_pmu, 2);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal3?language=objc)
pub const kIOPSFamilyCodeExternal3: c_int = iokit_family_err!(sub_iokit_pmu, 3);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal4?language=objc)
pub const kIOPSFamilyCodeExternal4: c_int = iokit_family_err!(sub_iokit_pmu, 4);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal5?language=objc)
pub const kIOPSFamilyCodeExternal5: c_int = iokit_family_err!(sub_iokit_pmu, 5);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal6?language=objc)
pub const kIOPSFamilyCodeExternal6: c_int = iokit_family_err!(sub_iokit_pmu, 6);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal7?language=objc)
pub const kIOPSFamilyCodeExternal7: c_int = iokit_family_err!(sub_iokit_pmu, 7);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeexternal8?language=objc)
pub const kIOPSFamilyCodeExternal8: c_int = iokit_family_err!(sub_iokit_pmu, 8);
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsfamilycodeunsupportedregion?language=objc)
pub const kIOPSFamilyCodeUnsupportedRegion: c_int = iokit_family_err!(sub_iokit_pmu, 9);

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagnoerrors?language=objc)
pub const kIOPSAdapterErrorFlagNoErrors: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflaginsufficientavailablepower?language=objc)
pub const kIOPSAdapterErrorFlagInsufficientAvailablePower: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagforeignobjectdetected?language=objc)
pub const kIOPSAdapterErrorFlagForeignObjectDetected: c_uint = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopsadaptererrorflagdeviceneedstoberepositioned?language=objc)
pub const kIOPSAdapterErrorFlagDeviceNeedsToBeRepositioned: c_uint = 1 << 3;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelnormal?language=objc)
pub const kIOPMThermalLevelNormal: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalleveldanger?language=objc)
pub const kIOPMThermalLevelDanger: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelcritical?language=objc)
pub const kIOPMThermalLevelCritical: c_uint = 10;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelwarning?language=objc)
pub const kIOPMThermalLevelWarning: c_uint = 100;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermalleveltrap?language=objc)
pub const kIOPMThermalLevelTrap: c_uint = 110;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmthermallevelunknown?language=objc)
pub const kIOPMThermalLevelUnknown: c_uint = 255;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmcalendarstruct?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IOPMCalendarStruct {
    pub year: u32,
    pub month: u8,
    pub day: u8,
    pub hour: u8,
    pub minute: u8,
    pub second: u8,
    pub selector: u8,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPMCalendarStruct {
    const ENCODING: Encoding = Encoding::Struct(
        "IOPMCalendarStruct",
        &[
            <u32>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
            <u8>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPMCalendarStruct {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmgeneralaggressiveness?language=objc)
pub const kPMGeneralAggressiveness: c_uint = 0;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestodim?language=objc)
pub const kPMMinutesToDim: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestospindown?language=objc)
pub const kPMMinutesToSpinDown: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmminutestosleep?language=objc)
pub const kPMMinutesToSleep: c_uint = 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmethernetwakeonlansettings?language=objc)
pub const kPMEthernetWakeOnLANSettings: c_uint = 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmsetprocessorspeed?language=objc)
pub const kPMSetProcessorSpeed: c_uint = 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmpowersource?language=objc)
pub const kPMPowerSource: c_uint = 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmmotionsensor?language=objc)
pub const kPMMotionSensor: c_uint = 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kpmlastaggressivenesstype?language=objc)
pub const kPMLastAggressivenessType: c_uint = 8;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopminternalpower?language=objc)
pub const kIOPMInternalPower: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmexternalpower?language=objc)
pub const kIOPMExternalPower: c_uint = 2;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatteryinstalled?language=objc)
pub const kIOBatteryInstalled: c_uint = 1 << 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterycharge?language=objc)
pub const kIOBatteryCharge: c_uint = 1 << 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiobatterychargerconnect?language=objc)
pub const kIOBatteryChargerConnect: c_uint = 1 << 0;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmacinstalled?language=objc)
pub const kIOPMACInstalled: c_uint = kIOBatteryChargerConnect;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterycharging?language=objc)
pub const kIOPMBatteryCharging: c_uint = kIOBatteryCharge;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatteryinstalled?language=objc)
pub const kIOPMBatteryInstalled: c_uint = kIOBatteryInstalled;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmupsinstalled?language=objc)
pub const kIOPMUPSInstalled: c_uint = 1 << 3;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatteryatwarn?language=objc)
pub const kIOPMBatteryAtWarn: c_uint = 1 << 4;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmbatterydepleted?language=objc)
pub const kIOPMBatteryDepleted: c_uint = 1 << 5;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmacnochargecapability?language=objc)
pub const kIOPMACnoChargeCapability: c_uint = 1 << 6;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmrawlowbattery?language=objc)
pub const kIOPMRawLowBattery: c_uint = 1 << 7;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmforcelowspeed?language=objc)
pub const kIOPMForceLowSpeed: c_uint = 1 << 8;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclosedclamshell?language=objc)
pub const kIOPMClosedClamshell: c_uint = 1 << 9;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmclamshellstateonwake?language=objc)
pub const kIOPMClamshellStateOnWake: c_uint = 1 << 10;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopowerstatechangenotification?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IOPowerStateChangeNotification {
    pub powerRef: *mut c_void,
    pub returnValue: c_ulong,
    pub stateNumber: c_ulong,
    pub stateFlags: IOPMPowerFlags,
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPowerStateChangeNotification {
    const ENCODING: Encoding = Encoding::Struct(
        "IOPowerStateChangeNotification",
        &[
            <*mut c_void>::ENCODING,
            Encoding::C_ULONG,
            Encoding::C_ULONG,
            <IOPMPowerFlags>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPowerStateChangeNotification {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/sleepwakenote?language=objc)
pub type sleepWakeNote = IOPowerStateChangeNotification;

/// A structure describing a system capability change.
///
/// A system capability change is a system level transition from a set
/// of system capabilities to a new set of system capabilities. Power management
/// sends a
/// <code>
/// kIOMessageSystemCapabilityChange
/// </code>
/// message and provides
/// this structure as the message data (by reference) to
/// <code>
/// gIOPriorityPowerStateInterest
/// </code>
/// clients when system capability
/// changes.
/// Field: notifyRef An identifier for this message notification. Clients with pending
/// I/O can signal completion by calling
/// <code>
/// allowPowerChange()
/// </code>
/// with this
/// value as the argument. Clients that are able to process the notification
/// synchronously should ignore this field.
/// Field: maxWaitForReply A return value to the caller indicating the maximum time in
/// microseconds to wait for the
/// <code>
/// allowPowerChange()
/// </code>
/// call. The default
/// value is zero, which indicates the client processing has finished, and power
/// management should not wait for an
/// <code>
/// allowPowerChange()
/// </code>
/// call.
/// Field: changeFlags Flags will be set to indicate whether the notification precedes
/// the capability change (
/// <code>
/// kIOPMSystemCapabilityWillChange
/// </code>
/// ), or after
/// the capability change has occurred (
/// <code>
/// kIOPMSystemCapabilityDidChange
/// </code>
/// ).
/// Field: __reserved1 Set to zero.
/// Field: fromCapabilities The system capabilities at the start of the transition.
/// Field: toCapabilities The system capabilities at the end of the transition.
/// Field: __reserved2 Set to zero.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmsystemcapabilitychangeparameters?language=objc)
#[repr(C)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub struct IOPMSystemCapabilityChangeParameters {
    pub notifyRef: u32,
    pub maxWaitForReply: u32,
    pub changeFlags: u32,
    pub(crate) __reserved1: u32,
    pub fromCapabilities: u32,
    pub toCapabilities: u32,
    pub(crate) __reserved2: [u32; 4],
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPMSystemCapabilityChangeParameters {
    const ENCODING: Encoding = Encoding::Struct(
        "IOPMSystemCapabilityChangeParameters",
        &[
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <u32>::ENCODING,
            <[u32; 4]>::ENCODING,
        ],
    );
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPMSystemCapabilityChangeParameters {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitywillchange?language=objc)
pub const kIOPMSystemCapabilityWillChange: c_uint = 0x01;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitydidchange?language=objc)
pub const kIOPMSystemCapabilityDidChange: c_uint = 0x02;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitycpu?language=objc)
pub const kIOPMSystemCapabilityCPU: c_uint = 0x01;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitygraphics?language=objc)
pub const kIOPMSystemCapabilityGraphics: c_uint = 0x02;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilityaudio?language=objc)
pub const kIOPMSystemCapabilityAudio: c_uint = 0x04;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilitynetwork?language=objc)
pub const kIOPMSystemCapabilityNetwork: c_uint = 0x08;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmsystemcapabilityaot?language=objc)
pub const kIOPMSystemCapabilityAOT: c_uint = 0x10;

/// Finds the Root Power Domain IOService.
///
/// Parameter `master_device_port`: Just pass in MACH_PORT_NULL for master device port.
///
/// Returns: Returns a io_connect_t handle on the root domain. Must be released with IOServiceClose() when done.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMFindPowerManagement(
    master_device_port: libc::mach_port_t,
) -> io_connect_t {
    extern "C-unwind" {
        fn IOPMFindPowerManagement(master_device_port: libc::mach_port_t) -> io_connect_t;
    }
    unsafe { IOPMFindPowerManagement(master_device_port) }
}

/// Sets one of the aggressiveness factors in IOKit Power Management.
///
/// Parameter `fb`: Representation of the Root Power Domain from IOPMFindPowerManagement.
///
/// Parameter `type`: Specifies which aggressiveness factor is being set.
///
/// Parameter `aggressiveness`: New value of the aggressiveness factor.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMSetAggressiveness(
    fb: io_connect_t,
    r#type: c_ulong,
    aggressiveness: c_ulong,
) -> IOReturn {
    extern "C-unwind" {
        fn IOPMSetAggressiveness(
            fb: io_connect_t,
            r#type: c_ulong,
            aggressiveness: c_ulong,
        ) -> IOReturn;
    }
    unsafe { IOPMSetAggressiveness(fb, r#type, aggressiveness) }
}

extern "C-unwind" {
    /// Retrieves the current value of one of the aggressiveness factors in IOKit Power Management.
    ///
    /// Parameter `fb`: Representation of the Root Power Domain from IOPMFindPowerManagement.
    ///
    /// Parameter `type`: Specifies which aggressiveness factor is being retrieved.
    ///
    /// Parameter `aggressiveness`: Points to where to store the retrieved value of the aggressiveness factor.
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `aggressiveness` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IOPMGetAggressiveness(
        fb: io_connect_t,
        r#type: c_ulong,
        aggressiveness: *mut c_ulong,
    ) -> IOReturn;
}

/// Tells whether the system supports full sleep, or just doze
///
/// Returns: Returns true if the system supports sleep, false if some hardware prevents full sleep.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMSleepEnabled() -> bool {
    extern "C-unwind" {
        fn IOPMSleepEnabled() -> libc::boolean_t;
    }
    let ret = unsafe { IOPMSleepEnabled() };
    ret != 0
}

/// Request that the system initiate sleep.
///
/// For security purposes, caller must be root or the console user.
///
/// Parameter `fb`: Port used to communicate to the kernel,  from IOPMFindPowerManagement.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOPMSleepSystem(fb: io_connect_t) -> IOReturn {
    extern "C-unwind" {
        fn IOPMSleepSystem(fb: io_connect_t) -> IOReturn;
    }
    unsafe { IOPMSleepSystem(fb) }
}

extern "C-unwind" {
    /// Request battery data from the system.
    ///
    /// This API is supported, but not recommended. Developers should prefer to use
    /// the IOPowerSources API. IOPowerSources provides more battery data, and notifications
    /// when battery state changes)
    ///
    /// Parameter `masterPort`: The master port obtained from IOMasterPort(). Just pass MACH_PORT_NULL.
    ///
    /// Parameter `info`: A CFArray of CFDictionaries containing raw battery data. Use these keys, defined in IOPM.h
    /// to read from the dictionary:
    /// <pre>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryInfoKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryCurrentChargeKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryCapacityKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryFlagsKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryVoltageKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryAmperageKey
    /// ```
    ///
    /// </code>
    /// <code>
    ///
    /// ```text
    ///  kIOBatteryCycleCountKey
    /// ```
    ///
    /// </code>
    /// </pre>
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `info` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IOPMCopyBatteryInfo(
        master_port: libc::mach_port_t,
        info: *mut *const CFArray,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// DEPRECATED - An obsolete method for interacting with driver power state changes.
    ///
    /// This function is obsolete and deprecated. To receive notifications of driver power state changes,
    /// Please use IOServiceAddInterestNotification with interest type gIOGeneralInterest instead.
    ///
    /// # Safety
    ///
    /// - `refcon` must be a valid pointer.
    /// - `the_port_ref` must be a valid pointer.
    /// - `callback` must be implemented correctly.
    /// - `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    #[deprecated]
    pub fn IORegisterApp(
        refcon: *mut c_void,
        the_driver: io_service_t,
        the_port_ref: *mut IONotificationPortRef,
        callback: IOServiceInterestCallback,
        notifier: *mut io_object_t,
    ) -> io_connect_t;
}

extern "C-unwind" {
    /// Connects the caller to the Root Power Domain IOService for the purpose of receiving sleep
    /// &
    /// wake notifications for the system.
    /// Does not provide system shutdown and restart notifications.
    ///
    /// Provides sleep/wake notifications to applications. Requires that applications acknowledge
    /// some, but not all notifications. Register for sleep/wake notifications will deliver these messages
    /// over the sleep/wake lifecycle:
    /// <ul>
    /// <li>
    /// kIOMessageSystemWillSleep is delivered at the point the system is initiating a
    /// non-abortable sleep.
    /// Callers MUST acknowledge this event by calling
    ///
    /// ```text
    ///  IOAllowPowerChange
    /// ```
    ///
    /// .
    /// If a caller does not acknowledge the sleep notification, the sleep will continue anyway after
    /// a 30 second timeout (resulting in bad user experience).
    /// Delivered before any hardware is powered off.
    ///
    /// <li>
    /// kIOMessageSystemWillPowerOn is delivered at early wakeup time, before most hardware has been
    /// powered on. Be aware that any attempts to access disk, network, the display, etc. may result
    /// in errors or blocking your process until those resources become available.
    /// Caller must NOT acknowledge kIOMessageSystemWillPowerOn; the caller must simply return from its handler.
    ///
    /// <li>
    /// kIOMessageSystemHasPoweredOn is delivered at wakeup completion time, after all device drivers and
    /// hardware have handled the wakeup event. Expect this event 1-5 or more seconds after initiating
    /// system wakeup.
    /// Caller must NOT acknowledge kIOMessageSystemHasPoweredOn; the caller must simply return from its handler.
    ///
    /// <li>
    /// kIOMessageCanSystemSleep indicates the system is pondering an idle sleep, but gives apps the
    /// chance to veto that sleep attempt.
    /// Caller must acknowledge kIOMessageCanSystemSleep by calling
    ///
    /// ```text
    ///  IOAllowPowerChange
    /// ```
    ///
    /// or
    ///
    /// ```text
    ///  IOCancelPowerChange
    /// ```
    ///
    /// . Calling IOAllowPowerChange will not veto the sleep; any
    /// app that calls IOCancelPowerChange will veto the idle sleep. A kIOMessageCanSystemSleep
    /// notification will be followed up to 30 seconds later by a kIOMessageSystemWillSleep message.
    /// or a kIOMessageSystemWillNotSleep message.
    ///
    /// <li>
    /// kIOMessageSystemWillNotSleep is delivered when some app client has vetoed an idle sleep
    /// request. kIOMessageSystemWillNotSleep may follow a kIOMessageCanSystemSleep notification,
    /// but will not otherwise be sent.
    /// Caller must NOT acknowledge kIOMessageSystemWillNotSleep; the caller must simply return from its handler.
    /// </ul>
    /// To deregister for sleep/wake notifications, the caller must make two calls, in this order:
    /// <ol>
    /// <li>
    /// Call IODeregisterForSystemPower with the 'notifier' argument returned here.
    /// <li>
    /// Then call IONotificationPortDestroy passing the 'thePortRef' argument
    /// returned here.
    /// </ol>
    ///
    /// Parameter `refcon`: Caller may provide data to receive as an argument to 'callback' on power state changes.
    ///
    /// Parameter `thePortRef`: On return, thePortRef is a pointer to an IONotificationPortRef, which will deliver the power notifications.
    /// The port is allocated by this function and must be later released by the caller (after calling
    /// <code>
    ///
    /// ```text
    ///  IODeregisterForSystemPower
    /// ```
    ///
    /// </code>
    /// ).
    /// The caller should also enable IONotificationPortRef by calling
    /// <code>
    ///
    /// ```text
    ///  IONotificationPortGetRunLoopSource
    /// ```
    ///
    /// </code>
    /// , or
    /// <code>
    ///
    /// ```text
    ///  IONotificationPortGetMachPort
    /// ```
    ///
    /// </code>
    /// , or
    /// <code>
    ///
    /// ```text
    ///  IONotificationPortSetDispatchQueue
    /// ```
    ///
    /// </code>
    /// .
    ///
    /// Parameter `callback`: A c-function which is called during the notification.
    ///
    /// Parameter `notifier`: On success, returns a pointer to a unique notifier which caller must keep and pass to a subsequent call to IODeregisterForSystemPower.
    ///
    /// Returns: Returns a io_connect_t session for the IOPMrootDomain or IO_OBJECT_NULL if request failed.
    /// Caller must close return value via IOServiceClose() after calling IODeregisterForSystemPower on the notifier argument.
    ///
    /// # Safety
    ///
    /// - `refcon` must be a valid pointer.
    /// - `the_port_ref` must be a valid pointer.
    /// - `callback` must be implemented correctly.
    /// - `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IORegisterForSystemPower(
        refcon: *mut c_void,
        the_port_ref: *mut IONotificationPortRef,
        callback: IOServiceInterestCallback,
        notifier: *mut io_object_t,
    ) -> io_connect_t;
}

extern "C-unwind" {
    /// 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).
    ///
    /// Parameter `notifier`: An object from IORegisterApp.
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IODeregisterApp(notifier: *mut io_object_t) -> IOReturn;
}

extern "C-unwind" {
    /// 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.)
    ///
    /// Parameter `notifier`: The object returned from IORegisterForSystemPower.
    ///
    /// Returns: Returns kIOReturnSuccess or an error condition if request failed.
    ///
    /// # Safety
    ///
    /// `notifier` must be a valid pointer.
    #[cfg(feature = "libc")]
    pub fn IODeregisterForSystemPower(notifier: *mut io_object_t) -> IOReturn;
}

/// The caller acknowledges notification of a power state change on a device it has registered for notifications for via IORegisterForSystemPower or IORegisterApp.
///
/// Must be used when handling kIOMessageCanSystemSleep and kIOMessageSystemWillSleep messages from IOPMrootDomain system power. The caller should not call IOAllowPowerChange in response to any messages
/// except for these two.
///
/// Parameter `kernelPort`: Port used to communicate to the kernel,  from IORegisterApp or IORegisterForSystemPower.
///
/// Parameter `notificationID`: A copy of the notification ID which came as part of the power state change notification being acknowledged.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOAllowPowerChange(
    kernel_port: io_connect_t,
    notification_id: isize,
) -> IOReturn {
    extern "C-unwind" {
        fn IOAllowPowerChange(kernel_port: io_connect_t, notification_id: isize) -> IOReturn;
    }
    unsafe { IOAllowPowerChange(kernel_port, notification_id) }
}

/// The caller denies an idle system sleep power state change.
///
/// 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.
///
/// When an app responds to a kIOMessageCanSystemSleep message by calling IOCancelPowerChange, the app
/// vetoes the idle sleep request. The system will stay awake.
/// The idle timer will elapse again after a period of inactivity, and the system will
/// send out the same kIOMessageCanSystemSleep message, and interested applications will respond gain.
///
///
/// Parameter `kernelPort`: Port used to communicate to the kernel,  from IORegisterApp or IORegisterForSystemPower.
///
/// Parameter `notificationID`: A copy of the notification ID which came as part of the power state change notification being acknowledged.
///
/// Returns: Returns kIOReturnSuccess or an error condition if request failed.
#[cfg(feature = "libc")]
#[inline]
pub extern "C-unwind" fn IOCancelPowerChange(
    kernel_port: io_connect_t,
    notification_id: isize,
) -> IOReturn {
    extern "C-unwind" {
        fn IOCancelPowerChange(kernel_port: io_connect_t, notification_id: isize) -> IOReturn;
    }
    unsafe { IOCancelPowerChange(kernel_port, notification_id) }
}

extern "C-unwind" {
    /// Schedule the machine to wake from sleep, power on, go to sleep, or shutdown.
    ///
    /// 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.
    ///
    /// Parameter `time_to_wake`: Date and time that the system will power on/off.
    ///
    /// Parameter `my_id`: A CFStringRef identifying the calling app by CFBundleIdentifier. May be NULL.
    ///
    /// Parameter `type`: The type of power on you desire, either wake from sleep or power on. Choose from:
    /// <ul>
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoWake
    /// </code>
    /// ) == wake machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoPowerOn
    /// </code>
    /// ) == power on machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoWakeOrPowerOn
    /// </code>
    /// ) == wake or power on,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoSleep
    /// </code>
    /// ) == sleep machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoShutdown
    /// </code>
    /// ) == power off machine,
    /// <li>
    /// CFSTR(
    /// <code>
    /// kIOPMAutoRestart
    /// </code>
    /// ) == restart the machine.
    /// </ul>
    ///
    /// Returns: kIOReturnSuccess on success, otherwise on failure
    ///
    /// # Safety
    ///
    /// - `time_to_wake` might not allow `None`.
    /// - `my_id` might not allow `None`.
    /// - `type` might not allow `None`.
    pub fn IOPMSchedulePowerEvent(
        time_to_wake: Option<&CFDate>,
        my_id: Option<&CFString>,
        r#type: Option<&CFString>,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Cancel a previously scheduled power event.
    ///
    /// Arguments mirror those to IOPMSchedulePowerEvent. All arguments must match the original arguments from when the power on was scheduled. Must be called as root.
    ///
    /// Parameter `time_to_wake`: Cancel entry with this date and time.
    ///
    /// Parameter `my_id`: Cancel entry with this name.
    ///
    /// Parameter `type`: Type to cancel
    ///
    /// Returns: kIOReturnSuccess on success, otherwise on failure
    ///
    /// # Safety
    ///
    /// - `time_to_wake` might not allow `None`.
    /// - `my_id` might not allow `None`.
    /// - `type` might not allow `None`.
    pub fn IOPMCancelScheduledPowerEvent(
        time_to_wake: Option<&CFDate>,
        my_id: Option<&CFString>,
        r#type: Option<&CFString>,
    ) -> IOReturn;
}

/// List all scheduled system power events
///
/// Returns a CFArray of CFDictionaries of power events. Each CFDictionary  contains keys for CFSTR(kIOPMPowerEventTimeKey), CFSTR(kIOPMPowerEventAppNameKey), and CFSTR(kIOPMPowerEventTypeKey).
///
/// Returns: A CFArray of CFDictionaries of power events. The CFArray must be released by the caller. NULL if there are no scheduled events.
#[inline]
pub extern "C-unwind" fn IOPMCopyScheduledPowerEvents() -> Option<CFRetained<CFArray>> {
    extern "C-unwind" {
        fn IOPMCopyScheduledPowerEvents() -> Option<NonNull<CFArray>>;
    }
    let ret = unsafe { IOPMCopyScheduledPowerEvents() };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

/// Type for AssertionID arguments to
/// <code>
///
/// ```text
///  IOPMAssertionCreateWithProperties
/// ```
///
/// </code>
/// and
/// <code>
///
/// ```text
///  IOPMAssertionRelease
/// ```
///
/// </code>
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmassertionid?language=objc)
pub type IOPMAssertionID = u32;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmnullassertionid?language=objc)
pub const kIOPMNullAssertionID: c_uint = 0;

/// Type for AssertionLevel argument to IOPMAssertionCreate
///
///
/// Possible values for
/// <code>
/// IOPMAssertionLevel
/// </code>
/// are
/// <code>
///
/// ```text
///  kIOPMAssertionLevelOff
/// ```
///
/// </code>
/// and
/// <code>
///
/// ```text
///  kIOPMAssertionLevelOn
/// ```
///
/// </code>
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmassertionlevel?language=objc)
pub type IOPMAssertionLevel = u32;

/// Level for a disabled assertion, passed as an argument to IOPMAssertionCreate.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionleveloff?language=objc)
pub const kIOPMAssertionLevelOff: c_uint = 0;
/// Level for an enabled assertion, passed as an argument to IOPMAssertionCreate.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/kiopmassertionlevelon?language=objc)
pub const kIOPMAssertionLevelOn: c_uint = 255;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/iopmuseractivetype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct IOPMUserActiveType(pub c_uint);
impl IOPMUserActiveType {
    #[doc(alias = "kIOPMUserActiveLocal")]
    pub const Local: Self = Self(0);
    #[doc(alias = "kIOPMUserActiveRemote")]
    pub const Remote: Self = Self(1);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for IOPMUserActiveType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for IOPMUserActiveType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern "C-unwind" {
    /// The preferred API to create a power assertion.
    ///
    /// Creates an IOPMAssertion. This is the preferred API to call to create an assertion.
    /// It allows the caller to specify the Name, Details, and HumanReadableReason at creation time.
    /// There are other keys that can further describe an assertion, but most developers don't need
    /// to use them. Use
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionSetProperty
    /// ```
    ///
    /// </code>
    /// or
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionCreateWithProperties
    /// ```
    ///
    /// </code>
    /// if you need to specify properties
    /// that aren't available here.
    ///
    ///
    /// Parameter `AssertionType`: An assertion type constant.
    /// Caller must specify this argument.
    ///
    ///
    /// Parameter `Name`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionNameKey
    /// ```
    ///
    /// </code>
    /// .
    /// Caller must specify this argument.
    ///
    ///
    /// Parameter `Details`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionDetailsKey
    /// ```
    ///
    /// </code>
    /// .
    /// Caller may pass NULL, but it helps power users and administrators identify the
    /// reasons for this assertion.
    ///
    ///
    /// Parameter `HumanReadableReason`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionHumanReadableReasonKey
    /// ```
    ///
    /// </code>
    /// .
    /// Caller may pass NULL, but if it's specified OS X may display it to users
    /// to describe the active assertions on their system.
    ///
    ///
    /// Parameter `LocalizationBundlePath`: A CFString value to correspond to key
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionLocalizationBundlePathKey
    /// ```
    ///
    /// </code>
    /// .
    /// This bundle path should include a localization for the string
    /// <code>
    /// HumanReadableReason
    /// </code>
    /// Caller may pass NULL, but this argument is required if caller specifies
    /// <code>
    /// HumanReadableReason
    /// </code>
    ///
    ///
    /// Parameter `Timeout`: Specifies a timeout for this assertion. Pass 0 for no timeout.
    ///
    ///
    /// Parameter `TimeoutAction`: Specifies a timeout action. Caller my pass NULL. If a timeout is specified but a TimeoutAction is not,
    /// the default timeout action is
    /// <code>
    /// kIOPMAssertionTimeoutActionTurnOff
    /// </code>
    ///
    ///
    /// Parameter `AssertionID`: (Output) On successful return, contains a unique reference to a PM assertion.
    ///
    ///
    /// Returns: kIOReturnSuccess, or another IOKit return code on error.
    ///
    /// # Safety
    ///
    /// - `assertion_type` might not allow `None`.
    /// - `name` might not allow `None`.
    /// - `details` might not allow `None`.
    /// - `human_readable_reason` might not allow `None`.
    /// - `localization_bundle_path` might not allow `None`.
    /// - `timeout_action` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionCreateWithDescription(
        assertion_type: Option<&CFString>,
        name: Option<&CFString>,
        details: Option<&CFString>,
        human_readable_reason: Option<&CFString>,
        localization_bundle_path: Option<&CFString>,
        timeout: CFTimeInterval,
        timeout_action: Option<&CFString>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Creates an IOPMAssertion with more flexibility than
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionCreateWithDescription
    /// ```
    ///
    /// </code>
    /// .
    ///
    /// Parameter `AssertionProperties`: Dictionary providing the properties of the assertion that need to be created.
    ///
    /// Parameter `AssertionID`: (Output) On successful return, contains a unique reference to a PM assertion.
    ///
    ///
    /// Create a new PM assertion - the caller must specify the type of assertion, initial level, and its
    /// properties as
    ///
    /// ```text
    ///  IOPMAssertionDictionaryKeys
    /// ```
    ///
    /// keys in the
    /// <code>
    /// AssertionProperties
    /// </code>
    /// dictionary.
    /// The following keys are recommend and/or required to be specified in the AssertionProperties
    /// dictionary argument.
    /// <ul>
    /// <li>
    /// REQUIRED:
    /// <code>
    /// kIOPMAssertionTypeKey
    /// </code>
    /// define the assertion type.
    ///
    /// <li>
    /// REQUIRED:
    /// <code>
    /// kIOPMAssertionNameKey
    /// </code>
    /// Caller must describe the name for the activity that
    /// requires the change in behavior provided by the assertion.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionLevelKey
    /// </code>
    /// define an inital value. If not set, assertion is
    /// turned on after creation.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionDetailsKey
    /// </code>
    /// Caller may describe context-specific data about the
    /// assertion.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionHumanReadableReasonKey
    /// </code>
    /// Caller may describe the reason for creating the assertion
    /// in a localizable CFString. This should be a human readable phrase that describes the actions the
    /// calling process is taking while the assertion is held, like "Downloading TV episodes", or "Compiling Projects"
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionLocalizationBundlePathKey
    /// </code>
    /// Caller may provide its bundle's path, where OS X
    /// can localize for GUI display the CFString specified by
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertionHumanReadableReasonKey
    /// ```
    ///
    /// </code>
    /// .
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionPlugInIDKey
    /// </code>
    /// if the caller is a plugin with a different identity than the process
    /// it's loaded in.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionFrameworkIDKey
    /// </code>
    /// if the caller is a framework acting on behalf of a process.
    ///
    /// <li>
    /// OPTIONAL:
    /// <code>
    /// kIOPMAssertionTimeoutKey
    /// </code>
    /// The caller may specify a timeout.
    /// </ul>
    ///
    /// # Safety
    ///
    /// - `assertion_properties` generics must be of the correct type.
    /// - `assertion_properties` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionCreateWithProperties(
        assertion_properties: Option<&CFDictionary>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Declares that the user is active on the system.
    ///
    ///
    /// This causes the display to power on and postpone display sleep,
    /// up to the user's display sleep Energy Saver settings.
    ///
    /// If you need to hold the display awake for a longer period and you know
    /// how long you'd like to hold it, consider taking assertion
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertPreventUserIdleDisplaySleep
    /// ```
    ///
    /// </code>
    /// using
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionCreateWithDescription
    /// ```
    ///
    /// </code>
    /// API instead.
    ///
    /// No special privileges are necessary to make this call - any process may
    /// call this API. Caller must specify an AssertionName - NULL is not
    /// a valid input.
    ///
    ///
    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
    /// handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer
    /// than 128 characters.
    ///
    ///
    /// Parameter `userType`: This parameter specifies if the active user is located locally in front of the
    /// system or connected to the system over the network. Various components of the system
    /// are maintained at different power levels depending on user location.
    ///
    ///
    /// Parameter `AssertionID`: On Success, unique id will be returned in this parameter. Caller
    /// may call this function again with the unique id retured previously to report continous
    /// user activity. The unique id returned by this function may change on each call depending
    /// on how frequently this function call is repeated and the current display sleep timer value.
    /// If you make this call more than once, track the returned value for
    /// assertionID, and pass it in as an argument on each call.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_name` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionDeclareUserActivity(
        assertion_name: Option<&CFString>,
        user_type: IOPMUserActiveType,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// A convenience function for handling remote network clients; this is a wrapper for
    /// holding
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertNetworkClientActive
    /// ```
    ///
    /// </code>
    ///
    ///
    /// Call this whenever you detect activity from your remote network clients.
    /// This call generates an IPC call, and may block.
    ///
    /// On the first invocation, this will populate parameter
    /// <code>
    /// AssertionID
    /// </code>
    /// with a new assertion ID.
    /// You should pass in this returned assertion ID on every access.
    ///
    /// When system is on AC power, every call to
    /// <code>
    /// IOPMDeclareNetworkClientActivity
    /// </code>
    /// prevents system from idle sleeping and from demand sleeping for the duration of
    /// system sleep timer. When system is on Battery power, every call to
    /// <code>
    /// IOPMDeclareNetworkClientActivity
    /// </code>
    /// prevents system from idle sleeping for the
    /// duration of system sleep timer.
    ///
    /// Assertion created by this interface is valid only for the duration of system sleep timer
    /// from the last call. IOKit will disable
    /// <code>
    /// AssertionID
    /// </code>
    /// after that duration.
    ///
    /// If you detect that your remote client is no longer active, please immediately call
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionRelease
    /// ```
    ///
    /// </code>
    /// . Do not wait for the timeout.
    ///
    /// If your process can detect when remote clients are active and idle, you can skip
    /// this API and directly create
    /// <code>
    ///
    /// ```text
    ///  kIOPMAssertNetworkClientActive
    /// ```
    ///
    /// </code>
    /// yourself.
    ///
    /// If your remote clients require access to the framebuffer or the GPU, then this
    /// isn't the appropriate call for you. Please see
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionDeclareUserActivity
    /// ```
    ///
    /// </code>
    /// and pass in argument
    /// <code>
    ///
    /// ```text
    ///  kIOPMUserActiveRemote
    /// ```
    ///
    /// </code>
    /// .
    ///
    ///
    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
    /// handled by this assertion (e.g. "Serving a podcast"). The name must be less than
    /// 128 characters.
    /// *
    ///
    /// Parameter `AssertionID`: On Success, unique id will be returned in this parameter. Caller
    /// may call this function again with the unique id retured previously to report additional
    /// user activity. The unique id returned by this function may change on each call depending
    /// on how frequently this function call is repeated and the current system sleep timer value.
    /// If you make this call more than once, track the returned value for
    /// assertionID, and pass it in as an argument on each call.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_name` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMDeclareNetworkClientActivity(
        assertion_name: Option<&CFString>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

/// Increments the assertion's retain count.
///
/// Increments the retain count according to CoreFoundation style retain/release semantics.
/// Retain count can be inspected in the assertion's info dictionary at
/// key
/// <code>
///
/// ```text
///  kIOPMAssertionRetainCountKey
/// ```
///
/// </code>
///
/// Parameter `theAssertion`: The assertion ID to retain.
#[inline]
pub extern "C-unwind" fn IOPMAssertionRetain(the_assertion: IOPMAssertionID) {
    extern "C-unwind" {
        fn IOPMAssertionRetain(the_assertion: IOPMAssertionID);
    }
    unsafe { IOPMAssertionRetain(the_assertion) }
}

/// Decrements the assertion's retain count.
///
///
/// If the retain count becomes zero, then this also frees and deactivates
/// the assertion referred to by
/// <code>
/// assertionID
/// </code>
///
/// Calls to
/// <code>
///
/// ```text
///  IOPMAssertionCreate
/// ```
///
/// </code>
/// and
/// <code>
///
/// ```text
///  IOPMAssertionRetain
/// ```
///
/// </code>
/// must each be paired with calls to IOPMAssertionRelease.
///
///
/// Parameter `AssertionID`: The assertion_id, returned from IOPMAssertionCreate, to cancel.
///
///
/// Returns: Returns kIOReturnSuccess on success.
#[inline]
pub extern "C-unwind" fn IOPMAssertionRelease(assertion_id: IOPMAssertionID) -> IOReturn {
    extern "C-unwind" {
        fn IOPMAssertionRelease(assertion_id: IOPMAssertionID) -> IOReturn;
    }
    unsafe { IOPMAssertionRelease(assertion_id) }
}

/// Copies details about an
/// <code>
/// IOPMAssertion
/// </code>
/// .
///
/// Returns a dictionary describing an IOPMAssertion's specifications and current state.
///
/// Parameter `theAssertion`: The assertion ID to copy info about.
///
/// Returns: A dictionary describing the assertion with keys specified in See
///
/// ```text
///  IOPMAssertionDictionaryKeys
/// ```
///
/// .
/// It's the caller's responsibility to release this dictionary.
#[inline]
pub extern "C-unwind" fn IOPMAssertionCopyProperties(
    the_assertion: IOPMAssertionID,
) -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn IOPMAssertionCopyProperties(
            the_assertion: IOPMAssertionID,
        ) -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { IOPMAssertionCopyProperties(the_assertion) };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    /// Sets a property in the assertion.
    ///
    /// Only the process that created an assertion may change its properties.
    ///
    /// Parameter `theAssertion`: The
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionID
    /// ```
    ///
    /// </code>
    /// of the assertion to modify.
    ///
    /// Parameter `theProperty`: The CFString key, from
    /// <code>
    ///
    /// ```text
    ///  IOPMAssertionDictionaryKeys
    /// ```
    ///
    /// </code>
    /// to modify.
    ///
    /// Parameter `theValue`: The property to set. The value must match the CF type expected for the specified key.
    ///
    /// Returns: Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnNotPriviliged
    /// ```
    ///
    /// </code>
    /// if the caller doesn't
    /// have permission to modify this assertion.
    /// Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnNotFound
    /// ```
    ///
    /// </code>
    /// if PM can't locate this assertion.
    /// Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnError
    /// ```
    ///
    /// </code>
    /// upon an unidentified error.
    /// Returns
    /// <code>
    ///
    /// ```text
    ///  kIOReturnSuccess
    /// ```
    ///
    /// </code>
    /// otherwise.
    ///
    /// # Safety
    ///
    /// - `the_property` might not allow `None`.
    /// - `the_value` should be of the correct type.
    /// - `the_value` might not allow `None`.
    pub fn IOPMAssertionSetProperty(
        the_assertion: IOPMAssertionID,
        the_property: Option<&CFString>,
        the_value: Option<&CFType>,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// Returns a dictionary listing all assertions, grouped by their owning process.
    ///
    ///
    /// Notes: One process may have multiple assertions. Several processes may
    /// have asserted the same assertion to different levels.
    ///
    ///
    /// Parameter `AssertionsByPID`: On success, this returns a dictionary of assertions per process.
    /// At the top level, keys to the CFDictionary are pids stored as CFNumbers (kCFNumberIntType).
    /// The value associated with each CFNumber pid is a CFArray of active assertions.
    /// Each entry in the CFArray is an assertion represented as a CFDictionary. See the keys
    /// kIOPMAssertionTypeKey and kIOPMAssertionLevelKey.
    /// Caller must CFRelease() this dictionary when done.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success.
    ///
    /// # Safety
    ///
    /// `assertions_by_pid` must be a valid pointer.
    pub fn IOPMCopyAssertionsByProcess(assertions_by_pid: *mut *const CFDictionary) -> IOReturn;
}

extern "C-unwind" {
    /// Returns a list of available assertions and their system-wide levels.
    ///
    ///
    /// The system-wide level is the maximum of all individual assertions' levels.
    ///
    ///
    /// Parameter `AssertionsStatus`: On success, this returns a CFDictionary of all assertions currently available.
    /// The keys in the dictionary are the assertion types, and the value of each is a CFNumber that
    /// represents the aggregate level for that assertion.  Caller must CFRelease() this dictionary when done.
    ///
    ///
    /// Returns: Returns      kIOReturnSuccess on success.
    ///
    /// # Safety
    ///
    /// `assertions_status` must be a valid pointer.
    pub fn IOPMCopyAssertionsStatus(assertions_status: *mut *const CFDictionary) -> IOReturn;
}

extern "C-unwind" {
    /// This is a deprecated call to create a power assertion.
    ///
    ///
    /// ```text
    ///  IOPMAssertionCreateWithProperties
    /// ```
    ///
    /// </code>
    /// .
    /// Please use that version of this API instead.
    ///
    ///
    /// No special privileges necessary to make this call - any process may
    /// activate a power assertion.
    ///
    ///
    /// Parameter `AssertionType`: The CFString assertion type to request from the PM system.
    ///
    /// Parameter `AssertionLevel`: Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.
    ///
    /// Parameter `AssertionID`: On success, a unique id will be returned in this parameter.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_type` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    #[deprecated]
    pub fn IOPMAssertionCreate(
        assertion_type: Option<&CFString>,
        assertion_level: IOPMAssertionLevel,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

extern "C-unwind" {
    /// The simplest API to create a power assertion.
    ///
    ///
    /// No special privileges are necessary to make this call - any process may
    /// activate a power assertion. Caller must specify an AssertionName - NULL is not
    /// a valid input.
    ///
    ///
    /// Parameter `AssertionType`: The CFString assertion type to request from the PM system.
    ///
    /// Parameter `AssertionLevel`: Pass kIOPMAssertionLevelOn or kIOPMAssertionLevelOff.
    ///
    /// Parameter `AssertionName`: A string that describes the name of the caller and the activity being
    /// handled by this assertion (e.g. "Mail Compacting Mailboxes"). Name may be no longer
    /// than 128 characters.
    ///
    ///
    /// Parameter `AssertionID`: On success, a unique id will be returned in this parameter.
    ///
    ///
    /// Returns: Returns kIOReturnSuccess on success, any other return indicates
    /// PM could not successfully activate the specified assertion.
    ///
    /// # Safety
    ///
    /// - `assertion_type` might not allow `None`.
    /// - `assertion_name` might not allow `None`.
    /// - `assertion_id` must be a valid pointer.
    pub fn IOPMAssertionCreateWithName(
        assertion_type: Option<&CFString>,
        assertion_level: IOPMAssertionLevel,
        assertion_name: Option<&CFString>,
        assertion_id: *mut IOPMAssertionID,
    ) -> IOReturn;
}

/// Return type for IOGetSystemLoadAdvisory
///
/// Value is one of kIOSystemLoadAdvisoryLevelGreat, kIOSystemLoadAdvisoryLevelOK,
/// or kIOSystemLoadAdvisoryLevelBad.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/iokit/iosystemloadadvisorylevel?language=objc)
pub type IOSystemLoadAdvisoryLevel = c_int;

/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelbad?language=objc)
pub const kIOSystemLoadAdvisoryLevelBad: c_uint = 1;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelok?language=objc)
pub const kIOSystemLoadAdvisoryLevelOK: c_uint = 2;
/// [Apple's documentation](https://developer.apple.com/documentation/iokit/kiosystemloadadvisorylevelgreat?language=objc)
pub const kIOSystemLoadAdvisoryLevelGreat: c_uint = 3;

/// Returns a hint about whether now would be a good time to perform time-insensitive
/// work.
///
/// Based on user and system load, IOGetSystemLoadAdvisory determines "better" and "worse"
/// times to run optional or time-insensitive CPU or disk work.
///
/// Applications may use this result to avoid degrading the user experience. If it is a
/// "Bad" or "OK" time to perform work, applications should slow down and perform work
/// less aggressively.
///
/// There is no guarantee that the system will ever be in "Great" condition to perform work -
/// all essential work must still be performed even in "Bad", or "OK" times.
/// Completely optional work, such as updating caches, may be postponed indefinitely.
///
/// Note: You may more efficiently read the SystemLoadAdvisory level using notify_get_state() instead
/// of IOGetSystemLoadAdvisory. The results are identical. notify_get_state() requires that you
/// pass the token argument received by registering for SystemLoadAdvisory notifications.
///
///
/// Returns: IOSystemLoadAdvisoryLevel - one of:
/// <ul>
/// <li>
/// kIOSystemLoadAdvisoryLevelGreat - A Good time to perform time-insensitive work.
/// <li>
/// kIOSystemLoadAdvisoryLevelOK - An OK time to perform time-insensitive work.
/// <li>
/// kIOSystemLoadAdvisoryLevelBad - A Bad time to perform time-insensitive work.
/// </ul>
#[inline]
pub extern "C-unwind" fn IOGetSystemLoadAdvisory() -> IOSystemLoadAdvisoryLevel {
    extern "C-unwind" {
        fn IOGetSystemLoadAdvisory() -> IOSystemLoadAdvisoryLevel;
    }
    unsafe { IOGetSystemLoadAdvisory() }
}

/// Indicates how user activity, battery level, and thermal level each
/// contribute to the overall "SystemLoadAdvisory" level. In the future,
/// this combined level may represent new levels as well.
///
/// See dictionary keys defined above.
///
/// Returns: Returns a CFDictionaryRef, or NULL on error. Caller must release the
/// returned dictionary.
#[inline]
pub extern "C-unwind" fn IOCopySystemLoadAdvisoryDetailed() -> Option<CFRetained<CFDictionary>> {
    extern "C-unwind" {
        fn IOCopySystemLoadAdvisoryDetailed() -> Option<NonNull<CFDictionary>>;
    }
    let ret = unsafe { IOCopySystemLoadAdvisoryDetailed() };
    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}

extern "C-unwind" {
    /// Copy status of all current CPU power levels.
    ///
    /// The returned dictionary may define some of these keys,
    /// as defined in IOPM.h:
    /// <ul>
    /// <li>
    /// kIOPMCPUPowerLimitProcessorSpeedKey
    /// <li>
    /// kIOPMCPUPowerLimitProcessorCountKey
    /// <li>
    /// kIOPMCPUPowerLimitSchedulerTimeKey
    /// </ul>
    ///
    /// Parameter `cpuPowerStatus`: Upon success, a pointer to a dictionary defining CPU power;
    /// otherwise NULL. Pointer will be populated with a newly created dictionary
    /// upon successful return. Caller must release dictionary.
    ///
    /// Returns: kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if
    /// CPU PowerStatus has not been published.
    ///
    /// # Safety
    ///
    /// `cpu_power_status` must be a valid pointer.
    pub fn IOPMCopyCPUPowerStatus(cpu_power_status: *mut *const CFDictionary) -> IOReturn;
}

extern "C-unwind" {
    /// Get thermal warning level of the system.
    ///
    /// Returns: An integer pointer declaring the power warning level of the system.
    /// The value of the integer is one of (defined in IOPM.h):
    /// <ul>
    /// <li>
    /// kIOPMThermalWarningLevelNormal
    /// <li>
    /// kIOPMThermalWarningLevelDanger
    /// <li>
    /// kIOPMThermalWarningLevelCrisis
    /// </ul>
    /// Upon success the thermal level value will be found at the
    /// pointer argument.
    ///
    /// Returns: kIOReturnSuccess, or other error report. Returns kIOReturnNotFound if
    /// thermal warning level has not been published.
    ///
    /// # Safety
    ///
    /// `thermal_level` must be a valid pointer.
    pub fn IOPMGetThermalWarningLevel(thermal_level: *mut u32) -> IOReturn;
}
