home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / MiscKit1.2.6 / Headers / misckit / MiscSerialPort.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-15  |  1.9 KB  |  67 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 2.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.  
  14. #import <appkit/appkit.h>
  15. #import    <sgtty.h>
  16.  
  17. #define MISC_NO_PARITY        0
  18. #define MISC_ODD_PARITY        1
  19. #define MISC_EVEN_PARITY    2
  20.  
  21. #ifndef B19200            // added for 3.0 systems by Don
  22. #define B19200 EXTA
  23. #endif
  24.  
  25. #ifndef B38400            // added for 3.0 systems by Don
  26. #define B38400 EXTB
  27. #endif
  28.  
  29. @interface MiscSerialPort:Object
  30. {
  31.     char            portName[64];        // path to port device
  32.     BOOL            connected;            // YES if port open
  33.     BOOL            suspended;            // YES if port is suspended
  34.     int                fd;                    // file descriptor when open
  35.     id                delegate;            // who do we send data to?
  36.     int                currentBaud;        // current baud rate
  37.     int                currentParity;        // current parity
  38. }
  39.  
  40. - init;                                    // initialize defaults
  41. - setDeviceName: (const 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: (const char *)buffer    // transmit a stream of data
  52.     length: (int)length;
  53. - suspend;
  54. // - continue;                            // ** obsolete **
  55. - resume;
  56. - (BOOL)suspended;
  57. - (int)filedes;
  58.     
  59. @end
  60.  
  61. @interface Object(MiscSerialPortDelegate)
  62.  
  63. - receiveChars: (char *)buffer length: (int)length;
  64. - hangup;
  65.  
  66. @end
  67.