TComPort component version 1.71 for Delphi 2, 3, 4

-------------------------------------------------------
Written by Dejan Crnila, 1998-1999
e-mail: emilija.crnila@guest.arnes.si, dejan@macek.si

-------------------------------------------------------
TComPort component comes absolutely free with source
code. If you like or dislike this component, be sure to 
drop me an e-mail or if you find it very useful, i would
appriciate very much if you send me a post card to see
how far it has spread. My home address is:

Dejan Crnila
Dolenja vas 111
3312 Prebold
SLOVENIA

I hope that isn't too much to ask from you.

-------------------------------------------------------
TComPort is a component that encapsulates Win API serial
communication. Serial communication programming is one
of the most difficult and not very well documented area
in windows programming. Use of TComPort component makes
serial communication programming easier than ever. No 
knowledge of Win API needed.

-------------------------------------------------------
Contents
  1. Properties
  2. Events
  3. Methods
  4. Obsolete methods/properties
  5. Version history
  6. Other information

-------------------------------------------------------
1. Properties

  1.1. BaudRate
    Baud rate is a speed at which computer communicates
    with a serial device. 

  1.2. DataBits
    Number of data bits sent in one step. This is usually
    set to 8 bits.

  1.4. Events
    Set of events that serial device driver will monitor.
    Selecting only used events could gain some performance
    improvement.

  1.5. Parity
    Set parity to desired value to check for data errors.

  1.6. Port
    Com port number: 1, 2, 3 or 4.

  1.7. StopBits
    Number of stop bits that are sent or recieved after 
    data bits have arrived.

  1.8. ReadBufSize
    Size of the input buffer.

  1.9. WriteBufSize
    Size of the ouput buffer.

  1.10. FlowControl
    FlowControl is type of control for buffer overflow checking.
    Check DCB structure in Win32.hlp for more information

  1.11. Timeouts
    Timeouts object property handles timeout values for read/write
    operations. Check COMMTIMEOUTS structure in Win32.hlp for
    more information. 
    (Note: a value of -1 is MAXDWORD)

  1.12. Handle
    Handle property is used in WinAPI functions.

  1.13. Connected
    A read-only property that detects whether com port is opened.

  1.14. EventChar
    A charachter that triggers OnEvent event.

  1.15. SyncMethod
    SyncMethod should be set to smSynchronize or smWindow in GUI application
    and smWindow in WinNT 4.0 Service application. If you don't want the events
    to be triggered in the context of primary thread, set SyncMethod to smNone,
    but then you're responsible for thread synchronization.

  1.16. DiscardNull
    If set to true, TComPort discards all recieved null charachters.

  BaudRate, DataBits, StopBits, Parity, FlowControl should be
  synchronized with a serial device parameters.

-------------------------------------------------------
2. Events

  2.1. OnOpen
    OnOpen is triggered when com port is succesfully opened with
    Open method

  2.2. OnClose
    OnClose is triggered when com port is closed.

  2.3. OnRxChar
    This is the most used event. It is launched when a charachter(s)
    arrives in input buffer. InQue parameter is number of bytes 
    waiting in the input buffer.

  2.4. OnRxFlag
    OnRxChar is triggered when event charachter arrives.

  2.5. OnTxEmpty
    OnTxEmpty is Launched when ouput buffer is flushed.

  2.6. OnCTS, OnDSR, OnRLSD
    These events detect a change on CTS, DSR, RLSD signals.

  2.7. OnRing
    OnRing is triggered when a ring signal is detected. Used only
    with modems.

  2.8. OnError
    OnError is triggered when a line error ocurs.

  2.9. OnBreak
    OnBreak is triggered when a line break is detected. Input and
    output is suspended until break is cleared.

  2.10. OnRx80Full
    OnRx80Full is triggered when the input buffer is 80% full.
    Application should read all data from input buffer.

-------------------------------------------------------
3. Methods

Notes:
  Read/Write functions can be used in two modes: asynchronous or
synchronous. If the function is called in synchronous mode (WaitFor
paramater is set to True) the function waits until all data is transfered
or an error occurs. If the function is called in asynchronous mode (WaitFor 
set to False) function will probably end before all data is transfered.  
Application should call WaitForLastIO somewhere in code to get sure that 
all data is transfered and resources are cleaned.

Example of synchronous write operation:
  ComPort1.WriteString('Hello', True);

Example of asynchronous write operation:
  ComPort1.WriteString('Hello', False);
  // do some other processing here
  ComPort1.WaitForLastIO; // Make sure that operation is completed
			  // and resources are freed.


  3.1. procedure Open;
    Open method opens com port

  3.2. procedure Close;
    Close method closes com port

  3.3. function Write(var Buffer; Count: Integer; WaitFor: Boolean): Integer;
    Write method writes to com port ouput buffer. Buffer is data, which
    will be send to output buffer. Count is a number of bytes that will be
    send. Return value is number of actually written bytes.

  3.4. function WriteString(Str: String; WaitFor: Boolean): Integer;
    Similar to Write, but it sends a string to ouput buffer.

  3.5. function Read(var Buffer; Count: Integer; WaitFor: Boolean): Integer;
    Read method reads Count number of bytes and writes them do Buffer
    variable. Return value is number of actually read bytes.

  3.6. function ReadString(var Str: String; Count: Integer; WaitFor: Boolean): Integer;
    Similar to Read, but bytes are read into a variable of type String

  3.7. function WaitForLastIO: DWORD;
    Waits for last asynchronous opertaion do complete. Return value is 
    number of bytes transfered

  3.8. procedure AbortAllIO;
    Aborts all asynchrnous read/write operations

  3.9. function PendingIO: Boolean;
    Returns true if there's any asnychonous operation in progress

  3.8. procedure PurgeIn;
    PurgeIn clears input buffer and stops all input functions.

  3.9. procedure PurgeOut;
    PurgeOut clears ouput buffer and stops all ouput functions

  3.10. function InQue: Integer;
    InQue method returns number of bytes waiting in input buffer.

  3.11. function OutQue: Integer;
    OutQue method returns number of bytes waiting in ouput buffer
    for transmission.

  3.12. procedure HighCTS/DSR/RLSD;
    These methods return the state of CTS/DSR/RLSD signals.
    True for high state and False for low state.

  3.13. procedure ShowPropForm;
    Shows ComPort setup form

  3.14. procedure SetDTR(State: Boolean);
    Changes the state of Dtr signal
      State : True - On
              False - Off

  3.15. procedure SetRTS(State: Boolean);
    Changes the state of Rts signal

  3.16. procedure SetBreak(State: Boolean);
    Sets or clears break signal

  3.17. procedure SetXonXoff(State: Boolean);
    State: True - transmission acts as Xon has been recieved
           False - transmission acts as Xoff has been recieved

-------------------------------------------------------
4. Obsolote methods/properties

  4.1. GetComHandle
    GetComHandle function is replaced with Handle property

  4.2. EnableDTR
    EnableDTR property is now included in FlowControl property
    as ControlDTR property

  4.3. PurgeIn and PurgeOut
    These methods are replace with AbortAllIO procedure

-------------------------------------------------------
5. Version history

1.71 (27.05.1999)
  A bug fix!

1.70 (28.04.1999)
  New methods: SetDTR, SetRTS, SetBreak, SetXonXoff
  Properties can be changed during a session

1.60 (10.04.1999)
  New properties: EventChar, DiscardNull, SyncMethod
  Extended Parity property
  Fixed compilation problems
  Other bug fixes

1.50 (13.03.1999)
  Read/Write operations in asynchronous/synchronous mode
  Added OnRx80Full event
  Extended flow control 
  Added Timeouts property

1.01 (24.10.1998)
  Added more signal detection functions.
  Added this documentation.
  Added PurgeOut function.
  Fixed some minor bugs.

1.00 (29.09.1998)
  Basic version of the component

-------------------------------------------------------
6. Other information

This component is a freeware. You are allowed to distribute it, however,
you are not allowed do change the code for distribution.
