Yes, more than 4 years have passed since this question was asked ... It is unclear in which language the code is needed. Using Objective-C.
Energy saving settings are located in:
/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
In the Mac application, we can now use:
NSString *powerMgt = @"/Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist"; NSDictionary *power = [NSDictionary dictionaryWithContentsOfFile:powerMgt]; // for example the sleep time on AC power NSNumber *sleepyTime = [[[power objectForKey:@"Custom Profile"] objectForKey:@"AC Power"] objectForKey:@"System Sleep Timer"];
with a dictionary similar to:
{ ActivePowerProfiles = { "AC Power" = "-1"; "Battery Power" = "-1"; }; "Custom Profile" = { "AC Power" = { "Disk Sleep Timer" = 10; "Display Sleep Timer" = 10; "Display Sleep Uses Dim" = 1; GPUSwitch = 2; "Hibernate File" = "/var/vm/sleepimage"; "Hibernate Mode" = 3; "Mobile Motion Module" = 1; PrioritizeNetworkReachabilityOverSleep = 0; "Standby Delay" = 4200; "Standby Enabled" = 0; "System Sleep Timer" = 0; TTYSPreventSleep = 1; "Wake On AC Change" = 0; "Wake On Clamshell Open" = 1; "Wake On LAN" = 1; }; "Battery Power" = { "Disk Sleep Timer" = 10; "Display Sleep Timer" = 10; "Display Sleep Uses Dim" = 1; GPUSwitch = 2; "Hibernate File" = "/var/vm/sleepimage"; "Hibernate Mode" = 3; "Mobile Motion Module" = 1; ReduceBrightness = 1; "Standby Delay" = 4200; "Standby Enabled" = 0; "System Sleep Timer" = 15; TTYSPreventSleep = 1; "Wake On AC Change" = 0; "Wake On Clamshell Open" = 1; }; }; }
David source share