background image
C H A P T E R 2 3
Endpoint Interface
23-24
Using the Endpoint Interface
an option succeeds without errors, the
result
slot is set to
nil
. For more general
information on setting options, see the section "Endpoint Options" beginning on
page 23-7.
Power-Off Handling
23
During send and receive operations, you may want to protect against the system
powering off so that the connection is not broken. The system can power-off
unexpectedly as a result of the user inadvertently turning off the power or as a
result of a low battery. If you want to be notified before the system powers off, you
can register a callback function that the system will call before the power is turned
off. Depending on the value you return from your callback function, you can
prevent, delay, or allow the power-off sequence to continue.
For details on registering power handling functions, see Chapter 17, "Additional
System Services."
Linking the Endpoint With an Application
23
If your endpoint is going to be driven by an application, you'll have a reference to
the endpoint frame in your application. Also, you'll probably want to have a
reference to your application base view in the endpoint frame, so you can handle
endpoint messages in your application through inheritance.
The easiest way to link the endpoint and application together is to create a slot in
your application base view like this:
ViewSetupFormScript: func ()
begin
self.fEndPoint: {_proto: protoBasicEndpoint,
_parent: self};
end
This creates an endpoint frame as a slot in the application base view at run time,
and makes the application base view (
self
here) the parent of the endpoint frame,
so it can receive endpoint messages through inheritance.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна