beautypg.com

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

Page 867

background image

C H A P T E R 2 4

Built-in Communications Tools

AppleTalk Tool

24-9

The infrared tool uses the Sharp Infrared protocol. Because of the characteristics of
this protocol, Apple recommends setting

sendFlags

to

kPacket

and to

kEOP

every time you send data. For more information on

sendFlags

see, “Sending

Data” (page 23-11).

If you don’t set

sendFlags

as recommended above, the tool only sends data after

it queues 512 bytes of data, which means that input scripts do not terminate as you
might expect. On the receiving side, the queuing means you terminate after every
output if you set

useEOP

to

true

. If you are using

byteCount

, you should set

useEOP

to

nil

to trigger on

byteCount

instead of

EOP

. For more information on

useEOP

and

byteCount

, see “Specifying Data Termination Conditions”

(page 23-14).

AppleTalk Tool

24

The AppleTalk tool enables access to the ADSP (Apple Data Stream Protocol
component of the AppleTalk protocol stack.

The following is an example of how to create an AppleTalk endpoint:

myATalkEP := {_proto:protoBasicEndpoint};

myOptions := [

{ label: kCMSAppleTalkID,

type: 'service,

opCode: opSetRequired

},

{ label: kCMSAppleTalkID,

type: 'option,

opCode: opSetRequired,

data:

{ arglist: ["adsp"],// or KCMOAppleTalkADSP

typelist:[

'struct

['array, 'char, 4]

]

}

},

{ label: kCMOEndpointName,

type: 'option,

opCode: opSetRequired,

data: { arglist: [kADSPEndpoint],

typelist:[

'struct

['array, 'char, 0]

]