
CHAPTER 22
Transport Interface
Using the Transport Interface 22-13
// SendRequest method
func (newRequest)
begin
if status <> 'idle then // check if I’m active
// wait for idle and then call SendRequest again
:QueueRequest('SendRequest, newRequest);
else
// do a normal send here
end,
Canceling an Operation 22
The system sends the CancelRequest message to the transport when the user
cancels the current transaction or for other reasons, such as when the system wants
to turn off. This method must be defined by all transports.
When a transport receives this message, it must terminate the communication
operation as soon as possible.
The
CancelRequest method should return non-nil if it is OK to turn off power
immediately after this method returns, or
nil if it is not OK to turn off power
immediately. In the latter case, the system waits until your transport returns to the
idle state before turning off. This allows you to send an asynchronous cancel
request to your communication endpoint, for example, and still return immediately
from the
CancelRequest method. When you receive the callback message from
your endpoint cancel request confirming cancellation, use the
SetStatusDialog
method to set the transport status to idle to alert the system that it is OK to turn off.
Obtaining an Item Frame 22
The system sends the NewItem message to the transport to obtain a new item
frame to make a new In/Out Box entry.
This method is supplied by the
protoTransport, but should be overridden by
your transport to fill in extra values your transport uses. If you override this
method, you must first call the inherited
NewItem method, as shown in the
example below. The item frame returned by the
NewItem method should contain
default values for your transport.
The item frame returned by the default method supplied in
protoTransport is
not yet a soup entry. The
item.category slot is initialized to the appSymbol
slot in your transport. For more information on the
item frame, see the section
“Item Frame” beginning on page 22-2.
The
NewItem message is sent to your transport during both send and receive
operations. When the user sends an item, the system sends the
NewItem message
to the transport to create a new In/Out Box entry before opening a routing slip
Commentaires sur ces manuels