beautypg.com

Protos 23 – Apple Newton Programmer’s Newton 2.0 (for Newton 2.0) User Manual

Page 856

background image

C H A P T E R 2 3

Endpoint Interface

23-28

Summary of the Endpoint Interface

filter: { // used to filter incoming data

byteProxy: [{ // an array of frames

byte:

char

, // char or byte to replace

proxy: char // replacement char or byte, or nil
}, ...],

sevenBit:

Boolean

// strip high-order bit

},

rcvOptions: [], // array of options, or a single frame
partialFrequency:

integer

,// freq, in milliseconds, to call

// PartialScript

InputScript: // called when input is terminated

func(

endpoint

,

data

,

terminator

,

options

)...,

PartialScript: // called at partialFrequency interval

func(

endpoint

,

data

)...,

CompletionScript: // called on unexpected completion

func(

endpoint

,

options

,

result

)...,

}

Protos

23

protoBasicEndpoint

23

myEndpoint := {
_proto: protoBasicEndpoint, // proto endpoint
encoding:

integer

,//encoding table,default=kMacRomanEncoding

Instantiate: // instantiates endpoint object

func(

endpoint

,

options

) ...,

Bind: // binds endpoint to comm tool

func(

options

,

callbackSpec

) ...,

UnBind: // unbinds endpoint from comm tool

func(

options

,

callbackSpec

) ...,

Dispose: // disposes endpoint object

func(

options

,

callbackSpec

) ...,

Connect: // establishes connection

func(

options

,

callbackSpec

) ...,

Listen: // passively listens for connection

func(

options

,

callbackSpec

) ...,

Accept: // accepts connection

func(

options

,

callbackSpec

) ...,

Disconnect: // disconnects

func(

cancelPending

,

callbackSpec

) ...,

Output: // sends data

func(

data

,

options

,

outputSpec

) ...,

SetInputSpec: // sets input spec

func(

inputSpec

)...,