public sealed class MacOSPowerInfoThermal pressure and Low Power Mode, from NSProcessInfo.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
This is where ThermalState came from. The four levels in that enum are NSProcessInfoThermalState's, chosen because Apple's are the ones with a published meaning and Android's map onto them — so here the conversion is a cast, and the only platform where the vocabulary is native is the one it was borrowed from.
The battery stays with the portable implementation. SDL reads it through IOKit's power sources, which is the same place a second implementation here would read it from, and doing that from managed code means Core Foundation dictionaries — a retain/release discipline over a type system this assembly otherwise does not touch. There is nothing to gain.
Polled, not observed. macOS posts NSProcessInfoThermalStateDidChangeNotification, and observing it means registering an Objective-C object with the notification centre — a class created at runtime, with method implementations that are managed function pointers. A property read is two message sends and a frame has budget for that; a runtime-created class is a great deal of machinery for a value that changes every few minutes.
Fields and properties (5)
public PowerSource SourceWhat the portable implementation reports.
public float? BatteryLevelWhat the portable implementation reports.
public TimeSpan? EstimatedTimeRemainingWhat the portable implementation reports.
public ThermalState ThermalHow hot the device is.
public bool IsLowPowerModeWhether the user has asked the OS to save power.
Methods (1)
public MacOSPowerInfo(IPowerInfo fallback)Thermal pressure and Low Power Mode, from NSProcessInfo.
Used by (2)
- MacOSPlatformSupplementVixen.Platform.MacOS
- MacOSSupplementTestsVixen.Platform.MacOS.Tests