beautypg.com

Infrared tool 24 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 866

background image

C H A P T E R 2 4

Built-in Communications Tools

24-8

Infrared Tool

Infrared Tool

24

You use the infrared (IR) communications tool to perform half-duplex infrared
communications. Since the infrared tool does not support full-duplex communica-
tions, you cannot activate an input specification and expect to output data.

The infrared tool supports packetized data, which means that an endpoint can
include

kPacket

,

kEOP

, and

kMore

flags to control sending and receiving framed

(packetized) data. For more information on these flags, see “Sending Data”
(page 23-11).

The following is an example of how to create an endpoint that uses the infrared
communications tool:

myIrEP := {_proto:protoBasicEndpoint};

myOptions := [

{ label: kCMSSlowIR,

type: 'service,

opCode: opSetRequired }

];

returnedoptions:= myIrEP:Instantiate(myIrEP, myOptions);

The infrared tool supports three options, which are summarized in Table 24-5.
These options are described in detail in “Options for the Infrared Tool”
(page 21-65) in Newton Programmer’s Reference.

Table 24-5

Summary of Infrared Options

Label

Value

Use when

Description

kCMOSlowIRConnect

“irco”

When initiating,
connecting, or
listening

Controls how the
connection is made

kCMOSlowIRProtocolType

“irpt”

After connecting
or accepting

Read-only option returns
the protocol and speed of
the connection

kCMOSlowIRStats

“irst”

After connecting
or accepting

Read-only option returns
statistics about the data
received and sent