background image
C H A P T E R 2 3
Endpoint Interface
Using the Endpoint Interface
23-9
All option data you set gets packed together into one block of data. Each option
within this block must be long-word aligned for the communication tools. So,
when using the
'template
data form, you need to use the
'struct
type (at the
beginning of the
typelist
array) to guarantee that the option is long-word
aligned and padded. To set the serial input/output parameters, for instance, the
option frame might look like this:
serialIOParms := {
type: 'option,
label: kCMOSerialIOParms,
opCode: opSetNegotiate,
data: {
arglist: [
kNoParity, //
parity
k1StopBits, // stopBits
k8DataBits, // dataBits
k9600bps, //
bps
],
typelist: [
'struct,
'uLong,
'long,
'long,
'long
]
}
};
To get the connection information, the option frame you construct might look like this:
connectInfoParms := {
type: 'option,
label: kCMOSerialIOParms,
opCode: opGetCurrent,
data: {
arglist: [
0, // parity placeholder
0, // stopBits placeholder
0, // dataBits placeholder
0, // bps placeholder
],
typelist: [
'struct,
'ulong,
'long,
© 2007-2024, o7 studio » при воспроизведении материала сайта ссылка обязательна