home *** CD-ROM | disk | FTP | other *** search
- //
- // MiscSerialPort.h -- an OO wrapper around the serial ports
- // Written by Matt Brandt Copyright (c) 1994 by Matt Brandt.
- // Version 1.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 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
- DPSTimedEntry tentry; // timed entry tag
- }
-
- - init; // initialize defaults
- - setDeviceName: (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: (char *)buffer // transmit a stream of data
- length: (int)length;
- - suspend;
- - continue;
- - (BOOL)suspended;
- - (int)filedes;
-
- @end
-
- @interface Object(MiscSerialPortDelegate)
-
- - receiveChars: (char *)buffer length: (int)length;
- - hangup;
-
- @end
-