Class T_QCCom32 (unit QCCom32)

Inherits from

TComponent

ComPort class

Constructors


constructor Create(AOwner: TComponent);

Public declarations } { Methods

Component constructor



Functions

procedure Close;

Close the COM port

destructor Destroy;

Component destructor

procedure Flush;

Flush the port by reading any characters in the queue

function Open: Boolean;

Opens the COM port, returns True if ok

procedure Pick;

Pops a dialog to pick the COM port number

function Read: String;

Reads a string from the port, puts it into pchBuffer, returns the number of characters read

function Write(const sData: String): Boolean;

Write a string out the COM port, return true if all chars written

procedure Timeout;

Protected declarations

Timeout event - user assigned code


function GetInCount: LongInt;

Return the number of bytes waiting in the queue

function GetTimeout: LongInt;

Get the current timeout setting

function IsOpen: Boolean;

Return True if port is open

procedure SetBaud(lBaudToSet: LongInt);

Set the baud rate property

procedure SetPort(nPortToSet: Integer);

Set the Port property

procedure SetTimeout(lTimeout: LongInt);

timeout event } { functions

Set the Timeout property to the specified milliseconds


procedure TimesUp(Sender: TObject);

Timer procedure - signals a timeout

Properties

property Baud : LongInt

baud rate

property EndOfResponse : String

string to signal end of input from external device

property InCount : LongInt

number of characters received

property InUse : Boolean

flag indication if port is blocked

property Opened : Boolean

flag indicating if port is open

property Port : Integer

COM port

property ResponseTime : LongInt

Published declarations } { timeout for waiting for a response, in mS

property ShowErrors : Boolean

flag to enable showing error message boxes

property TimedOut : Boolean

flag set when a timeout occured

Events

event OnTimeout : TNotifyEvent

timeout event

Variables

boolExpired : Boolean;

response terminator string

boolInUse : Boolean;

true to enable error boxes

boolShowErrors : Boolean;

dialog box to pick a port

formPickCom : TformPickCom;

timeout timer

hPort : LongInt;

Private declarations

lBaud : LongInt;

port #, 1-based

nPort : Integer;

handle from OpenComm

pmOnTimeout : TNotifyEvent;

true while port is blocked, waiting for response } { Events (method pointers) user can assign code to these

sInTerminator : String;

baud rate

Timer : TTimer;

set true when a timeout occurs


Constructors


constructor Create(AOwner: TComponent);

Public declarations } { Methods

Component constructor


Functions


procedure Close;

Close the COM port


destructor Destroy;

Component destructor


procedure Flush;

Flush the port by reading any characters in the queue


function Open: Boolean;

Opens the COM port, returns True if ok


procedure Pick;

Pops a dialog to pick the COM port number


function Read: String;

Reads a string from the port, puts it into pchBuffer, returns the number of characters read


function Write(const sData: String): Boolean;

Write a string out the COM port, return true if all chars written


procedure Timeout;

Protected declarations

Timeout event - user assigned code


function GetInCount: LongInt;

Return the number of bytes waiting in the queue


function GetTimeout: LongInt;

Get the current timeout setting


function IsOpen: Boolean;

Return True if port is open


procedure SetBaud(lBaudToSet: LongInt);

Set the baud rate property


procedure SetPort(nPortToSet: Integer);

Set the Port property


procedure SetTimeout(lTimeout: LongInt);

timeout event } { functions

Set the Timeout property to the specified milliseconds


procedure TimesUp(Sender: TObject);

Timer procedure - signals a timeout


Properties


property Baud : LongInt

baud rate


property EndOfResponse : String

string to signal end of input from external device


property InCount : LongInt

number of characters received


property InUse : Boolean

flag indication if port is blocked


property Opened : Boolean

flag indicating if port is open


property Port : Integer

COM port


property ResponseTime : LongInt

Published declarations } { timeout for waiting for a response, in mS


property ShowErrors : Boolean

flag to enable showing error message boxes


property TimedOut : Boolean

flag set when a timeout occured


Events


event OnTimeout : TNotifyEvent

timeout event


Variables


boolExpired : Boolean;

response terminator string


boolInUse : Boolean;

true to enable error boxes


boolShowErrors : Boolean;

dialog box to pick a port


formPickCom : TformPickCom;

timeout timer


hPort : LongInt;

Private declarations


lBaud : LongInt;

port #, 1-based


nPort : Integer;

handle from OpenComm


pmOnTimeout : TNotifyEvent;

true while port is blocked, waiting for response } { Events (method pointers) user can assign code to these


sInTerminator : String;

baud rate


Timer : TTimer;

set true when a timeout occurs