📄 docs.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<META HTTP-EQUIV="Content-language" CONTENT="en">
<META NAME="Robots" CONTENT="ALL; FOLLOW">
<META name="description" content="SYNASER - Serial port Synchronous Library for Delphi">
<META name="keywords" content="Synapse, TCP/IP, Socket, Synchronous, Blocking, serial, port">
<title>SYNASER - Serial Port Synchronous Library for Delphi</title>
</head>
<body BGCOLOR="#FFFAEC" LINK="Red" ALINK="Blue" VLINK="Purple">
<CENTER>
<FONT FACE="sans-serif" SIZE="+1" COLOR="Blue">
<B>SYNASER - Serial Port Synchronous Library for Delphi</B>
</FONT>
<br>
Other related information can be found at <A HREF="http://www.ararat.cz/synapse/">http://www.ararat.cz/synapse/</A>
</CENTER>
<hr>
<p>Class: <B>TBlockSerial</B> <ul>
<li>Properties: <ul>
<li><B>handle:THandle</B><br>
Serial port handle. Suitable for "manual" calls to WinAPI.
<li><B>LastError:integer</B><br>
Last operation error code. Error codes are described in WinAPI documentation. By calling <i>function GetErrorDesc(ErrorCode:integer):string</i> you can get error code string description.
<li><B>RaiseExcept:boolean</B><br>
If <i>true</i>, errors raises exception. Default value is <i>false</i>.
<li><B>SizeRecvBuffer:integer</B><br>
Size of receive buffer.
<li><B>SizeSendBuffer:integer</B><br>
Size of send buffer.
</ul>
<li>Methods: <ul>
<li>Procedure <B>CreateSocket</B><br>
Dummy function for compatibility with Synapse classes.
<li>Procedure <B>CloseSocket</B><br>
Destroy handle in use. It close connection to serial port.
<li>procedure <B>Connect(comport:string; baud,bits:integer; parity:char; stop:integer; softflow,hardflow:boolean)</B><br>
Connects to <i>comport</i> (i.e. 'COM2') with speed defined by <i>baud</i> parameter. <i>Bits</i> specified number of bits. Known <i>parity</i> values are: 'N','O','E','M' and 'S'. <i>Stop</i> define length of stop bit. 0 is 1 stop bit. 1 is 1.5 of stop bit, and 2 is 2 stop bits. <i>Softflow</i> and <i>hardflow</i> is used for specify of flowcontrol.
<li>function <B>SendBuffer(buffer:pointer;length:integer)</B><br>
Sends data of LENGTH from BUFFER address via connected port.
<li>procedure <B>SendByte(data:byte)</B><br>
One data BYTE is sent.
<li>procedure <B>SendString(data:string)</B><br>
Send data string.
<li>function <B>RecvBuffer(buffer:pointer;length:integer):integer</B><br>
Waits until allocated buffer is filled by received data. Returns number of data received, which equals to LENGTH value under normal operation. If it is not equal the communication channel is possibly broken.
<li>function <B>RecvByte(timeout:integer):byte</B><br>
Waits until one data byte is received which is also returned as function result. If no data is received within TIMEOUT (in milliseconds) period, LastError is set to 30.
<li>function <B>Recvstring(timeout:integer):string</B><br>
Method waits until data string is received. This string is terminated by LF character. The resulting string is returned without this termination (CR LF). If no data is received within TIMEOUT (in milliseconds)period, LastError is set to 30. Methods serves for line protocols implementation and uses its own buffers to maximize operation power. Therefore do NOT use this method with other methods for data receiving because of possible data loss. You may only combine this function with RecvBufferEx method.
<li>function <B>RecvBufferEx(buffer:pointer;length:integer;timeout:integer):integer</B><br>
Method waits until data is received. If no data is received within TIMEOUT (in milliseconds)period, LastError is set to 30. Methods serves for reading any size of data (i.e. one megabyte...), and may be freely combine with RecvString method.
<li>function <B>WaitingData:integer</B><br>
Returns number of received bytes waiting for picking. 0 is returned when there is no such data.
<li>function <B>SendingData:integer</B><br>
Returns number of sending bytes waiting for send in output buffer. 0 is returned when there is no such data.
<li>function <B>CanRead(Timeout:integer):boolean</B><br>
Return TRUE, if you can from port read any data. Status is tested for time Timeout (in milliseconds). If value in Timeout is 0, status is only tested and continue. If value in Timeout is -1, run is breaked and waiting for read data maybe forever.
<li>function <B>CanWrite(Timeout:integer):boolean</B><br>
Return TRUE, if you can to port write any data (not full sending buffer). Status is tested for time Timeout (in milliseconds). If value in Timeout is 0, status is only tested and continue. If value in Timeout is -1, run is breaked and waiting for write data maybe forever.
<li>function <B>SerialCheck(SockResult:integer):integer</B><br>
If you "manually"call WinAPI functions, forward their return code as parameter to this function, which evaluates it, eventually calls <i>GetLastError</i> and found error code returns and stores to <em>LastError</em>.
<li>procedure <B>EnableRTSToggle(value:boolean)</B><br>
Enable or disable RTS driven direction of communication. It good if you can communicate with RS485 convertor, or other special cases. If you enable this feature, system automaticly control RTS signal.
<li>procedure <B>Flush</B><br>
Wait for all data to send is sended and buffers is empty.
<li>procedure <B>Purge</B><br>
Hardly empty all buffers.
<li>function <B>ModemStatus:integer</B><br>
Get status word of your modem. from this word you may decode status of carrier detect signal, or other more.
<li>function <B>ATCommand(value:string):string</B><br>
Send AT command to modem and return response from modem. Response can be multiline!
</ul>
</ul>
<hr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -