Power.pas 49 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438
  1. {
  2. File: Power.p
  3. Contains: Power Manager Interfaces.
  4. Version: Technology: Mac OS 9
  5. Release: Universal Interfaces 3.4.2
  6. Copyright: © 1990-2002 by Apple Computer, Inc. All rights reserved
  7. Bugs?: For bug reports, consult the following page on
  8. the World Wide Web:
  9. http://www.freepascal.org/bugs.html
  10. }
  11. {
  12. Modified for use with Free Pascal
  13. Version 200
  14. Please report any bugs to <[email protected]>
  15. }
  16. {$mode macpas}
  17. {$packenum 1}
  18. {$macro on}
  19. {$inline on}
  20. {$CALLING MWPASCAL}
  21. unit Power;
  22. interface
  23. {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
  24. {$setc GAP_INTERFACES_VERSION := $0200}
  25. {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
  26. {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
  27. {$endc}
  28. {$ifc defined CPUPOWERPC and defined CPUI386}
  29. {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
  30. {$endc}
  31. {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
  32. {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
  33. {$endc}
  34. {$ifc not defined __ppc__ and defined CPUPOWERPC}
  35. {$setc __ppc__ := 1}
  36. {$elsec}
  37. {$setc __ppc__ := 0}
  38. {$endc}
  39. {$ifc not defined __i386__ and defined CPUI386}
  40. {$setc __i386__ := 1}
  41. {$elsec}
  42. {$setc __i386__ := 0}
  43. {$endc}
  44. {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
  45. {$error Conflicting definitions for __ppc__ and __i386__}
  46. {$endc}
  47. {$ifc defined __ppc__ and __ppc__}
  48. {$setc TARGET_CPU_PPC := TRUE}
  49. {$setc TARGET_CPU_X86 := FALSE}
  50. {$elifc defined __i386__ and __i386__}
  51. {$setc TARGET_CPU_PPC := FALSE}
  52. {$setc TARGET_CPU_X86 := TRUE}
  53. {$elsec}
  54. {$error Neither __ppc__ nor __i386__ is defined.}
  55. {$endc}
  56. {$setc TARGET_CPU_PPC_64 := FALSE}
  57. {$ifc defined FPC_BIG_ENDIAN}
  58. {$setc TARGET_RT_BIG_ENDIAN := TRUE}
  59. {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
  60. {$elifc defined FPC_LITTLE_ENDIAN}
  61. {$setc TARGET_RT_BIG_ENDIAN := FALSE}
  62. {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
  63. {$elsec}
  64. {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
  65. {$endc}
  66. {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
  67. {$setc CALL_NOT_IN_CARBON := FALSE}
  68. {$setc OLDROUTINENAMES := FALSE}
  69. {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
  70. {$setc OPAQUE_UPP_TYPES := TRUE}
  71. {$setc OTCARBONAPPLICATION := TRUE}
  72. {$setc OTKERNEL := FALSE}
  73. {$setc PM_USE_SESSION_APIS := TRUE}
  74. {$setc TARGET_API_MAC_CARBON := TRUE}
  75. {$setc TARGET_API_MAC_OS8 := FALSE}
  76. {$setc TARGET_API_MAC_OSX := TRUE}
  77. {$setc TARGET_CARBON := TRUE}
  78. {$setc TARGET_CPU_68K := FALSE}
  79. {$setc TARGET_CPU_MIPS := FALSE}
  80. {$setc TARGET_CPU_SPARC := FALSE}
  81. {$setc TARGET_OS_MAC := TRUE}
  82. {$setc TARGET_OS_UNIX := FALSE}
  83. {$setc TARGET_OS_WIN32 := FALSE}
  84. {$setc TARGET_RT_MAC_68881 := FALSE}
  85. {$setc TARGET_RT_MAC_CFM := FALSE}
  86. {$setc TARGET_RT_MAC_MACHO := TRUE}
  87. {$setc TYPED_FUNCTION_POINTERS := TRUE}
  88. {$setc TYPE_BOOL := FALSE}
  89. {$setc TYPE_EXTENDED := FALSE}
  90. {$setc TYPE_LONGLONG := TRUE}
  91. uses MacTypes,MixedMode,Multiprocessing,NameRegistry,MacErrors;
  92. {$ALIGN MAC68K}
  93. const
  94. { Bit positions for ModemByte }
  95. modemOnBit = 0;
  96. ringWakeUpBit = 2;
  97. modemInstalledBit = 3;
  98. ringDetectBit = 4;
  99. modemOnHookBit = 5;
  100. { masks for ModemByte }
  101. modemOnMask = $01;
  102. ringWakeUpMask = $04;
  103. modemInstalledMask = $08;
  104. ringDetectMask = $10;
  105. modemOnHookMask = $20;
  106. { bit positions for BatteryByte }
  107. chargerConnBit = 0;
  108. hiChargeBit = 1;
  109. chargeOverFlowBit = 2;
  110. batteryDeadBit = 3;
  111. batteryLowBit = 4;
  112. connChangedBit = 5;
  113. { masks for BatteryByte }
  114. chargerConnMask = $01;
  115. hiChargeMask = $02;
  116. chargeOverFlowMask = $04;
  117. batteryDeadMask = $08;
  118. batteryLowMask = $10;
  119. connChangedMask = $20;
  120. { bit positions for SoundMixerByte }
  121. MediaBaySndEnBit = 0;
  122. PCISndEnBit = 1;
  123. ZVSndEnBit = 2;
  124. PCCardSndEnBit = 3;
  125. { masks for SoundMixerByte }
  126. MediaBaySndEnMask = $01;
  127. PCISndEnMask = $02;
  128. ZVSndEnMask = $04;
  129. PCCardSndEnMask = $08;
  130. { commands to SleepQRec sleepQProc }
  131. kSleepRequest = 1;
  132. kSleepDemand = 2;
  133. kSleepWakeUp = 3;
  134. kSleepRevoke = 4;
  135. kSleepUnlock = 4;
  136. kSleepDeny = 5; { A non-zero value clients can use to deny requests }
  137. kSleepNow = 6;
  138. kDozeDemand = 7;
  139. kDozeWakeUp = 8;
  140. kDozeRequest = 9; { additional messages for Power Mgr 2.0 }
  141. kEnterStandby = 10; { Idle Queue Only }
  142. kEnterRun = 11; { Idle Queue Only }
  143. kSuspendRequest = 12;
  144. kSuspendDemand = 13;
  145. kSuspendRevoke = 14;
  146. kSuspendWakeUp = 15;
  147. kGetPowerLevel = 16;
  148. kSetPowerLevel = 17;
  149. kDeviceInitiatedWake = 18;
  150. kWakeToDoze = 19;
  151. kDozeToFullWakeUp = 20;
  152. kGetPowerInfo = 21;
  153. kGetWakeOnNetInfo = 22;
  154. kSuspendWakeToDoze = 23;
  155. kEnterIdle = 24; { Idle Queue Only }
  156. kStillIdle = 25; { Idle Queue Only }
  157. kExitIdle = 26; { Idle Queue Only }
  158. { depreciated commands to SleepQRec sleepQProc }
  159. sleepRequest = 1;
  160. sleepDemand = 2;
  161. sleepWakeUp = 3;
  162. sleepRevoke = 4;
  163. sleepUnlock = 4;
  164. sleepDeny = 5;
  165. sleepNow = 6;
  166. dozeDemand = 7;
  167. dozeWakeUp = 8;
  168. dozeRequest = 9;
  169. enterStandby = 10;
  170. enterRun = 11;
  171. suspendRequestMsg = 12;
  172. suspendDemandMsg = 13;
  173. suspendRevokeMsg = 14;
  174. suspendWakeUpMsg = 15;
  175. getPowerLevel = 16;
  176. setPowerLevel = 17;
  177. { Power Handler func messages }
  178. type
  179. PowerLevel = UInt32;
  180. { Power levels corresponding to PCI Bus Power Management Interface Spec (PMIS) }
  181. const
  182. kPMDevicePowerLevel_On = 0; { fully-powered 'On' state (D0 state) }
  183. kPMDevicePowerLevel_D1 = 1; { not used by Apple system SW }
  184. kPMDevicePowerLevel_D2 = 2; { not used by Apple system SW }
  185. kPMDevicePowerLevel_Off = 3; { main PCI bus power 'Off', but PCI standby power available (D3cold state) }
  186. { PowerHandlerProc definition }
  187. type
  188. {$ifc TYPED_FUNCTION_POINTERS}
  189. PowerHandlerProcPtr = function(message: UInt32; param: UnivPtr; refCon: UInt32; var regEntryID_: RegEntryID): OSStatus;
  190. {$elsec}
  191. PowerHandlerProcPtr = ProcPtr;
  192. {$endc}
  193. {$ifc OPAQUE_UPP_TYPES}
  194. PowerHandlerUPP = ^SInt32; { an opaque UPP }
  195. {$elsec}
  196. PowerHandlerUPP = UniversalProcPtr;
  197. {$endc}
  198. const
  199. uppPowerHandlerProcInfo = $00003FF0;
  200. {$ifc CALL_NOT_IN_CARBON}
  201. {
  202. * NewPowerHandlerUPP()
  203. *
  204. * Availability:
  205. * Non-Carbon CFM: available as macro/inline
  206. * CarbonLib: not available
  207. * Mac OS X: not available
  208. }
  209. function NewPowerHandlerUPP(userRoutine: PowerHandlerProcPtr): PowerHandlerUPP; external name '_NewPowerHandlerUPP'; { old name was NewPowerHandlerProc }
  210. {
  211. * DisposePowerHandlerUPP()
  212. *
  213. * Availability:
  214. * Non-Carbon CFM: available as macro/inline
  215. * CarbonLib: not available
  216. * Mac OS X: not available
  217. }
  218. procedure DisposePowerHandlerUPP(userUPP: PowerHandlerUPP); external name '_DisposePowerHandlerUPP';
  219. {
  220. * InvokePowerHandlerUPP()
  221. *
  222. * Availability:
  223. * Non-Carbon CFM: available as macro/inline
  224. * CarbonLib: not available
  225. * Mac OS X: not available
  226. }
  227. function InvokePowerHandlerUPP(message: UInt32; param: UnivPtr; refCon: UInt32; var regEntryID_: RegEntryID; userRoutine: PowerHandlerUPP): OSStatus; external name '_InvokePowerHandlerUPP'; { old name was CallPowerHandlerProc }
  228. {$endc} {CALL_NOT_IN_CARBON}
  229. {
  230. Use kIdleQueueDeviceType as the deviceType argument to AddDevicePowerHandler() to get the
  231. handler into the idle queue instead of the device sleep queue.
  232. }
  233. { PCI power management support }
  234. const
  235. kUseDefaultMinimumWakeTime = 0; { Defaults to 5 minutes }
  236. kPowerSummaryVersion = 1; { Version of PowerSummary structure. }
  237. kDevicePowerInfoVersion = 1; { Version of DevicePowerInfo structure. }
  238. { PowerSummary flags }
  239. kPCIPowerOffAllowed = $00000001; { PCI power off is allowed. }
  240. { DevicePowerInfo flags }
  241. kDevicePCIPowerOffAllowed = $00000001; { PCI power off is allowed for device. }
  242. kDeviceSupportsPMIS = $00000002; { Device supports Power Mgt Interface Spec. }
  243. kDeviceCanAssertPMEDuringSleep = $00000004; { Device can assert PME# during sleep. }
  244. kDeviceUsesCommonLogicPower = $00000008; { Device uses common-logic power }
  245. kDeviceDriverPresent = $00000010; { Driver present for device. }
  246. kDeviceDriverSupportsPowerMgt = $00000020; { Driver installed a power handler. }
  247. type
  248. DevicePowerInfoPtr = ^DevicePowerInfo;
  249. DevicePowerInfo = record
  250. version: UInt32; { Version of this structure. }
  251. regID: RegEntryID; { RegEntryID for device. }
  252. flags: OptionBits; { Flags }
  253. minimumWakeTime: UInt32; { Minimum seconds before sleeping again. }
  254. sleepPowerNeeded: UInt32; { Milliwatts needed in the sleep state. }
  255. end;
  256. PowerSummaryPtr = ^PowerSummary;
  257. PowerSummary = record
  258. version: UInt32; { Version of this structure. }
  259. flags: OptionBits; { Flags }
  260. sleepPowerAvailable: UInt32; { Milliwatts available during sleep. }
  261. sleepPowerNeeded: UInt32; { Milliwatts needed during sleep. }
  262. minimumWakeTime: UInt32; { Minimum seconds before sleeping again. }
  263. deviceCount: ItemCount; { Number of device power info records. }
  264. devices: array [0..0] of DevicePowerInfo; { Array of device power info records. }
  265. end;
  266. const
  267. { SleepQRec.sleepQFlags }
  268. noCalls = 1;
  269. noRequest = 2;
  270. slpQType = 16;
  271. sleepQType = 16;
  272. { Power Mgt Apple Event types and errors }
  273. { power mgt class }
  274. kAEMacPowerMgtEvt = $706D6774 (* 'pmgt' *); { event ids }
  275. kAEMacToWake = $77616B65 (* 'wake' *);
  276. kAEMacLowPowerSaveData = $706D7364 (* 'pmsd' *);
  277. kAEMacEmergencySleep = $656D736C (* 'emsl' *);
  278. kAEMacEmergencyShutdown = $656D7364 (* 'emsd' *);
  279. {
  280. These are result values returned by a Power Handler when queries
  281. by the Power Mgr if the device which that Power Handler represents
  282. woke the machine.
  283. }
  284. kDeviceDidNotWakeMachine = 0; { device did NOT wake machine }
  285. kDeviceRequestsFullWake = 1; { device did wake machine and requests full wakeup }
  286. kDeviceRequestsWakeToDoze = 2; { device did wake machine and requests partial wakeup }
  287. { bits in bitfield returned by PMFeatures }
  288. hasWakeupTimer = 0; { 1=wakeup timer is supported }
  289. hasSharedModemPort = 1; { 1=modem port shared by SCC and internal modem }
  290. hasProcessorCycling = 2; { 1=processor cycling is supported }
  291. mustProcessorCycle = 3; { 1=processor cycling should not be turned off }
  292. hasReducedSpeed = 4; { 1=processor can be started up at reduced speed }
  293. dynamicSpeedChange = 5; { 1=processor speed can be switched dynamically }
  294. hasSCSIDiskMode = 6; { 1=SCSI Disk Mode is supported }
  295. canGetBatteryTime = 7; { 1=battery time can be calculated }
  296. canWakeupOnRing = 8; { 1=can wakeup when the modem detects a ring }
  297. hasDimmingSupport = 9; { 1=has dimming support built in (DPMS standby by default) }
  298. hasStartupTimer = 10; { 1=startup timer is supported }
  299. hasChargeNotification = 11; { 1=client can determine of charge connect status change notifications available }
  300. hasDimSuspendSupport = 12; { 1=supports dimming LCD and CRT to DPMS suspend state }
  301. hasWakeOnNetActivity = 13; { 1=hardware supports wake on network activity }
  302. hasWakeOnLid = 14; { 1=hardware can wake when opened }
  303. canPowerOffPCIBus = 15; { 1=hardware can power off PCI bus during sleep if cards allow }
  304. hasDeepSleep = 16; { 1=hardware supports deep sleep (hibernation) mode }
  305. hasSleep = 17; { 1=hardware supports normal (PowerBook-like) sleep }
  306. supportsServerModeAPIs = 18; { 1=hardware supports server mode API routines }
  307. supportsUPSIntegration = 19; { 1=hardware support UPS integration and reporting }
  308. hasAggressiveIdling = 20; { 1=Power Manager only resets OverallAct on UsrActvity }
  309. supportsIdleQueue = 21; { 1=Power Manager supports the idle queue }
  310. { bits in bitfield returned by GetIntModemInfo and set by SetIntModemState }
  311. hasInternalModem = 0; { 1=internal modem installed }
  312. intModemRingDetect = 1; { 1=internal modem has detected a ring }
  313. intModemOffHook = 2; { 1=internal modem is off hook }
  314. intModemRingWakeEnb = 3; { 1=wakeup on ring is enabled }
  315. extModemSelected = 4; { 1=external modem selected }
  316. modemSetBit = 15; { 1=set bit, 0=clear bit (SetIntModemState) }
  317. { bits in BatteryInfo.flags }
  318. { ("chargerConnected" doesn't mean the charger is plugged in) }
  319. batteryInstalled = 7; { 1=battery is currently connected }
  320. batteryCharging = 6; { 1=battery is being charged }
  321. chargerConnected = 5; { 1=charger is connected to the PowerBook }
  322. upsConnected = 4; { 1=there is a UPS connected }
  323. upsIsPowerSource = 3; { 1=UPS is source of power }
  324. HDPwrQType = $4844; { 'HD' hard disk spindown queue element type }
  325. PMgrStateQType = $504D; { 'PM' Power Manager state queue element type }
  326. { client notification bits in PMgrQueueElement.pmNotifyBits }
  327. pmSleepTimeoutChanged = 0;
  328. pmSleepEnableChanged = 1;
  329. pmHardDiskTimeoutChanged = 2;
  330. pmHardDiskSpindownChanged = 3;
  331. pmDimmingTimeoutChanged = 4;
  332. pmDimmingEnableChanged = 5;
  333. pmDiskModeAddressChanged = 6;
  334. pmProcessorCyclingChanged = 7;
  335. pmProcessorSpeedChanged = 8;
  336. pmWakeupTimerChanged = 9;
  337. pmStartupTimerChanged = 10;
  338. pmHardDiskPowerRemovedbyUser = 11;
  339. pmChargeStatusChanged = 12;
  340. pmPowerLevelChanged = 13;
  341. pmWakeOnNetActivityChanged = 14;
  342. pmSleepTimeoutChangedMask = $01;
  343. pmSleepEnableChangedMask = $02;
  344. pmHardDiskTimeoutChangedMask = $04;
  345. pmHardDiskSpindownChangedMask = $08;
  346. pmDimmingTimeoutChangedMask = $10;
  347. pmDimmingEnableChangedMask = $20;
  348. pmDiskModeAddressChangedMask = $40;
  349. pmProcessorCyclingChangedMask = $80;
  350. pmProcessorSpeedChangedMask = $0100;
  351. pmWakeupTimerChangedMask = $0200;
  352. pmStartupTimerChangedMask = $0400;
  353. pmHardDiskPowerRemovedbyUserMask = $0800;
  354. pmChargeStatusChangedMask = $1000;
  355. pmPowerLevelChangedMask = $2000;
  356. pmWakeOnNetActivityChangedMask = $4000;
  357. { System Activity Selectors }
  358. { Notes: The IdleActivity selector is not available unless the hasAggressiveIdling PMFeatures bit is set. }
  359. { Use IdleActivity where you used to use OverallAct if necessary. OverallAct will only }
  360. { delay power cycling if it's enabled, and will delay sleep by a small amount when }
  361. { hasAggressiveIdling is set. Don't use IdleActivity unless hasAggressiveIdling is set; when }
  362. { hasAggressiveIdling is not set, the use of IdleActivity is undefined, and well do different }
  363. { things depending on which Power Manager is currently running. }
  364. OverallAct = 0; { Delays idle sleep by small amount }
  365. UsrActivity = 1; { Delays idle sleep and dimming by timeout time }
  366. NetActivity = 2; { Delays idle sleep and power cycling by small amount }
  367. HDActivity = 3; { Delays hard drive spindown and idle sleep by small amount }
  368. IdleActivity = 4; { Delays idle sleep by timeout time }
  369. { Storage Media sleep mode defines }
  370. kMediaModeOn = 0; { Media active (Drive spinning and at full power) }
  371. kMediaModeStandBy = 1; { Media standby (not implemented) }
  372. kMediaModeSuspend = 2; { Media Idle (not implemented) }
  373. kMediaModeOff = 3; { Media Sleep (Drive not spinning and at min power, max recovery time) }
  374. kMediaPowerCSCode = 70;
  375. { definitions for HDQueueElement.hdFlags }
  376. kHDQueuePostBit = 0; { 1 = call this routine on the second pass }
  377. kHDQueuePostMask = $01;
  378. type
  379. ActivityInfoPtr = ^ActivityInfo;
  380. ActivityInfo = record
  381. ActivityType: SInt16; { Type of activity to be fetched. Same as UpdateSystemActivity Selectors }
  382. ActivityTime: UInt32; { Time of last activity (in ticks) of specified type. }
  383. end;
  384. { information returned by GetScaledBatteryInfo }
  385. BatteryInfoPtr = ^BatteryInfo;
  386. BatteryInfo = packed record
  387. flags: UInt8; { misc flags (see below) }
  388. warningLevel: UInt8; { scaled warning level (0-255) }
  389. reserved: UInt8; { reserved for internal use }
  390. batteryLevel: UInt8; { scaled battery level (0-255) }
  391. end;
  392. ModemByte = SInt8;
  393. BatteryByte = SInt8;
  394. SoundMixerByte = SInt8;
  395. PMResultCode = SInt32;
  396. SleepQRecPtr = ^SleepQRec;
  397. HDQueueElementPtr = ^HDQueueElement;
  398. PMgrQueueElementPtr = ^PMgrQueueElement;
  399. {$ifc TYPED_FUNCTION_POINTERS}
  400. SleepQProcPtr = function(message: SInt32; qRecPtr: SleepQRecPtr): SInt32;
  401. {$elsec}
  402. SleepQProcPtr = Register68kProcPtr;
  403. {$endc}
  404. {$ifc TYPED_FUNCTION_POINTERS}
  405. HDSpindownProcPtr = procedure(theElement: HDQueueElementPtr);
  406. {$elsec}
  407. HDSpindownProcPtr = ProcPtr;
  408. {$endc}
  409. {$ifc TYPED_FUNCTION_POINTERS}
  410. PMgrStateChangeProcPtr = procedure(theElement: PMgrQueueElementPtr; stateBits: SInt32);
  411. {$elsec}
  412. PMgrStateChangeProcPtr = ProcPtr;
  413. {$endc}
  414. {$ifc OPAQUE_UPP_TYPES}
  415. SleepQUPP = ^SInt32; { an opaque UPP }
  416. {$elsec}
  417. SleepQUPP = UniversalProcPtr;
  418. {$endc}
  419. {$ifc OPAQUE_UPP_TYPES}
  420. HDSpindownUPP = ^SInt32; { an opaque UPP }
  421. {$elsec}
  422. HDSpindownUPP = UniversalProcPtr;
  423. {$endc}
  424. {$ifc OPAQUE_UPP_TYPES}
  425. PMgrStateChangeUPP = ^SInt32; { an opaque UPP }
  426. {$elsec}
  427. PMgrStateChangeUPP = UniversalProcPtr;
  428. {$endc}
  429. SleepQRec = record
  430. sleepQLink: SleepQRecPtr; { pointer to next queue element }
  431. sleepQType: SInt16; { queue element type (must be SleepQType) }
  432. sleepQProc: SleepQUPP; { pointer to sleep universal proc ptr }
  433. sleepQFlags: SInt16; { flags }
  434. end;
  435. HDQueueElement = record
  436. hdQLink: HDQueueElementPtr; { pointer to next queue element }
  437. hdQType: SInt16; { queue element type (must be HDPwrQType) }
  438. hdFlags: SInt16; { miscellaneous flags }
  439. hdProc: HDSpindownUPP; { pointer to routine to call }
  440. hdUser: SInt32; { user-defined (variable storage, etc.) }
  441. end;
  442. PMgrQueueElement = record
  443. pmQLink: PMgrQueueElementPtr; { pointer to next queue element }
  444. pmQType: SInt16; { queue element type (must be PMgrStateQType) }
  445. pmFlags: SInt16; { miscellaneous flags }
  446. pmNotifyBits: SInt32; { bitmap of which changes to be notified for }
  447. pmProc: PMgrStateChangeUPP; { pointer to routine to call }
  448. pmUser: SInt32; { user-defined (variable storage, etc.) }
  449. end;
  450. BatteryTimeRecPtr = ^BatteryTimeRec;
  451. BatteryTimeRec = record
  452. expectedBatteryTime: UInt32; { estimated battery time remaining (seconds) }
  453. minimumBatteryTime: UInt32; { minimum battery time remaining (seconds) }
  454. maximumBatteryTime: UInt32; { maximum battery time remaining (seconds) }
  455. timeUntilCharged: UInt32; { time until battery is fully charged (seconds) }
  456. end;
  457. WakeupTimePtr = ^WakeupTime;
  458. WakeupTime = record
  459. wakeTime: UInt32; { wakeup time (same format as current time) }
  460. wakeEnabled: boolean; { 1=enable wakeup timer, 0=disable wakeup timer }
  461. filler: SInt8;
  462. end;
  463. StartupTimePtr = ^StartupTime;
  464. StartupTime = record
  465. startTime: UInt32; { startup time (same format as current time) }
  466. startEnabled: boolean; { 1=enable startup timer, 0=disable startup timer }
  467. filler: SInt8;
  468. end;
  469. { PowerSource version }
  470. const
  471. kVersionOnePowerSource = 1;
  472. kVersionTwoPowerSource = 2;
  473. kCurrentPowerSourceVersion = 2;
  474. { PowerSourceAttrs bits }
  475. bSourceIsBattery = 0; { power source is battery }
  476. bSourceIsAC = 1; { power source is AC }
  477. bSourceCanBeCharged = 2; { power source can be charged }
  478. bSourceIsUPS = 3; { power source is UPS. NOTE: software should set bSourceIsBattery and bSourceIsAC also, as appropriate }
  479. bSourceProvidesWarnLevels = 4; { power source provides low power and dead battery warning levels }
  480. kSourceIsBatteryMask = $01;
  481. kSourceIsACMask = $02;
  482. kSourceCanBeChargedMask = $04;
  483. kSourceIsUPSMask = $08;
  484. kSourceProvidesWarnLevelsMask = $10;
  485. { PowerSourceFlags bits }
  486. bSourceIsAvailable = 0; { power source is installed }
  487. bSourceIsCharging = 1; { power source being charged }
  488. bChargerIsAttached = 2; { a charger is connected }
  489. kSourceIsAvailableMask = $01;
  490. kSourceIsChargingMask = $02;
  491. kChargerIsAttachedMask = $04;
  492. { Power Capacity Types }
  493. kCapacityIsActual = 0; { current capacity is expessed as actual capacity in same units as max }
  494. kCapacityIsPercentOfMax = 1; { current capacity is expressed as a percentage of maximumCapacity }
  495. { Net Activity Wake Options }
  496. kConfigSupportsWakeOnNetBit = 0;
  497. kWakeOnNetAdminAccessesBit = 1;
  498. kWakeOnAllNetAccessesBit = 2;
  499. kUnmountServersBeforeSleepingBit = 3;
  500. kConfigSupportsWakeOnNetMask = $01;
  501. kWakeOnNetAdminAccessesMask = $02;
  502. kWakeOnAllNetAccessesMask = $04;
  503. kUnmountServersBeforeSleepingMask = $08;
  504. { Power Source capacity usage types }
  505. kCurrentCapacityIsActualValue = 0; { currentCapacity is a real value in same units as maxCapacity }
  506. kCurrentCapacityIsPercentOfMax = 1; { currentCapacity is expressed as a percentage of maxCapacity. }
  507. type
  508. PowerSourceID = SInt16;
  509. PowerSourceParamBlockPtr = ^PowerSourceParamBlock;
  510. PowerSourceParamBlock = record
  511. sourceID: PowerSourceID; { unique id assigned by Power Mgr }
  512. sourceCapacityUsage: UInt16; { how currentCapacity is used }
  513. sourceVersion: UInt32; { version of this record }
  514. sourceAttr: OptionBits; { attribute flags (see below) }
  515. sourceState: OptionBits; { state flags (see below) }
  516. currentCapacity: UInt32; { current capacity, in }
  517. { milliwatts or % }
  518. maxCapacity: UInt32; { full capacity, in milliwatts }
  519. timeRemaining: UInt32; { time left to deplete, }
  520. { in milliwatt-hours }
  521. timeToFullCharge: UInt32; { time to charge, }
  522. { in milliwatt-hours }
  523. voltage: UInt32; { voltage in millivolts }
  524. current: SInt32; { current in milliamperes }
  525. { (negative if consuming, }
  526. { positive if charging) }
  527. lowWarnLevel: UInt32; { low warning level in milliwatts (or % if sourceCapacityUsage is %) }
  528. deadWarnLevel: UInt32; { dead warning level in milliwatts (or % if sourceCapacityUsage is %) }
  529. reserved: array [0..15] of UInt32; { for future expansion }
  530. end;
  531. {
  532. * DisableWUTime()
  533. *
  534. * Availability:
  535. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  536. * CarbonLib: in CarbonLib 1.0 and later
  537. * Mac OS X: in version 10.0 and later
  538. }
  539. function DisableWUTime: OSErr; external name '_DisableWUTime';
  540. {
  541. * SetWUTime()
  542. *
  543. * Availability:
  544. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  545. * CarbonLib: in CarbonLib 1.0 and later
  546. * Mac OS X: in version 10.0 and later
  547. }
  548. function SetWUTime(wuTime: SInt32): OSErr; external name '_SetWUTime';
  549. {$ifc CALL_NOT_IN_CARBON}
  550. {
  551. * GetWUTime()
  552. *
  553. * Availability:
  554. * Non-Carbon CFM: not available
  555. * CarbonLib: not available
  556. * Mac OS X: not available
  557. }
  558. function GetWUTime(var wuTime: SInt32; var wuFlag: SignedByte): OSErr; external name '_GetWUTime';
  559. {
  560. * BatteryStatus()
  561. *
  562. * Availability:
  563. * Non-Carbon CFM: not available
  564. * CarbonLib: not available
  565. * Mac OS X: not available
  566. }
  567. function BatteryStatus(var status: SignedByte; var power: SignedByte): OSErr; external name '_BatteryStatus';
  568. {
  569. * ModemStatus()
  570. *
  571. * Availability:
  572. * Non-Carbon CFM: not available
  573. * CarbonLib: not available
  574. * Mac OS X: not available
  575. }
  576. function ModemStatus(var status: SignedByte): OSErr; external name '_ModemStatus';
  577. {$endc} {CALL_NOT_IN_CARBON}
  578. {
  579. * IdleUpdate()
  580. *
  581. * Availability:
  582. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  583. * CarbonLib: in CarbonLib 1.0 and later
  584. * Mac OS X: in version 10.0 and later
  585. }
  586. function IdleUpdate: SInt32; external name '_IdleUpdate';
  587. {
  588. * GetCPUSpeed()
  589. *
  590. * Availability:
  591. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  592. * CarbonLib: in CarbonLib 1.0 and later
  593. * Mac OS X: in version 10.0 and later
  594. }
  595. function GetCPUSpeed: SInt32; external name '_GetCPUSpeed';
  596. {
  597. * EnableIdle()
  598. *
  599. * Availability:
  600. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  601. * CarbonLib: in CarbonLib 1.0 and later
  602. * Mac OS X: in version 10.0 and later
  603. }
  604. procedure EnableIdle; external name '_EnableIdle';
  605. {
  606. * DisableIdle()
  607. *
  608. * Availability:
  609. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  610. * CarbonLib: in CarbonLib 1.0 and later
  611. * Mac OS X: in version 10.0 and later
  612. }
  613. procedure DisableIdle; external name '_DisableIdle';
  614. {
  615. * SleepQInstall()
  616. *
  617. * Availability:
  618. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  619. * CarbonLib: in CarbonLib 1.0 and later
  620. * Mac OS X: in version 10.0 and later
  621. }
  622. procedure SleepQInstall(qRecPtr: SleepQRecPtr); external name '_SleepQInstall';
  623. {
  624. * SleepQRemove()
  625. *
  626. * Availability:
  627. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  628. * CarbonLib: in CarbonLib 1.0 and later
  629. * Mac OS X: in version 10.0 and later
  630. }
  631. procedure SleepQRemove(qRecPtr: SleepQRecPtr); external name '_SleepQRemove';
  632. {
  633. * AOn()
  634. *
  635. * Availability:
  636. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  637. * CarbonLib: in CarbonLib 1.0 and later
  638. * Mac OS X: in version 10.0 and later
  639. }
  640. procedure AOn; external name '_AOn';
  641. {
  642. * AOnIgnoreModem()
  643. *
  644. * Availability:
  645. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  646. * CarbonLib: in CarbonLib 1.0 and later
  647. * Mac OS X: in version 10.0 and later
  648. }
  649. procedure AOnIgnoreModem; external name '_AOnIgnoreModem';
  650. {
  651. * BOn()
  652. *
  653. * Availability:
  654. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  655. * CarbonLib: in CarbonLib 1.0 and later
  656. * Mac OS X: in version 10.0 and later
  657. }
  658. procedure BOn; external name '_BOn';
  659. {
  660. * AOff()
  661. *
  662. * Availability:
  663. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  664. * CarbonLib: in CarbonLib 1.0 and later
  665. * Mac OS X: in version 10.0 and later
  666. }
  667. procedure AOff; external name '_AOff';
  668. {
  669. * BOff()
  670. *
  671. * Availability:
  672. * Non-Carbon CFM: in InterfaceLib 7.1 and later
  673. * CarbonLib: in CarbonLib 1.0 and later
  674. * Mac OS X: in version 10.0 and later
  675. }
  676. procedure BOff; external name '_BOff';
  677. { Public Power Management API }
  678. {
  679. * PMSelectorCount()
  680. *
  681. * Availability:
  682. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  683. * CarbonLib: in CarbonLib 1.0 and later
  684. * Mac OS X: in version 10.0 and later
  685. }
  686. function PMSelectorCount: SInt16; external name '_PMSelectorCount';
  687. {
  688. * PMFeatures()
  689. *
  690. * Availability:
  691. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  692. * CarbonLib: in CarbonLib 1.0 and later
  693. * Mac OS X: in version 10.0 and later
  694. }
  695. function PMFeatures: UInt32; external name '_PMFeatures';
  696. {
  697. * GetSleepTimeout()
  698. *
  699. * Availability:
  700. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  701. * CarbonLib: in CarbonLib 1.0 and later
  702. * Mac OS X: in version 10.0 and later
  703. }
  704. function GetSleepTimeout: ByteParameter; external name '_GetSleepTimeout';
  705. {
  706. * SetSleepTimeout()
  707. *
  708. * Availability:
  709. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  710. * CarbonLib: in CarbonLib 1.0 and later
  711. * Mac OS X: in version 10.0 and later
  712. }
  713. procedure SetSleepTimeout(timeout: ByteParameter); external name '_SetSleepTimeout';
  714. {
  715. * GetHardDiskTimeout()
  716. *
  717. * Availability:
  718. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  719. * CarbonLib: in CarbonLib 1.0 and later
  720. * Mac OS X: in version 10.0 and later
  721. }
  722. function GetHardDiskTimeout: ByteParameter; external name '_GetHardDiskTimeout';
  723. {
  724. * SetHardDiskTimeout()
  725. *
  726. * Availability:
  727. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  728. * CarbonLib: in CarbonLib 1.0 and later
  729. * Mac OS X: in version 10.0 and later
  730. }
  731. procedure SetHardDiskTimeout(timeout: ByteParameter); external name '_SetHardDiskTimeout';
  732. {
  733. * HardDiskPowered()
  734. *
  735. * Availability:
  736. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  737. * CarbonLib: in CarbonLib 1.0 and later
  738. * Mac OS X: in version 10.0 and later
  739. }
  740. function HardDiskPowered: boolean; external name '_HardDiskPowered';
  741. {
  742. * SpinDownHardDisk()
  743. *
  744. * Availability:
  745. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  746. * CarbonLib: in CarbonLib 1.0 and later
  747. * Mac OS X: in version 10.0 and later
  748. }
  749. procedure SpinDownHardDisk; external name '_SpinDownHardDisk';
  750. {
  751. * IsSpindownDisabled()
  752. *
  753. * Availability:
  754. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  755. * CarbonLib: in CarbonLib 1.0 and later
  756. * Mac OS X: in version 10.0 and later
  757. }
  758. function IsSpindownDisabled: boolean; external name '_IsSpindownDisabled';
  759. {
  760. * SetSpindownDisable()
  761. *
  762. * Availability:
  763. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  764. * CarbonLib: in CarbonLib 1.0 and later
  765. * Mac OS X: in version 10.0 and later
  766. }
  767. procedure SetSpindownDisable(setDisable: boolean); external name '_SetSpindownDisable';
  768. {
  769. * HardDiskQInstall()
  770. *
  771. * Availability:
  772. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  773. * CarbonLib: in CarbonLib 1.0 and later
  774. * Mac OS X: in version 10.0 and later
  775. }
  776. function HardDiskQInstall(var theElement: HDQueueElement): OSErr; external name '_HardDiskQInstall';
  777. {
  778. * HardDiskQRemove()
  779. *
  780. * Availability:
  781. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  782. * CarbonLib: in CarbonLib 1.0 and later
  783. * Mac OS X: in version 10.0 and later
  784. }
  785. function HardDiskQRemove(var theElement: HDQueueElement): OSErr; external name '_HardDiskQRemove';
  786. {
  787. * GetScaledBatteryInfo()
  788. *
  789. * Availability:
  790. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  791. * CarbonLib: in CarbonLib 1.0 and later
  792. * Mac OS X: in version 10.0 and later
  793. }
  794. procedure GetScaledBatteryInfo(whichBattery: SInt16; var theInfo: BatteryInfo); external name '_GetScaledBatteryInfo';
  795. {
  796. * AutoSleepControl()
  797. *
  798. * Availability:
  799. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  800. * CarbonLib: in CarbonLib 1.0 and later
  801. * Mac OS X: in version 10.0 and later
  802. }
  803. procedure AutoSleepControl(enableSleep: boolean); external name '_AutoSleepControl';
  804. {
  805. * GetIntModemInfo()
  806. *
  807. * Availability:
  808. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  809. * CarbonLib: in CarbonLib 1.0 and later
  810. * Mac OS X: in version 10.0 and later
  811. }
  812. function GetIntModemInfo: UInt32; external name '_GetIntModemInfo';
  813. {
  814. * SetIntModemState()
  815. *
  816. * Availability:
  817. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  818. * CarbonLib: in CarbonLib 1.0 and later
  819. * Mac OS X: in version 10.0 and later
  820. }
  821. procedure SetIntModemState(theState: SInt16); external name '_SetIntModemState';
  822. {
  823. * MaximumProcessorSpeed()
  824. *
  825. * Availability:
  826. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  827. * CarbonLib: in CarbonLib 1.0 and later
  828. * Mac OS X: in version 10.0 and later
  829. }
  830. function MaximumProcessorSpeed: SInt16; external name '_MaximumProcessorSpeed';
  831. {
  832. * MinimumProcessorSpeed()
  833. *
  834. * Availability:
  835. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  836. * CarbonLib: in CarbonLib 1.0 and later
  837. * Mac OS X: in version 10.0 and later
  838. }
  839. function MinimumProcessorSpeed: SInt16; external name '_MinimumProcessorSpeed';
  840. {
  841. * CurrentProcessorSpeed()
  842. *
  843. * Availability:
  844. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  845. * CarbonLib: in CarbonLib 1.0 and later
  846. * Mac OS X: in version 10.0 and later
  847. }
  848. function CurrentProcessorSpeed: SInt16; external name '_CurrentProcessorSpeed';
  849. {
  850. * FullProcessorSpeed()
  851. *
  852. * Availability:
  853. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  854. * CarbonLib: in CarbonLib 1.0 and later
  855. * Mac OS X: in version 10.0 and later
  856. }
  857. function FullProcessorSpeed: boolean; external name '_FullProcessorSpeed';
  858. {
  859. * SetProcessorSpeed()
  860. *
  861. * Availability:
  862. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  863. * CarbonLib: in CarbonLib 1.0 and later
  864. * Mac OS X: in version 10.0 and later
  865. }
  866. function SetProcessorSpeed(fullSpeed: boolean): boolean; external name '_SetProcessorSpeed';
  867. {
  868. * GetSCSIDiskModeAddress()
  869. *
  870. * Availability:
  871. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  872. * CarbonLib: in CarbonLib 1.0 and later
  873. * Mac OS X: in version 10.0 and later
  874. }
  875. function GetSCSIDiskModeAddress: SInt16; external name '_GetSCSIDiskModeAddress';
  876. {
  877. * SetSCSIDiskModeAddress()
  878. *
  879. * Availability:
  880. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  881. * CarbonLib: in CarbonLib 1.0 and later
  882. * Mac OS X: in version 10.0 and later
  883. }
  884. procedure SetSCSIDiskModeAddress(scsiAddress: SInt16); external name '_SetSCSIDiskModeAddress';
  885. {
  886. * GetWakeupTimer()
  887. *
  888. * Availability:
  889. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  890. * CarbonLib: in CarbonLib 1.0 and later
  891. * Mac OS X: in version 10.0 and later
  892. }
  893. procedure GetWakeupTimer(var theTime: WakeupTime); external name '_GetWakeupTimer';
  894. {
  895. * SetWakeupTimer()
  896. *
  897. * Availability:
  898. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  899. * CarbonLib: in CarbonLib 1.0 and later
  900. * Mac OS X: in version 10.0 and later
  901. }
  902. procedure SetWakeupTimer(var theTime: WakeupTime); external name '_SetWakeupTimer';
  903. {
  904. * IsProcessorCyclingEnabled()
  905. *
  906. * Availability:
  907. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  908. * CarbonLib: in CarbonLib 1.0 and later
  909. * Mac OS X: in version 10.0 and later
  910. }
  911. function IsProcessorCyclingEnabled: boolean; external name '_IsProcessorCyclingEnabled';
  912. {
  913. * EnableProcessorCycling()
  914. *
  915. * Availability:
  916. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  917. * CarbonLib: in CarbonLib 1.0 and later
  918. * Mac OS X: in version 10.0 and later
  919. }
  920. procedure EnableProcessorCycling(enable: boolean); external name '_EnableProcessorCycling';
  921. {
  922. * BatteryCount()
  923. *
  924. * Availability:
  925. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  926. * CarbonLib: in CarbonLib 1.0 and later
  927. * Mac OS X: in version 10.0 and later
  928. }
  929. function BatteryCount: SInt16; external name '_BatteryCount';
  930. {
  931. * GetBatteryVoltage()
  932. *
  933. * Availability:
  934. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  935. * CarbonLib: in CarbonLib 1.0 and later
  936. * Mac OS X: in version 10.0 and later
  937. }
  938. function GetBatteryVoltage(whichBattery: SInt16): Fixed; external name '_GetBatteryVoltage';
  939. {
  940. * GetBatteryTimes()
  941. *
  942. * Availability:
  943. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  944. * CarbonLib: in CarbonLib 1.0 and later
  945. * Mac OS X: in version 10.0 and later
  946. }
  947. procedure GetBatteryTimes(whichBattery: SInt16; var theTimes: BatteryTimeRec); external name '_GetBatteryTimes';
  948. {
  949. * GetDimmingTimeout()
  950. *
  951. * Availability:
  952. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  953. * CarbonLib: in CarbonLib 1.0 and later
  954. * Mac OS X: in version 10.0 and later
  955. }
  956. function GetDimmingTimeout: ByteParameter; external name '_GetDimmingTimeout';
  957. {
  958. * SetDimmingTimeout()
  959. *
  960. * Availability:
  961. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  962. * CarbonLib: in CarbonLib 1.0 and later
  963. * Mac OS X: in version 10.0 and later
  964. }
  965. procedure SetDimmingTimeout(timeout: ByteParameter); external name '_SetDimmingTimeout';
  966. {
  967. * DimmingControl()
  968. *
  969. * Availability:
  970. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  971. * CarbonLib: in CarbonLib 1.0 and later
  972. * Mac OS X: in version 10.0 and later
  973. }
  974. procedure DimmingControl(enableSleep: boolean); external name '_DimmingControl';
  975. {
  976. * IsDimmingControlDisabled()
  977. *
  978. * Availability:
  979. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  980. * CarbonLib: in CarbonLib 1.0 and later
  981. * Mac OS X: in version 10.0 and later
  982. }
  983. function IsDimmingControlDisabled: boolean; external name '_IsDimmingControlDisabled';
  984. {
  985. * IsAutoSlpControlDisabled()
  986. *
  987. * Availability:
  988. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  989. * CarbonLib: in CarbonLib 1.0 and later
  990. * Mac OS X: in version 10.0 and later
  991. }
  992. function IsAutoSlpControlDisabled: boolean; external name '_IsAutoSlpControlDisabled';
  993. {
  994. * PMgrStateQInstall()
  995. *
  996. * Availability:
  997. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  998. * CarbonLib: in CarbonLib 1.0 and later
  999. * Mac OS X: in version 10.0 and later
  1000. }
  1001. function PMgrStateQInstall(var theElement: PMgrQueueElement): OSErr; external name '_PMgrStateQInstall';
  1002. {
  1003. * PMgrStateQRemove()
  1004. *
  1005. * Availability:
  1006. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1007. * CarbonLib: in CarbonLib 1.0 and later
  1008. * Mac OS X: in version 10.0 and later
  1009. }
  1010. function PMgrStateQRemove(var theElement: PMgrQueueElement): OSErr; external name '_PMgrStateQRemove';
  1011. {
  1012. * UpdateSystemActivity()
  1013. *
  1014. * Availability:
  1015. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1016. * CarbonLib: in CarbonLib 1.0 and later
  1017. * Mac OS X: in version 10.0 and later
  1018. }
  1019. function UpdateSystemActivity(activity: ByteParameter): OSErr; external name '_UpdateSystemActivity';
  1020. {
  1021. * DelaySystemIdle()
  1022. *
  1023. * Availability:
  1024. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1025. * CarbonLib: in CarbonLib 1.0 and later
  1026. * Mac OS X: in version 10.0 and later
  1027. }
  1028. function DelaySystemIdle: OSErr; external name '_DelaySystemIdle';
  1029. {
  1030. * GetStartupTimer()
  1031. *
  1032. * Availability:
  1033. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1034. * CarbonLib: in CarbonLib 1.0 and later
  1035. * Mac OS X: in version 10.0 and later
  1036. }
  1037. function GetStartupTimer(var theTime: StartupTime): OSErr; external name '_GetStartupTimer';
  1038. {
  1039. * SetStartupTimer()
  1040. *
  1041. * Availability:
  1042. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1043. * CarbonLib: in CarbonLib 1.0 and later
  1044. * Mac OS X: in version 10.0 and later
  1045. }
  1046. function SetStartupTimer(var theTime: StartupTime): OSErr; external name '_SetStartupTimer';
  1047. {
  1048. * GetLastActivity()
  1049. *
  1050. * Availability:
  1051. * Non-Carbon CFM: in PowerMgrLib 1.0 and later
  1052. * CarbonLib: in CarbonLib 1.0 and later
  1053. * Mac OS X: in version 10.0 and later
  1054. }
  1055. function GetLastActivity(var theActivity: ActivityInfo): OSErr; external name '_GetLastActivity';
  1056. {
  1057. * GetSoundMixerState()
  1058. *
  1059. * Availability:
  1060. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1061. * CarbonLib: in CarbonLib 1.0 and later
  1062. * Mac OS X: in version 10.0 and later
  1063. }
  1064. function GetSoundMixerState(var theSoundMixerByte: SoundMixerByte): OSErr; external name '_GetSoundMixerState';
  1065. {
  1066. * SetSoundMixerState()
  1067. *
  1068. * Availability:
  1069. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1070. * CarbonLib: in CarbonLib 1.0 and later
  1071. * Mac OS X: in version 10.0 and later
  1072. }
  1073. function SetSoundMixerState(var theSoundMixerByte: SoundMixerByte): OSErr; external name '_SetSoundMixerState';
  1074. {
  1075. * GetDimSuspendState()
  1076. *
  1077. * Availability:
  1078. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1079. * CarbonLib: in CarbonLib 1.0 and later
  1080. * Mac OS X: in version 10.0 and later
  1081. }
  1082. function GetDimSuspendState: boolean; external name '_GetDimSuspendState';
  1083. {
  1084. * SetDimSuspendState()
  1085. *
  1086. * Availability:
  1087. * Non-Carbon CFM: in PowerMgrLib 1.1 and later
  1088. * CarbonLib: in CarbonLib 1.0 and later
  1089. * Mac OS X: in version 10.0 and later
  1090. }
  1091. procedure SetDimSuspendState(dimSuspendState: boolean); external name '_SetDimSuspendState';
  1092. {$ifc CALL_NOT_IN_CARBON}
  1093. {
  1094. * GetCoreProcessorTemperature()
  1095. *
  1096. * Availability:
  1097. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1098. * CarbonLib: not available
  1099. * Mac OS X: not available
  1100. }
  1101. function GetCoreProcessorTemperature(inCpuID: MPCpuID): SInt32; external name '_GetCoreProcessorTemperature';
  1102. {
  1103. * GetWakeOnNetworkOptions()
  1104. *
  1105. * Availability:
  1106. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1107. * CarbonLib: not available
  1108. * Mac OS X: not available
  1109. }
  1110. function GetWakeOnNetworkOptions: OptionBits; external name '_GetWakeOnNetworkOptions';
  1111. {
  1112. * SetWakeOnNetworkOptions()
  1113. *
  1114. * Availability:
  1115. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1116. * CarbonLib: not available
  1117. * Mac OS X: not available
  1118. }
  1119. procedure SetWakeOnNetworkOptions(inOptions: OptionBits); external name '_SetWakeOnNetworkOptions';
  1120. {
  1121. * AddPowerSource()
  1122. *
  1123. * Availability:
  1124. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1125. * CarbonLib: not available
  1126. * Mac OS X: not available
  1127. }
  1128. function AddPowerSource(var ioPowerSource: PowerSourceParamBlock): OSStatus; external name '_AddPowerSource';
  1129. {
  1130. * RemovePowerSource()
  1131. *
  1132. * Availability:
  1133. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1134. * CarbonLib: not available
  1135. * Mac OS X: not available
  1136. }
  1137. function RemovePowerSource(inSourceID: PowerSourceID): OSStatus; external name '_RemovePowerSource';
  1138. {
  1139. * UpdatePowerSource()
  1140. *
  1141. * Availability:
  1142. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1143. * CarbonLib: not available
  1144. * Mac OS X: not available
  1145. }
  1146. function UpdatePowerSource(var ioSource: PowerSourceParamBlock): OSStatus; external name '_UpdatePowerSource';
  1147. {
  1148. * IsServerModeEnabled()
  1149. *
  1150. * Availability:
  1151. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1152. * CarbonLib: not available
  1153. * Mac OS X: not available
  1154. }
  1155. function IsServerModeEnabled: boolean; external name '_IsServerModeEnabled';
  1156. {
  1157. * EnableServerMode()
  1158. *
  1159. * Availability:
  1160. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1161. * CarbonLib: not available
  1162. * Mac OS X: not available
  1163. }
  1164. procedure EnableServerMode(inEnable: boolean); external name '_EnableServerMode';
  1165. {
  1166. NumBatteriesInstalled is different from BatteryCount in that it
  1167. indicates how many batteries are actually available at the time
  1168. it is called (including UPS batteries). BatteryCount shows a
  1169. static number of batteries a machine is capable of holding which does NOT
  1170. include UPS batteries. So, while a desktop might show a BatteryCount
  1171. of zero, its NumBatteriesInstalled value might be 1 or more if a UPS
  1172. is attached.
  1173. }
  1174. {
  1175. * NumBatteriesInstalled()
  1176. *
  1177. * Availability:
  1178. * Non-Carbon CFM: in PowerMgrLib 2.0 and later
  1179. * CarbonLib: not available
  1180. * Mac OS X: not available
  1181. }
  1182. function NumBatteriesInstalled: UInt32; external name '_NumBatteriesInstalled';
  1183. { Power Handler Management }
  1184. {
  1185. * IsPCIPowerOffDisabled()
  1186. *
  1187. * Availability:
  1188. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1189. * CarbonLib: not available
  1190. * Mac OS X: not available
  1191. }
  1192. function IsPCIPowerOffDisabled: boolean; external name '_IsPCIPowerOffDisabled';
  1193. {
  1194. * EnablePCIPowerOff()
  1195. *
  1196. * Availability:
  1197. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1198. * CarbonLib: not available
  1199. * Mac OS X: not available
  1200. }
  1201. procedure EnablePCIPowerOff(inEnable: boolean); external name '_EnablePCIPowerOff';
  1202. {
  1203. * AddDevicePowerHandler()
  1204. *
  1205. * Availability:
  1206. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1207. * CarbonLib: not available
  1208. * Mac OS X: not available
  1209. }
  1210. function AddDevicePowerHandler(regEntryID: RegEntryIDPtr; handler: PowerHandlerProcPtr; refCon: UInt32; deviceType: CStringPtr): OSStatus; external name '_AddDevicePowerHandler';
  1211. {
  1212. * RemoveDevicePowerHandler()
  1213. *
  1214. * Availability:
  1215. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1216. * CarbonLib: not available
  1217. * Mac OS X: not available
  1218. }
  1219. function RemoveDevicePowerHandler(regEntryID: RegEntryIDPtr): OSStatus; external name '_RemoveDevicePowerHandler';
  1220. {
  1221. * RemoveDevicePowerHandlerForProc()
  1222. *
  1223. * Availability:
  1224. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1225. * CarbonLib: not available
  1226. * Mac OS X: not available
  1227. }
  1228. function RemoveDevicePowerHandlerForProc(proc: PowerHandlerProcPtr): OSStatus; external name '_RemoveDevicePowerHandlerForProc';
  1229. {
  1230. * GetDevicePowerLevel()
  1231. *
  1232. * Availability:
  1233. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1234. * CarbonLib: not available
  1235. * Mac OS X: not available
  1236. }
  1237. function GetDevicePowerLevel(regEntryID: RegEntryIDPtr; var devicePowerLevel: PowerLevel): OSStatus; external name '_GetDevicePowerLevel';
  1238. {
  1239. * SetDevicePowerLevel()
  1240. *
  1241. * Availability:
  1242. * Non-Carbon CFM: in DriverServicesLib 1.1 and later
  1243. * CarbonLib: not available
  1244. * Mac OS X: not available
  1245. }
  1246. function SetDevicePowerLevel(regEntryID: RegEntryIDPtr; devicePowerLevel: PowerLevel): OSStatus; external name '_SetDevicePowerLevel';
  1247. {$endc} {CALL_NOT_IN_CARBON}
  1248. const
  1249. uppSleepQProcInfo = $00131832;
  1250. uppHDSpindownProcInfo = $000000C0;
  1251. uppPMgrStateChangeProcInfo = $000003C0;
  1252. {
  1253. * NewSleepQUPP()
  1254. *
  1255. * Availability:
  1256. * Non-Carbon CFM: available as macro/inline
  1257. * CarbonLib: in CarbonLib 1.0 and later
  1258. * Mac OS X: in version 10.0 and later
  1259. }
  1260. function NewSleepQUPP(userRoutine: SleepQProcPtr): SleepQUPP; external name '_NewSleepQUPP'; { old name was NewSleepQProc }
  1261. {
  1262. * NewHDSpindownUPP()
  1263. *
  1264. * Availability:
  1265. * Non-Carbon CFM: available as macro/inline
  1266. * CarbonLib: in CarbonLib 1.0 and later
  1267. * Mac OS X: in version 10.0 and later
  1268. }
  1269. function NewHDSpindownUPP(userRoutine: HDSpindownProcPtr): HDSpindownUPP; external name '_NewHDSpindownUPP'; { old name was NewHDSpindownProc }
  1270. {
  1271. * NewPMgrStateChangeUPP()
  1272. *
  1273. * Availability:
  1274. * Non-Carbon CFM: available as macro/inline
  1275. * CarbonLib: in CarbonLib 1.0 and later
  1276. * Mac OS X: in version 10.0 and later
  1277. }
  1278. function NewPMgrStateChangeUPP(userRoutine: PMgrStateChangeProcPtr): PMgrStateChangeUPP; external name '_NewPMgrStateChangeUPP'; { old name was NewPMgrStateChangeProc }
  1279. {
  1280. * DisposeSleepQUPP()
  1281. *
  1282. * Availability:
  1283. * Non-Carbon CFM: available as macro/inline
  1284. * CarbonLib: in CarbonLib 1.0 and later
  1285. * Mac OS X: in version 10.0 and later
  1286. }
  1287. procedure DisposeSleepQUPP(userUPP: SleepQUPP); external name '_DisposeSleepQUPP';
  1288. {
  1289. * DisposeHDSpindownUPP()
  1290. *
  1291. * Availability:
  1292. * Non-Carbon CFM: available as macro/inline
  1293. * CarbonLib: in CarbonLib 1.0 and later
  1294. * Mac OS X: in version 10.0 and later
  1295. }
  1296. procedure DisposeHDSpindownUPP(userUPP: HDSpindownUPP); external name '_DisposeHDSpindownUPP';
  1297. {
  1298. * DisposePMgrStateChangeUPP()
  1299. *
  1300. * Availability:
  1301. * Non-Carbon CFM: available as macro/inline
  1302. * CarbonLib: in CarbonLib 1.0 and later
  1303. * Mac OS X: in version 10.0 and later
  1304. }
  1305. procedure DisposePMgrStateChangeUPP(userUPP: PMgrStateChangeUPP); external name '_DisposePMgrStateChangeUPP';
  1306. {
  1307. * InvokeSleepQUPP()
  1308. *
  1309. * Availability:
  1310. * Non-Carbon CFM: available as macro/inline
  1311. * CarbonLib: in CarbonLib 1.0 and later
  1312. * Mac OS X: in version 10.0 and later
  1313. }
  1314. function InvokeSleepQUPP(message: SInt32; qRecPtr: SleepQRecPtr; userRoutine: SleepQUPP): SInt32; external name '_InvokeSleepQUPP'; { old name was CallSleepQProc }
  1315. {
  1316. * InvokeHDSpindownUPP()
  1317. *
  1318. * Availability:
  1319. * Non-Carbon CFM: available as macro/inline
  1320. * CarbonLib: in CarbonLib 1.0 and later
  1321. * Mac OS X: in version 10.0 and later
  1322. }
  1323. procedure InvokeHDSpindownUPP(theElement: HDQueueElementPtr; userRoutine: HDSpindownUPP); external name '_InvokeHDSpindownUPP'; { old name was CallHDSpindownProc }
  1324. {
  1325. * InvokePMgrStateChangeUPP()
  1326. *
  1327. * Availability:
  1328. * Non-Carbon CFM: available as macro/inline
  1329. * CarbonLib: in CarbonLib 1.0 and later
  1330. * Mac OS X: in version 10.0 and later
  1331. }
  1332. procedure InvokePMgrStateChangeUPP(theElement: PMgrQueueElementPtr; stateBits: SInt32; userRoutine: PMgrStateChangeUPP); external name '_InvokePMgrStateChangeUPP'; { old name was CallPMgrStateChangeProc }
  1333. {$ALIGN MAC68K}
  1334. end.