beautypg.com

Using additional system services 17, Power registry 17 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 623

background image

C H A P T E R 1 7

Additional System Services

Using Additional System Services

17-7

Power Registry

17

The Power Registry implements a cooperative model for powering the Newton on
and off. When power is turned on or off, this service

notifies registered applications of the impending change in power status

allows applications to temporarily halt the shutdown process

executes registered callback functions

The Power Registry model is based on the registration of callback functions to
execute when the Newton is powered on or off. You can use the

RegPowerOn

function to register a callback function for execution when the Newton is powered
on. The

UnRegPowerOn

function reverses the action of the

RegPowerOn

function; that is, it removes the specified function from the registry of functions
called when the Newton is powered on.

Power-on functions can also be tied to the login screen. The login screen appears
when the user powers on a Newton device. Password-protected Newton devices
display the login screen until the password is correctly entered. If your power-on
function has a visible component, you should tie this function into the login screen,
instead of as a regular power-on function. The

RegLogin

and

UnRegLogin

methods are used to register and unregister login functions respectively.

You can use the

RegPowerOff

function to register a callback function for

execution when the Newton is powered off. The

UnRegPowerOff

function

removes the specified function from the registry of functions called when the
Newton is powered off.

Note that “power-off” callback functions can delay an impending shutdown when
necessary. For example, your callback function might delay an impending power-
off operation until it can successfully tear down a communications endpoint.

Power Compatibility Information

17

Applications can now register callback functions to execute when the Newton
powers on or off. All of the functions that provide this service are new.

The

BatteryLevel

function is obsolete. It has been replaced by the

BatteryStatus

function.

Using Additional System Services

17

This section discusses how to use the undo, idler objects, alerts and alarms, change
notification, progress reporting, and power registry services.