background image
C H A P T E R 2 4
Built-in Communications Tools
Serial Tool
24-3
You can get or set most of the standard serial options in the endpoint method that
established the state, as shown in Table 24-1. You set the endpoint options by passing
an argument to the communications tool when calling one of the endpoint methods
such as
Instantiate
,
Bind
, and
Connect
. For example, when you pass an
option to the
Bind
method, the system sets the option and then does the binding.
Many of the communications options can only be used when the communications
tool is in a certain state. For example, the first option in Table 24-1,
kCMOSerialHWChipLoc
, can only be used after the endpoint has been instantiated
and before the binding is made. That means you could use it in the
Instantiate
and
Bind
methods, but not in the
Connect
method.
All of these options have default values, so you may not need to use an option if
the default values provide the behavior you want. However, the default values do
not apply partially. This means that if you do use an option, you must specify a
value for each field within it.
kCMOSerialBreak
"sbrk"
After connecting
Sends a break.
kCMOSerialDiscard
"sdsc"
After connecting
Discards data in input
and/or output buffer.
kCMOSerialEventEnables
"sevt"
Any time
Configures the serial
tool to complete an
endpoint event on
particular state
changes.
kCMOSerialBytesAvailable
"sbav"
After connecting
Read-only option
returns the number of
bytes available in the
input buffer.
kCMOSerialIOStats
"sios"
After connecting
Read-only option
reports statistics from
the current serial
connection.
kHMOSerExtClockDivide
"cdiv"
After binding
Used only with an
external clock to set
the clock divide factor.
Table 24-1
Summary of serial options (continued)
Label
Value
Use when
Description
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна