ftp.nice.ch/pub/next/developer/resources/classes/misckit/MiscKit.1.10.0.s.gnutar.gz#/MiscKit/Temp/MiscSerialPort2.h

This is MiscSerialPort2.h in view mode; [Download] [Up]

/*
MiscSerialPort.h -- an OO wrapper around the serial ports
Written by Matt Brandt Copyright (c) 1994 by Matt Brandt.
Modified by Arnaud Meuret
Version 2.0.  All rights reserved.
This notice may not be removed from this source code.

	This object is included in the MiscKit by permission from the author
	and its use is governed by the MiscKit license, found in the file
	"LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
	for a list of all applicable permissions and restrictions.
______________________________________________________________________________*/

#import <appkit/appkit.h>
#import	<sgtty.h>
	
#define DEVICE_PATH_LEN			64

#define MISC_SP_NONE			0
#define MISC_SP_ODD				1
#define MISC_SP_EVEN			2

#define MISC_SP_COOKED			0
#define MISC_SP_CBREAK			1
#define MISC_SP_RAW				2

#define MISC_SP_OK				0
#define MISC_SP_NO_DEVICE		1
#define MISC_SP_CANT_LOCK		2
#define MISC_SP_NOT_OPEN		4
#define MISC_SP_SEE_ERRNO		8
#define MISC_SP_OTHER			128

#define MISC_SP_NOFC			0
#define MISC_SP_HARDFC			1
#define MISC_SP_SOFTFC			2

#ifndef B19200			// added for 3.0 systems by Don
#define B19200 EXTA
#endif

#ifndef B38400			// added for 3.0 systems by Don
#define B38400 EXTB
#endif

#ifndef UBYTE
#define UBYTE unsigned char
#endif

@interface MiscSerialPort:Object
{
	char		device[DEVICE_PATH_LEN+1];// path to port device
	int			portFD;					// file descriptor when open
	id			delegate;				// who do we send data to?
	id			miscLock	;			// MiscLockFile instance
// Warning:  bitfields are a NO-NO for endian troubles.  Let's
//   go with BOOLs before we actually put this in the kit!!!
	struct
	{
		BOOL		connected:1;		// YES if port open
		BOOL		suspended:1;		// YES if communication is suspended
		BOOL		hardwareFC:1;		// if using CTS/RTS flow control
	}			flags;
	struct sgttyb	ttyParms;			// basic port parameters
	struct tchars	specChars;			// special characters
	int				locMode;			// local mode word
	struct ltchars	locSpecChars;		// local special characters
	unsigned char	status;				// result of last request
}

- init;									// initialize defaults
- free;									// cleanup and Zap-O-Blast ourselves
- setDeviceName:(const char *)name;		// set device name to open
- setBaud:(int) baud;					// set port baudrate
- setBaudByName:(const char *)name;		// set by speed string
- setFlowControl:(int)method;			// choose flow control method
- setParity:(int)parity;				// set parity
- setMode:(int)mode;					// set processing mode
- translateNL: (BOOL)yesNo;				// set NL translation
- setEchoing: (BOOL)yesNo;				// set echoing of incomming chars
- setDelegate: theConsumer;				// who gets received data

//PERFORMERS =================================
- (BOOL)connect;						// connect with current parameters
- disconnect;							// disconnect from current port
- discardPendingInput;					// flush input buffer
- discardPendingOutput;					// flush output buffer
- dropDTR;
- raiseDTR;
- transmitChars:(const char *) length:(int);	// transmit a stream of data
- suspendIO;
- resumeIO;
- clearStatus;
- (BOOL)dataAvailable;
- (BOOL) deviceIsAvailable;

//ACCESSORS =================================
- delegate;								// return current consumer
- (const char*) deviceName;				// get device name
- (int) fileDescriptor;
- (int) status;
- (int) flowControl;
- (int) parity;
- (int) mode;
- ( int ) baudRate;
- (const char*) statusString;
- (BOOL) doesTranslateNL;
- (BOOL)isSuspended;
- (BOOL) isConnected;
- (BOOL) isEchoing;
- (BOOL) isLocked;

	
@end

//DELEGATE ===================================
@interface Object(MiscSerialPortDelegate)

- receiveChars: (char *) length: (int);
- hangup;

@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.