Power Manager: Developer

Table of Contents

I. API Overview
1. Getting Started
Using Power Manager Engine's C API
Creating a Connection
Follow the Create/Copy Rule
Authenticating Remote Connections
Passive: Username and Password
Interactive: Command Line Tool
Providing NULL
CFAuthenticator: Using an authenticator
Writing your own authenticator
2. Supporting Agents, Daemons, and Utilities
pmctl — control tool.
Power Manager Notification.app — notification agent.
pmd — daemon and authorization rights tool.
pmuser — per-session daemon.
Power Manager Access — user interface assistant.
Remove Power Manager — removal tool.
3. Supporting Bonjour
Power Manager's Service Types
pm - DssW Power Manager protocol
Defined TXT Keys
II. API Reference
I. Application Programmer Interfaces (APIs)
pme.api.pmdctl — Primary interface for the Power Manager Engine.
II. Astronomic
astronomic.sunobservation — Calculate the time and date for an astronomical sun event.
III. Authorisation
authorisation.rights — Defined rights.
authorisation.applyright — Set a rule for a right.
IV. Build
build.version — Engine's release version.
build.revision — Engine's revision number.
build.restart — Restart the engine and associated processes.
V. Client
client.computername — Computer's name.
client.localhostname — Computer's local host name.
client.ethernetaddress — Primary ethernet address.
client.ethernetaddresses — All ethernet addresses.
client.machinemodel — Machine's model type.
VI. Event Store
eventstore.events — Available events that can be triggered or performed.
eventstore.store — Store zero or more events.
eventstore.remove — Remove an event.
eventstore.history — Event history.
VII. Legal
legal.licence — Engine's licence details.
legal.license — Set the licence details.
legal.revoke — Remove all licence information.
VIII. Listen
listen.sockets — Sockets the engine accepts incoming connections on.
listen.applysocket — Set a socket to listen for incoming connections on.
listen.removesocket — Remove a socket.
IX. Log
log.recent — Audit log tail.
log.filterlevel — Filtering out log messages with levels lower than this.
log.setfilterlevel — Set the filter level for new log messages.
X. Notifications
notifications.current — Notifying date and time based triggers with events.
notifications.warning — Warnings of host affecting actions.
notifications.warningperiod — Seconds to display warnings.
notifications.notifyperiod — Seconds to display notifications.
notifications.setwarningperiod — Set the seconds to display warnings.
notifications.setnotifyperiod — Sets seconds before an Event the user is notified.
XI. On Demand
ondemand.available — Available on demand events.
ondemand.perform — Perform an event's actions.
XII. Power
power.sources — Known sources of power.
XIII. Scheduler
scheduler.enabled — Can events be triggered.
scheduler.pending — Date and time based triggers with events.
scheduler.active — Active events.
scheduler.assistants — Local assistant signatures.
scheduler.setenabled — Set the Scheduler's enabled state.
scheduler.cancel — Cancel a pending queued trigger.
scheduler.adjust — Adjust a pending trigger date.
scheduler.reset — Reset a pending trigger.
XIV. Time Zone
timezone.name — name
timezone.utcoffset — UTC offset in seconds
XV. Structures
SSL — A description of a SSL configuration.
URL options — URL options.
action — Task to perform.
action sleep — Put the computer to sleep.
action shut down — Shut down the computer.
action restart — Restart the computer.
action log out — Log out all users.
action fast user switch — Switch to the Login Window.
action notification — Post a notification.
action execute external — Execute an external process.
action launch application — Launch an application.
action warn — Warn users of imminent host affecting action.
action await once — Wait for a specific time and date to occur.
action await daily — Wait for a specific time and day to occur.
action await relative date — Wait for a period of time.
action await user inactivity — Wait for a period of user inactivity.
action await notification — Wait for a notification.
action await power on — Wait for the computer to power on.
action await start up — Wait for the computer to start up.
action await sleep — Wait for the computer to sleep.
action await sample — Wait for a sample to conclude.
action await log in — Wait for a user to log in.
action await log out — Wait for a user to log out.
action await battery health — Wait for battery health to reach specific state.
action await power state — Wait for the source of power to change.
action await power remaining — Wait for the power remaining to change.
action await sun — Wait for a specific sun observation to occur.
action await external assistant — Wait for a change in the external assistants.
action await application — Wait for an application to launch or quit.
active event — Active event instance.
application description — Description for launching an external process.
assistant — Assistant details.
authorisation right — An authorisation right.
condition — Description of a testable condition that resolves to a boolean.
condition boolean — A constant condition.
condition delayed boolean — A delayed constant condition.
condition days — Conditional on the day of the week.
condition date range — Conditional on the date falling within a specific period.
condition time range — Conditional on the time now falling within a specific period.
condition execute external — Conditional on the external executable's exit status.
condition sample — Conditional on a sample's successful conclusion.
condition running processes — Conditional on whether specific processes are running.
condition power assertions — Conditional on whether other processes have power assertions set.
condition power state — Conditional on the computer's power source state.
condition battery health — Conditional on the battery health.
condition power remaining — Conditional on the power remaining.
condition sun — Conditional on the Sun's position being between two events.
condition user inactivity — Conditional on the period of user inactivity.
condition console user — Conditional on a user being logged in.
condition start up — Conditional on time since start up.
criteria — Group of conditions to test.
event — Event containing triggers to observe, conditions to test, and actions to perform.
event history — Event history.
external — Description for executing an external process.
external executable — Execute the external executable.
external inline — Execute the inline content.
external criterion — Criterion for judging an external executable sample.
external criterion interpret — Interpret the output as a number.
external criterion contains — Output contains a value.
geolocation — Geospatial location.
licence — Licence details for this Power Manager Engine.
log message
power source — A power source.
power source serial — Power source connected via a serial cable.
power source USB — Power source connected via a USB cable.
power source network — Power source connected via a network connection.
power source internal — Internal power source such as a fitted or removable battery.
power source unknown — Unknown power source.
power source filter — A profile for filtering power source changes.
process signature — Process signature provides a robust means of identifying a running process.
process signature bundle identifier — Match a process's bundle identifier.
process signature name — Match a process's bundle or executable name.
process signature localised name — Match a process's localised name.
queued trigger — Queued trigger instance.
queued warning — Host wide warning.
resource limits — Constraints for external processes.
sample — Description for sampling.
sample execute external — Sample from an external executable.
sample criterion — Criterion for concluding a sample.
sample criterion equal — Judge the samples looking for a positive match.
sample criterion not equal — Judge the samples looking for a negative match.
socket — A description of a TCP/IP socket.
source — A description of a source.
trigger — Description of an external event or potential change in state to watch.
trigger once — Trigger once on a given time and date.
trigger daily — Trigger at a given time on given days of the week.
trigger after inactivity — Trigger after a given period of user inactivity.
trigger notification — Trigger on receiving a notification.
trigger power on — Trigger when the computer powers on.
trigger start up — Trigger when the computer starts up.
trigger log in — Trigger when a user logs in.
trigger log out — Trigger when a user logs out.
trigger sleep — Trigger when the computer is about to sleep.
trigger sample — Trigger when a sample successfully concludes.
trigger power state — Trigger when the source of power changes.
trigger power remaining — Trigger when the power remaining changes.
trigger battery health — Trigger when a power source's battery health changes.
trigger sun — Trigger at a given angle of the Sun.
trigger external assistant — Trigger when an external assistant changes.
trigger application — Trigger when an application launches or quits.
XVI. Elements
SSL allowances — SSL allow.
SSL level — SSL level.
URL — Universal Resource Locator
access rights — Available rights.
action type — Types of action.
application behaviour — Application launch behaviours.
application change — Application change.
application visibility — Application visibility.
astronomical sun event — Astronomical Sun event.
authorisation rule — Rules available to rights.
behaviour — Event wide behaviours.
comparison — Value comparison methods.
comparison option — Comparison options.
condition type — Types of condition.
day — Days of the week.
days — Days of the week. Any combination of unique days.
delay by seconds — Seconds to delay by.
drift — Acceptable date and time drift.
encoding — Encoding formats.
event activity — Active event state.
external continues — When to continue performing remaining actions.
external criterion type — Types of external criterion.
external files — Special case external files.
external type — Types of externals.
external user types — Types of special case users.
image — Built-in image identifiers.
latitude — Latitude.
licence state — Available licence states.
longitude — Longitude.
message level — Levels of log messages.
notification — Notification.
numeric comparison — Numeric value comparison methods.
port — TCP/IP port.
power — Power event.
power confidence — The power source confidence.
power health — The power source health.
power source capacity — Power source capacity.
power source type — The power source type.
power state — The power source state.
process signature type — Types of process signature.
protocol family — Supported network protocols.
quiet — Minimise notifications.
requires — How many must resolve to true.
right — Known rights.
sample criterion type — Types of sample criterion.
scatter — Seconds, plus and minus, to scatter a date and time by.
scope — Scope of notification.
socket options — Socket options.
socket state — Socket states.
source state — Source states.
source type — Types of sample sources.
time out — Duration after which a silent connection is disconnected.
trigger type — Types of trigger.
unique ID — Unique identifier (ID).
value — Value to compare against.

List of Examples

1.1. Create a PMConnection
1.2. Connect to the default engine
1.3. Default main.c of a Core Services XCode 3.2 project
1.4. Include the PowerManager framework headers.
1.5. Create a PMConnectionRef.
1.6. Create and set a PMAuthenticator.
1.7. Connect to a URL and enter the runloop.
1.8. Create and set a custom PMAuthenticator.
1.9. Create a response array and iterate over the requests.
1.10. Get the request type for request.
1.11. Handle the prompt request type.
1.12. Handle the informative message request type.
1.13. Handle the error message request type.
2.1. Integer coercions
2.2. Boolean coercions
2.3. Date coercions
17. C: Minimal astronomic.sunobservation
18. C: authorisation.rights
19. Objective-C: authorisation.rights
20. AppleScript: authorisation.rights
21. Shell: authorisation.rights
22. C: Minimal authorisation.applyright
23. C: build.version
24. Objective-C: build.version
25. AppleScript: build.version
26. Shell: build.version
27. C: build.revision
28. Objective-C: build.revision
29. AppleScript: build.revision
30. Shell: build.revision
31. C: Minimal build.restart
32. C: client.computername
33. Objective-C: client.computername
34. AppleScript: client.computername
35. Shell: client.computername
36. C: client.localhostname
37. Objective-C: client.localhostname
38. AppleScript: client.localhostname
39. Shell: client.localhostname
40. C: client.ethernetaddress
41. Objective-C: client.ethernetaddress
42. AppleScript: client.ethernetaddress
43. Shell: client.ethernetaddress
44. C: client.ethernetaddresses
45. Objective-C: client.ethernetaddresses
46. AppleScript: client.ethernetaddresses
47. Shell: client.ethernetaddresses
48. C: client.machinemodel
49. Objective-C: client.machinemodel
50. AppleScript: client.machinemodel
51. Shell: client.machinemodel
52. C: eventstore.events
53. Objective-C: eventstore.events
54. AppleScript: eventstore.events
55. Shell: eventstore.events
56. C: Minimal eventstore.store
57. C: Minimal eventstore.remove
58. C: Minimal eventstore.history
59. C: legal.licence
60. Objective-C: legal.licence
61. AppleScript: legal.licence
62. Shell: legal.licence
63. C: Minimal legal.license
64. C: Minimal legal.revoke
65. C: listen.sockets
66. Objective-C: listen.sockets
67. AppleScript: listen.sockets
68. Shell: listen.sockets
69. C: Minimal listen.applysocket
70. C: Minimal listen.removesocket
71. C: log.recent
72. Objective-C: log.recent
73. AppleScript: log.recent
74. Shell: log.recent
75. C: log.filterlevel
76. Objective-C: log.filterlevel
77. AppleScript: log.filterlevel
78. Shell: log.filterlevel
79. C: Minimal log.setfilterlevel
80. C: notifications.current
81. Objective-C: notifications.current
82. AppleScript: notifications.current
83. Shell: notifications.current
84. C: notifications.warning
85. Objective-C: notifications.warning
86. AppleScript: notifications.warning
87. Shell: notifications.warning
88. C: notifications.warningperiod
89. Objective-C: notifications.warningperiod
90. AppleScript: notifications.warningperiod
91. Shell: notifications.warningperiod
92. C: notifications.notifyperiod
93. Objective-C: notifications.notifyperiod
94. AppleScript: notifications.notifyperiod
95. Shell: notifications.notifyperiod
96. C: Minimal notifications.setwarningperiod
97. C: Minimal notifications.setnotifyperiod
98. C: ondemand.available
99. Objective-C: ondemand.available
100. AppleScript: ondemand.available
101. Shell: ondemand.available
102. C: Minimal ondemand.perform
103. C: power.sources
104. Objective-C: power.sources
105. AppleScript: power.sources
106. Shell: power.sources
107. C: scheduler.enabled
108. Objective-C: scheduler.enabled
109. AppleScript: scheduler.enabled
110. Shell: scheduler.enabled
111. C: scheduler.pending
112. Objective-C: scheduler.pending
113. AppleScript: scheduler.pending
114. Shell: scheduler.pending
115. C: scheduler.active
116. Objective-C: scheduler.active
117. AppleScript: scheduler.active
118. Shell: scheduler.active
119. C: scheduler.assistants
120. Objective-C: scheduler.assistants
121. AppleScript: scheduler.assistants
122. Shell: scheduler.assistants
123. C: Minimal scheduler.setenabled
124. C: Minimal scheduler.cancel
125. C: Minimal scheduler.adjust
126. C: Minimal scheduler.reset
127. C: timezone.name
128. Objective-C: timezone.name
129. AppleScript: timezone.name
130. Shell: timezone.name
131. C: timezone.utcoffset
132. Objective-C: timezone.utcoffset
133. AppleScript: timezone.utcoffset
134. Shell: timezone.utcoffset