background image
C H A P T E R 2 2
Transport Interface
22-8
Using the Transport Interface
the routing slip is not closed. If
TransportChanged
returns
nil
, then the
transport is changed and operations continue normally.
You can use the function
GetGroupTransport
to determine the name of the
current (last-used for sending by the user) transport in a group. Note that when you
install a grouped transport, it becomes the current transport for that group.
Transports that are part of a group are individually selectable on the Send, Receive,
and Preferences pickers in the In/Out Box.
Sending Data
22
The Out Box sends the
SendRequest
message to your transport when data needs
to be sent. If your transport supports sending data, you must define this method to
actually send the data. For a complete description of the
SendRequest
method,
see "SendRequest" (page 19-33) in Newton Programmer's Reference.
The Out Box puts its own query information in the request frame argument to
SendRequest
. Your
SendRequest
method must pass this frame to the
ItemRequest
message to get the item (or next item) to send. In your
SendRequest
method, keep calling
ItemRequest
until it returns
nil
,
signalling no more items to send. For a complete description of the
ItemRequest
method, see "ItemRequest" (page 19-26) in Newton Programmer's Reference.
If the
body
slot of an item originally contained an alias, the alias is automatically
resolved by
ItemRequest
. That is, items returned by
ItemRequest
always
contain a
body
slot that is not an alias.
Note that you can save entry aliases to items returned by
ItemRequest
, if you
want. Later, when using them, make sure that
ResolveEntryAlias
returns a
non-
nil
value, and that the item
state
slot is set as expected.
You can choose to comply with or ignore any request to send, depending on the
communication resources available and their status. If you choose to comply, your
SendRequest
method must obtain one or more items from the Out Box by using
the
ItemRequest
method, and send them by whatever means the transport uses
to communicate. For example, most transports use the Endpoint interface to
establish and operate a connection.
If request.
cause
is
'submit
, the item is queued in the Out Box for later sending,
but the Out Box still notifies the transport by sending it this
SendRequest
message so that the transport knows there are items waiting to be sent. Typically, a
transport doesn't need to take any immediate action on items where request.
cause
is
'submit
, so you can use code like this to simply return:
If request.cause = 'submit then return nil;
The
item.connect
slot contains a Boolean value indicating if the user chose to
send the item now (
true
) or later (
nil
).
© 2007-2017, o7 studio » при воспроизведении материала сайта ссылка обязательна