background image
C H A P T E R 2 3
Endpoint Interface
23-10
Using the Endpoint Interface
'long,
'long
]
}
};
When you set endpoint options, the cloned option frame is returned to you so that
you can check the result codes for individual options. If you set options with an
asynchronous method call, the cloned option frame is returned as a parameter to
the
CompletionScript
callback method. If you set options with a synchronous
method call, the cloned option frame is returned as the value of the synchronous
method itself.
The
result
slot in each option frame is always set for returned options. It can be
set to any of the error codes listed in "Option Error Code Constants" (Table 20-5
on page 20-5) in Newton Programmer's Reference. If an option succeeds without
errors, the
result
slot is set to
nil
.
Exceptions are not thrown when individual options fail. This allows a request to
succeed if, for example, every specified option except one succeeds. If you need to
determine whether a particular option succeeds or fails, you must check the
result
slot of the option in question.
Note that in one array of option frames, you can specify options that are of the
same type, and that seem to conflict. Since options are processed one at a time, in
order, the last option of a particular type is the one that is actually implemented by
the communication tool.
Note
When instantiating an endpoint for use with the modem tool, you
can have options specified by the options parameter to the
Instantiate
method, as well as options specified by a modem
setup package (see Chapter 25, "Modem Setup Service."). Any
options from a modem setup package are appended to those set by
the
Instantiate
method.
For details on the specific options you can set for the built-in communication tools,
see Chapter 24, "Built-in Communications Tools."
Initialization and Termination
23
Before using an endpoint, you must instantiate it using the
Instantiate
method.
This method allocates memory in the system and creates the endpoint object.
Then, you must bind the endpoint object to the communication hardware by calling
the
Bind
method. This allocates the communication tool resources for use by
the endpoint.
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна