background image
C H A P T E R 1 7
Additional System Services
17-24
Using Additional System Services
Because the
ViewSet
method rebuilds and updates all the status slip's child views,
you'll obtain better performance by calling
UpdateIndicator
rather than
ViewSet
when you just need to update the gauge view. The
UpdateIndicator
method rebuilds and updates only the gauge, barber pole, and
progress sheet views.
Implementing a CancelRequest Method
17
If your status slip provides a "Stop" or "Cancel" button, you may include a
ButtonClickScript
with the button or write a
CancelRequest
method to
handle the necessary housekeeping. The
CancelRequest
method can be
implemented either in the status slip or in the application (or transport) base view.
The system checks if the status slip has a
CancelRequest
method, and if not
sends this message to the application (or transport) base view.
Using the Power Registry
17
This section describes the cooperative model that Newton devices use to turn
power on and off, and the battery information functions.
Registering Power-On Functions
17
You may register functions to be called when a Newton device is powered on with
the
RegPowerOn
function. When the Newton device is powered on, the system
calls your "power-on" callback function passing it a symbol indicating the reason it
was called. This allows your code to condition its actions accordingly. For example,
you might perform one set of actions when the user presses the power switch and
another set of actions when the device is powered on by the execution of an alarm.
The
'user
symbol indicates that the user pressed the power switch. The
'emergencyPowerOn
symbol is passed any time the Newton device is powered
up after an emergency power-off. An emergency power-off is any shutdown in
which one or more power-off scripts did not execute. The
'serialgpi
symbol
indicates the presence of +5 volts on the serial port general-purpose input pin (pin
7). The
'alarm
symbol indicates that the power-on was caused by the execution
of an alarm. The
'cardlock
symbol indicates that a PCMCIA card was inserted
or removed.
The
UnRegPowerOn
function unregisters functions added with
RegPowerOn
.
IMPORTANT
The callback function registered with
RegPowerOn
must not
itself call
RegPowerOn
nor
UnRegPowerOn
.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна