background image
C H A P T E R 1 7
Additional System Services
Using Additional System Services
Registering Login Screen Functions
If you want a power-on function that brings up some sort of visible component,
you should register that function as login function. These functions are only called
after the login screen has been displayed and the password entered (if the user has
installed a password). Note that future Newton devices may not support the login
screen. In this case the login functions will still be executed.
The methods that register login functions are defined in the
sleepScreen view
to get a reference to the
view to send it
messages, use code such as:
The callback function registered with
must not itself
Registering Power-Off Functions
You may register callback functions to be called when a Newton device is powered
off with the
function. As with power-on functions, when the
Newton is powered off, the system passes a symbol to your "shutdown" callback
function indicating the reason it was called. This symbol, passed as the value of
your callback's why parameter, allows it to condition its actions according to the
way the system was powered off. The
symbol indicates that the user
initiated the shutdown. The
symbol indicates the system initiated shutdown
after the Newton was left idle for the period of time specified by the user's Sleep
preferences. The
symbol indicates that the Newton powered off for
some other unspecified reason.
The system also passes a symbol to your callback function indicating the current
status of the shutdown operation. This symbol is passed as the value of your
callback's what parameter. The value of this parameter is used as the basis for
the cooperative shutdown process. Your callback function must return a value
indicating whether to continue the power-off sequence or delay it. This value is
passed to all registered shutdown functions, allowing each to indicate whether it is
ready to shut down or needs time to complete a task.
symbol indicates that the system has received a request to
shut down. In response to the
symbol, your callback can return
to specify that shutdown may continue, or it can return
to cancel the
shutdown process. Note that an
symbol does not guarantee that
shutdown will occur--another callback function may cancel the power-off sequence.
symbol indicates that shutdown is imminent. If the callback
function must first perform an operation asynchronously, such as the disposal of a
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна