home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / pascal / library / dos / communic / osio / osio.hdr < prev    next >
Encoding:
Text File  |  1991-03-05  |  7.1 KB  |  179 lines

  1. UNIT OSIO;
  2.  
  3. INTERFACE
  4. uses CRT, DOS;
  5.  
  6. {
  7.  This Unit contains the Object SERIAL_IO.  SERIAL_IO has the following
  8.  methods available to it:
  9.  
  10. Open_Port(Port_Number : Byte;
  11.            Baud_Rate:    Integer;
  12.            Bits:         Byte;
  13.            Stop_Bits:    Byte;
  14.            Parity:       Char) - Initalizes the selected Com Port, installs
  15.                                  an interrupt driver to send and receive
  16.                                  characters from that port.
  17.                                  Parity can be set in three ways:
  18.                                  'O' : Odd Parity
  19.                                  'E' : Even Parity
  20.                                  'N' : No Parity
  21.                                  Returns TRUE if port was correctly opened,
  22.                                  FALSE if the port could not be opened.
  23.  
  24.  Close_Port(Port_Number : Byte) - Closes the selected Com Port, and removes
  25.                                   the interrupt driver installed by Open_Port.
  26.                                   Returns TRUE if the port was closed, FALSE
  27.                                   if the port could not be closed.
  28.  
  29.  Carrier_Status(Port_Number : Byte) - Returns TRUE if Carrier is detected,
  30.                                       FALSE if no Carrier is detected.
  31.  
  32.  Get_Character(Port_Number : Byte;
  33.            var Character   : Char) - Returns TRUE if character received, or
  34.                                      FALSE if there was an error.  Returns
  35.                                      character received in Character.
  36.  
  37.  Send_Character(Port_Number : Byte;
  38.                 Character   : Char) - Sends the specified character out the
  39.                                       specified port.  Always returns TRUE.
  40.  
  41.  Query_Buffer(Port_Number : Byte) - Returns TRUE if the buffer contains characters, FALSE if
  42.                                     empty.
  43.  
  44.  The interrupt routine which Open_Port installs has a 1K input buffer.
  45.  
  46.  BE SURE TO ALWAYS USE CLOSE_PORT before your program terminates.
  47.  
  48.  Due to the nature of Object Oriented Programming, you should have no need
  49.  to directly change any of the variables or Methods associated with this
  50.  unit.  Tampering with any of them may render the unit unusable due to the
  51.  delicate nature of all I/O procedures, and especially those which rely on
  52.  Interrupts.
  53.  
  54.  This unit is Copyright <C> February 16th, 1990 by Ryan S. Dancey
  55.  No restrictions on the use of this package have been made.  However,
  56.  if you find it of value, please be sure to pass it on to any source you
  57.  deem needful!
  58. }
  59.  
  60. type
  61.  Serial_Port = Object
  62.   Function Open_Port(Port_Number : Byte;
  63.                      Baud_Rate:    Word;
  64.                      Bits:         Byte;
  65.                      Stop_Bits:    Byte;
  66.                      Parity:       Char) : Boolean;
  67.  
  68.   Function Close_Port(Port_Number : Byte) : Boolean;
  69.    Private
  70.     Function SET_INTERRUPTS(Port_Number : Byte) : Boolean;
  71.     Procedure CANCEL_INTERRUPTS(Port_Number : Byte);
  72.     Function IS_PORT_OPEN(Port_Number : Byte) : Boolean;
  73.     Procedure MARK_PORT_OPEN(Port_Number : Byte);
  74.     Procedure MARK_PORT_CLOSED(Port_Number : Byte);
  75.  end;
  76.  
  77.  Serial_Utilities = Object(Serial_Port)
  78.   Function Carrier_Status(Port_Number : Byte) : Boolean;
  79.  end;
  80.  
  81.  Serial_IO = Object(Serial_Utilities)
  82.   Function Get_Character(Port_Number : Byte;
  83.                      var Character   : Char) : Boolean;
  84.   Function Send_Character(Port_Number : Byte;
  85.                           Character  : Char) : Boolean;
  86.   Function Query_Buffer(Port_Number : Byte) : Boolean;
  87.  end;
  88.  
  89.  
  90. UNIT OSIO;
  91.  
  92. INTERFACE
  93. uses CRT, DOS;
  94.  
  95. {
  96.  This Unit contains the Object SERIAL_IO.  SERIAL_IO has the following
  97.  methods available to it:
  98.  
  99. Open_Port(Port_Number : Byte;
  100.            Baud_Rate:    Integer;
  101.            Bits:         Byte;
  102.            Stop_Bits:    Byte;
  103.            Parity:       Char) - Initalizes the selected Com Port, installs
  104.                                  an interrupt driver to send and receive
  105.                                  characters from that port.
  106.                                  Parity can be set in three ways:
  107.                                  'O' : Odd Parity
  108.                                  'E' : Even Parity
  109.                                  'N' : No Parity
  110.                                  Returns TRUE if port was correctly opened,
  111.                                  FALSE if the port could not be opened.
  112.  
  113.  Close_Port(Port_Number : Byte) - Closes the selected Com Port, and removes
  114.                                   the interrupt driver installed by Open_Port.
  115.                                   Returns TRUE if the port was closed, FALSE
  116.                                   if the port could not be closed.
  117.  
  118.  Carrier_Status(Port_Number : Byte) - Returns TRUE if Carrier is detected,
  119.                                       FALSE if no Carrier is detected.
  120.  
  121.  Get_Character(Port_Number : Byte;
  122.            var Character   : Char) - Returns TRUE if character received, or
  123.                                      FALSE if there was an error.  Returns
  124.                                      character received in Character.
  125.  
  126.  Send_Character(Port_Number : Byte;
  127.                 Character   : Char) - Sends the specified character out the
  128.                                       specified port.  Always returns TRUE.
  129.  
  130.  Query_Buffer(Port_Number : Byte) - Returns TRUE if the buffer contains characters, FALSE if
  131.                                     empty.
  132.  
  133.  The interrupt routine which Open_Port installs has a 1K input buffer.
  134.  
  135.  BE SURE TO ALWAYS USE CLOSE_PORT before your program terminates.
  136.  
  137.  Due to the nature of Object Oriented Programming, you should have no need
  138.  to directly change any of the variables or Methods associated with this
  139.  unit.  Tampering with any of them may render the unit unusable due to the
  140.  delicate nature of all I/O procedures, and especially those which rely on
  141.  Interrupts.
  142.  
  143.  This unit is Copyright <C> February 16th, 1990 by Ryan S. Dancey
  144.  No restrictions on the use of this package have been made.  However,
  145.  if you find it of value, please be sure to pass it on to any source you
  146.  deem needful!
  147. }
  148.  
  149. type
  150.  Serial_Port = Object
  151.   Function Open_Port(Port_Number : Byte;
  152.                      Baud_Rate:    Word;
  153.                      Bits:         Byte;
  154.                      Stop_Bits:    Byte;
  155.                      Parity:       Char) : Boolean;
  156.  
  157.   Function Close_Port(Port_Number : Byte) : Boolean;
  158.    Private
  159.     Function SET_INTERRUPTS(Port_Number : Byte) : Boolean;
  160.     Procedure CANCEL_INTERRUPTS(Port_Number : Byte);
  161.     Function IS_PORT_OPEN(Port_Number : Byte) : Boolean;
  162.     Procedure MARK_PORT_OPEN(Port_Number : Byte);
  163.     Procedure MARK_PORT_CLOSED(Port_Number : Byte);
  164.  end;
  165.  
  166.  Serial_Utilities = Object(Serial_Port)
  167.   Function Carrier_Status(Port_Number : Byte) : Boolean;
  168.  end;
  169.  
  170.  Serial_IO = Object(Serial_Utilities)
  171.   Function Get_Character(Port_Number : Byte;
  172.                      var Character   : Char) : Boolean;
  173.   Function Send_Character(Port_Number : Byte;
  174.                           Character  : Char) : Boolean;
  175.   Function Query_Buffer(Port_Number : Byte) : Boolean;
  176.  end;
  177.  
  178.  
  179.