Library Documentation, Copyright ã 1993 Looking Glass Design, Inc.
LGDCommunicationKit Release 1.0 (prerelease)
Project Manager:  Paul Girone
Written by: Mike Gobbi, June 24/1993 (11:07 am)
$Revision: 1.3 $

LGDAppSerialPort

Inherits From:	LGDSerialPort : Object 

Declared In:	LGDAppSerialPort.h

Class Description

The LGDAppSerialPort class extends the LGDSerialPort class to provide functionality for an event-driven application.  Using the AppKit's event routines, the LGDAppSerialPort catches ªdata availableº events from the serial port and sends out a target-action message, much as the Button class does when a button is clicked upon.

When data appears at the serial port, the LGDAppSerialPort will attempt to send an action message to its target, or to the first responder if no target was specified.  At the time that the message is sent, no data has been read from the port.  This message will be sent every time through the event loop ± just before the usual event messages have been distributed ± until the data has been read from the port.

See also:  LGDSerialPort

Instance Variables

id target;
SEL action;

delegate	An object which assists with serial port operations.
target	Target to be notified when data is available.
action	Action message to be sent when data is available.

Method Types

Factory	- init

Outlets	- setTarget:
	- setAction:
	- target
	- action

Actions	- openAndLock:
	- unlockAndClose:
	- sendBreak:
	- sendDisconnect:

Connections	- openWithTimeout:
	- close

Events	- portEvent

Archiving	- write:
	- read:

Instance Methods

- action
- (SEL)action

Returns the action message sent sent to the target when data becomes available at the serial port.

See also:  - setAction:

- close
- close

Closes the serial port, and notifies the Application object that the reciever is no longer interested in serial port events.

See also:  - openWithTimeout:, - close (LGDSerialPort)

- init
- init

Initializes and returns the reciever, a newly-allocated LGDAppSerialPort instance.

- openWithTimeout:
- openWithTimeout:(int)seconds

Opens the serial port and notifies the Application object that the reciever would like to be notified of any events at the serial port.

See also:  - close, - open (LGDSerialPort)

- openAndLock:
- openAndLock:sender

Opens the device in COOKED mode.  If the open fails, an alert panel is popped up.

See also:  - openAndLockDevice:mode:timeout: (LGDSerialPort), - serialPortWillOpen: (delegate), - serialPortDidOpen: (delegate)

- portEvent
- portEvent

This method is invoked automatically whenever there is data available to be read at the serial port ± you should never send a portEvent message directly to the reciever.

Sends a the action message to the target, or to the first responder if there is no target set.  If there is no action set, this method does nothing.  Returns self.

See also:  

- read:
- read:(NXTypedStream *)stream

Archives the reciever from stream.

See also:  - write:

- sendBreak:
- sendBreak:sender

Sends a break signal through the modem.  This is equivalent to hitting control-C on a terminal

See also:  - raiseBreak (LGDSerialPort), - lowerBreak (LGDSerialPort)

- sendDisconnect:
- sendDisconnect:sender

Breaks the modem's connection with the foreign machine.

See also:  - lowerDTR (LGDSerialPort), - raiseDTR (LGDSerialPort), - serialPortWillDisconnect: (delegate), - serialPortDidDisconnect: (delegate)

- setAction:
- setAction:(SEL)anAction

Sets anAction to be the message that will be sent to the target/FirstResponder when data becomes available at the serial port.  If anAction is NULL, then no messages will be sent.  Returns self.

See also:  - action, - portEvent

- setTarget:
- setTarget:anObject

Sets anObject to be the object that will be sent action messages when data comes available at the serial port.  If anObject is null, then the action messages will be sent to FirstResponder.

See also:  - target, - portEvent

- target
- target

Returns the object that will be sent an action message when data becomes available at the serial port, or nil if action messages are to be sent to FirstResponder.

See also:  - setTarget:, - portEvent

- unlockAndClose:
- unlockAndClose:sender

Breaks the modem's connection with the foreign machine, then unlocks and closes the device.

See also:  - unlockAndClose (LGDSerialPort)

- write:
- write:(NXTypedStream *)stream

Unarchives the reciever from stream.

See also:  - read:

Methods Implemented by the delegate

serialPortWillClose:
- serialPortWillClose:sender

Performs any actions necessary prior to the serial port closing.   If this method returns nil, then the port will not be closed.

See also:  - unlockAndClose:

serialPortWillDisconnect:
- serialPortWillDisconnect:sender

Performs any actions necessary prior disconnecting from the remote machine.   If this method returns nil, then the disconnection will not take place.

See also:  - sendDisconnect:

serialPortWillOpen:
- serialPortWillOpen:sender

Performs any actions necessary prior to opening the serial port.   If this method returns nil, then the port will not be opened.  If this method changes the device used by sender, then the new device will be the one connected to.

See also:  - openAndLock:

serialPortDidClose:
- serialPortDidClose:sender

Performs any actions necessary after the closing of the serial port.

See also:  - unlockAndClose:

serialPortDidDisconnect:
- serialPortDidDisconnect:sender

Performs any actions necessary after disconnecting from the remote machine.

See also:  - sendDisconnect:

serialPortDidOpen:
- serialPortDidOpen:sender

Performs any actions necessary after opening the serial port.   Any configuration code should be placed in this method.

See also:  - openAndLock: