pcomdrv.dll

Classes:

Index

Common index


Class ComStat

#module root.communication.serial
The ComStat is designed to transmit the port state to the program.
Fields and their values:
	CtsHold		- Tx waiting for CTS signal (boolean)
	DsrHold		- Tx waiting for DSR signal (boolean)
	RlsdHold	- Tx waiting for RLSD signal (boolean)
	XoffHold	- Tx waiting, XOFF char rec'd (boolean)
	XoffSent	- Tx waiting, XOFF char sent (boolean)
	Eof		- EOF character sent (boolean)
	Txim		- character waiting for Tx (boolean)
	bInQue		- bytes in input buffer (int)
	bOutQue		- bytes in output buffer (int)
	Error		- last error (object String)
Meaning of Error String :
"BREAK"		- The hardware detected a break condition.
"FRAME"		- The hardware detected a framing error.
"IOE"		- An I/O error occurred during communications with 
		the device.
"MODE"		- The requested mode is not supported, or the hFile 
		parameter is invalid. If this value is specified, it 
		is the only valid error.
"OVERRUN"	- A character-buffer overrun has occurred. The next 
		character is lost.
"RXOVER"	- An input buffer overflow has occurred. There is 
		either no room in the input buffer, or a character 
		was received after the end-of-file (EOF) character.
"RXPARITY"	- The hardware detected a parity error.
"TXFULL"	- The application tried to transmit a character, but 
		the output buffer was full.

Class PComDrv

The PComDrv class provides interaction 
with computer serial ports.
0 - COM1
1 - COM2
2 - COM3
3 - COM4
.....
Attributes and their values:
	BaudRate - port performance speed (int)
	Binary - binary transmission (boolean)
	CheckParity - parity check flag (boolean) 
	OutxCtsFlow - CTS (Clear To Send) check during transmission (boolean). 
				If TRUE and CTS is cleared, then transmission 
				is stopped until resetting the CTS.
	OutxDsrFlow - DSR (Data Set Ready) check during transmission (boolean)
				If TRUE and DSR is cleared, then transmission 
				is stopped until resetting the DSR.
	DtrControl - DTR (Data Terminal Ready) check. The following 
			values are available 
			DTR_CONTROL_DISABLE	- Clearing the DTR line 
			when opening the device.
			DTR_CONTROL_ENABLE	- Setting the DTR line 
			when opening the device.
			DTR_CONTROL_HANDSHAKE -	Using the DTR for 
			transmission control.
	DsrSensitivity - DSR (Data Set Ready) check during receive (boolean).
				If TRUE and DSR is cleared, then any input 
				byte is ignored until resetting the DSR.
	TXContinueOnXoff - transmission termination when the receive 
buffer is filled (boolean).
	OutX - use Xonn/Xoff during transmission (boolean).
	InX - use Xonn/Xoff during receive (boolean).
	RtsControl - RTS (Request To Send) check. The following 
			values are available 
			RTS_CONTROL_DISABLE -	Clearing the RTS line 
			when opening the device.
			RTS_CONTROL_ENABLE	-	Setting the RTS line 
			when opening the device.
			RTS_CONTROL_HANDSHAKE - Using the RTS for 
			transmission control.
			The RTS line is set when the receive buffer is more 
			than half empty and cleared when it is more than 
			3/4 full.
			RTS_CONTROL_TOGGLE - Indicates the RTS line is set 
			if there are any bytes for transmission. The RTS 
			line is cleared after transmission of all bytes from 
			the receive buffer.
	AbortOnError - If TRUE then read/write is terminated when an 
		error is raised.
	XonLim - Minimum number of bytes in the receive buffer when 
		Xon is sent.
	XoffLim - Maximum number of bytes in the receive buffer when 
		Xoff is sent. 
	ByteSize - Number of bits in one byte.
	Parity - Parity. Available values include:
					EVENPARITY	- Even
					MARKPARITY	- Mark
					NOPARITY	- No parity
					ODDPARITY	- Odd
	StopBits - The number of stop-bits. Available values include: 
					ONESTOPBIT	1	stop-bit
					ONE5STOPBITS	1.5   stop-bits 
					TWOSTOPBITS	2	stop-bits 
	XonChar - Xon character value.
	XoffChar - 	Xoff character value.
	EofChar - End of file character value.
#module root.communication.serial

Methods:


PComDrv::ClearCommBreak(void)

Clears the port Break flag.
Returns TRUE if succeeded.

PComDrv::ClearCommError(void)

Clears the port Error flag. 
Returns the filled object of the ComStat class.

PComDrv::Close(void)

Closes port.
Returns TRUE if succeeded; otherwise - FALSE.
ERR_CLOSE is the possible error.

PComDrv::FlashBuffer(void)

Speeds up data transfer from the output buffer.

PComDrv::GetModemStatus(object String)

param signal;

Receives modem state.
signal		Signal name. Available values include:
			"CTS"		Clear-to-send.
			"DSR"		Data-set-ready.
			"RING"		Ring indicator signal.
			"RLSD"		Receive-line-signal-detect.
Returns TRUE if signal is set; otherwise - FALSE.

PComDrv::GetState(void)

Updates object attributes from the device.
ERR_GETPARAM is the possible error.

PComDrv::GetTimeOut(void)

Returns the timeout value.

PComDrv::InitDialog(void)

Opens the dialog of setting the COM port parameters 
and setting of the received parameters.

PComDrv::IsOpen(void)

Returns TRUE if port is opened; otherwise - FALSE.

PComDrv::IsValid(void)

Returns TRUE, if an object is successfully created; otherwise - FALSE.

PComDrv::Open(void)

Opens port.
Sets the timeout time for 10000 milliseconds.
Sets the size of input and output buffers equal to 8192 bytes.
Returns TRUE if succeeded; otherwise - FALSE.
ERR_OPEN is the possible error.

PComDrv::PComDrv(int)

param Port;

Creates an object to work with the serial port specified 
via the Port parameter.
Available values of the Port parameter include:
		0 - COM1
		1 - COM2
		2 - COM3
		3 - COM4
		...
		19 - COM20
ERR_PORT_BUSY is the possible error.

PComDrv::PerformExtFunc(object String)

param function;

Performs the additional function of the device.
function	Function name. Available values include: 
			"CLRDTR"		Clear data-terminal-ready.
			"CLRRTS"		Clear request-to-send.
			"SETDTR"		Set data-terminal-ready.
			"SETRTS"		Set request-to-send.
			"SETXOFF"		Accept XOFF character.
			"SETXON"		Accept XON character.
			"SETBREAK"		Suppress data transfer.
			"CLRBREAK"		Restore data transfer.

PComDrv::Read(int)

param Len;

Reads data from port. If Len parameter == -1, then this method 
reads all the bytes from buffer; otherwise reads the number of 
bytes specified via the Len parameter. If there are no enough 
bytes in buffer then it waits until timeout. In case of timeout 
the ERR_TIMEOUT error is raised.
ERR_READ and ERR_TIMEOUT are possible errors.

PComDrv::SetBufferSize(int, int)

param InBufferSize, OutBufferSize;

Sets the transmitting buffer and the receive buffer sizes.

PComDrv::SetState(void)

Sets the device parameters according to the object attributes.
ERR_SETPARAM is the possible error.

PComDrv::SetStateDialog(refer object GWnd)

param Parent;

Opens the dialog of setting the COM port parameters 
and setting of the received parameters.
Parent - parent window.

PComDrv::SetStateDialog(void)

Opens the dialog of setting the COM port parameters 
and setting of the received parameters.

PComDrv::SetTimeOut(int)

param TimeOut;

Sets the timeout value (in milliseconds).
ERR_SETPARAM is the possible error.

PComDrv::Write(object String)

param Data.

Writes data specified via the Data parameter to port.
Returns TRUE if succeeded; otherwise - FALSE.
ERR_WRITE is the possible error.

PComDrv::~PComDrv(void)

Deletes an object and closes port if it is opened.

Index: