This is MiscSerialPort.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. // 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. // // Note: The following possible problem is reported by Carl Lindberg // (lindberg@BLaCKSMITH.com) /* He [Mike Hovan] also had a very funky problem with MiscSerialPort. Whenever DPSRemoveFd() was called, the program would hang -- until some (any) other event happened, at which point the program would continue merrily on its way. He showed me -- the program would hang, he would hit the shift key, and the program would continue. His solution was to stick a dummy event into the queue right before any call to DPSRemoveFd(). And this worked. !?!?! This could be something particular to his setup; I can't believe no one else noticed this before if it was a common problem. */ #import <appkit/appkit.h> #import <sgtty.h> #define MISC_NO_PARITY 0 #define MISC_ODD_PARITY 1 #define MISC_EVEN_PARITY 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 @interface MiscSerialPort:Object { char portName[64]; // path to port device BOOL connected; // YES if port open BOOL suspended; // YES if port is suspended int fd; // file descriptor when open id delegate; // who do we send data to? int currentBaud; // current baud rate int currentParity; // current parity } - init; // initialize defaults - setDeviceName: (const char *)name; // set device name to open - setBaud: (int)baud; // set port baudrate - setBaudByName: (const char *)speed; // set by speed string - setParity: (int)parity; // set parity - dropDTR; - raiseDTR; - (BOOL)connect; // connect with current parameters - disconnect; // disconnect from current port - setDelegate: theConsumer; // who gets received data - delegate; // return current consumer - transmitChars: (const char *)buffer // transmit a stream of data length: (int)length; - suspend; // - continue; // ** obsolete ** - resume; - (BOOL)suspended; - (int)filedes; - free; @end @interface Object(MiscSerialPortDelegate) - receiveChars: (char *)buffer length: (int)length; - hangup; @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.