home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1994 June / NEBULA_SE.ISO / SourceCode / MiscKit / Headers / misckit / MiscSerialPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-03-23  |  1.9 KB  |  66 lines

  1. //
  2. //    MiscSerialPort.h -- an OO wrapper around the serial ports
  3. //        Written by Matt Brandt Copyright (c) 1994 by Matt Brandt.
  4. //                Version 1.0.  All rights reserved.
  5. //        This notice may not be removed from this source code.
  6. //
  7. //    This object is included in the MiscKit by permission from the author
  8. //    and its use is governed by the MiscKit license, found in the file
  9. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  10. //    for a list of all applicable permissions and restrictions.
  11. //    
  12.  
  13. #import <appkit/appkit.h>
  14. #import    <sgtty.h>
  15.  
  16. #define MISC_NO_PARITY        0
  17. #define MISC_ODD_PARITY        1
  18. #define MISC_EVEN_PARITY    2
  19.  
  20. #ifndef B19200            // added for 3.0 systems by Don
  21. #define B19200 EXTA
  22. #endif
  23.  
  24. #ifndef B38400            // added for 3.0 systems by Don
  25. #define B38400 EXTB
  26. #endif
  27.  
  28. @interface MiscSerialPort:Object
  29. {
  30.     char            portName[64];        // path to port device
  31.     BOOL            connected;            // YES if port open
  32.     BOOL            suspended;            // YES if port is suspended
  33.     int                fd;                    // file descriptor when open
  34.     id                delegate;            // who do we send data to?
  35.     int                currentBaud;        // current baud rate
  36.     int                currentParity;        // current parity
  37.     DPSTimedEntry    tentry;                // timed entry tag
  38. }
  39.  
  40. - init;                                // initialize defaults
  41. - setDeviceName: (char *)name;        // set device name to open
  42. - setBaud: (int)baud;                // set port baudrate
  43. - setBaudByName: (const char *)speed;    // set by speed string
  44. - setParity: (int)parity;            // set parity
  45. - dropDTR;
  46. - raiseDTR;
  47. - (BOOL)connect;                    // connect with current parameters
  48. - disconnect;                        // disconnect from current port
  49. - setDelegate: theConsumer;            // who gets received data
  50. - delegate;                            // return current consumer
  51. - transmitChars: (char *)buffer        // transmit a stream of data
  52.     length: (int)length;
  53. - suspend;
  54. - continue;
  55. - (BOOL)suspended;
  56. - (int)filedes;
  57.     
  58. @end
  59.  
  60. @interface Object(MiscSerialPortDelegate)
  61.  
  62. - receiveChars: (char *)buffer length: (int)length;
  63. - hangup;
  64.  
  65. @end
  66.