# Unit synaser

Description | uses | Classes, Interfaces and Objects | Functions and Procedures | Types | Constants | Variables

## Description

Serial port communication library

This unit contains a class that implements serial port communication for Windows or Linux. This class provides numerous methods with same name and functionality as methods of the Ararat Synapse TCP/IP library.

The following is a small example how establish a connection by modem (in this case with my USB modem):

      ser:=TBlockSerial.Create;
      try
        ser.Connect('COM3' );
        ser.config(460800,8,'N' ,0,false,true);
        ser.ATCommand('AT' );
        if (ser.LastError <> 0) or (not ser.ATResult) then
          Exit;
        ser.ATConnect('ATDT+420971200111' );
        if (ser.LastError <> 0) or (not ser.ATResult) then
          Exit;
        // you are now connected to a modem at +420971200111
        // you can transmit or receive data now
      finally
        ser.free;
      end;

## Classes, Interfaces and Objects

Name | Description
--- | ---
Class `ESynaSerError` | Exception type for SynaSer errors
Class `TBlockSerial` | Main class implementing all communication routines

## Functions and Procedures

### Overview

`function GetSerialPortNames: string;`

### Description

`function GetSerialPortNames: string;`

Returns list of existing computer serial ports. Working properly only in Windows!

## Types

Name | Description
--- | ---
THookSerialReason`` | Possible status event types for THookSerialStatus HR_SerialClose: HR_Connect: HR_CanRead: HR_CanWrite: HR_ReadCount: HR_WriteCount: HR_Wait:
THookSerialStatus | procedural prototype for status event hooking

## Constants

Name | Description
--- | ---
CR`= #$0d;` |
LF`= #$0a;` |
CRLF`= CR + LF;` |
cSerialChunk`= 8192;` |
LockfileDirectory`= '/var/lock';` |
PortIsClosed`= -1;` |
ErrAlreadyOwned`= 9991;` |
ErrAlreadyInUse`= 9992;` |
ErrWrongParameter`= 9993;` |
ErrPortNotOpen`= 9994;` |
ErrNoDeviceAnswer`= 9995;` |
ErrMaxBuffer`= 9996;` |
ErrTimeout`= 9997;` |
ErrNotRead`= 9998;` |
ErrFrame`= 9999;` |
ErrOverrun`= 10000;` |
ErrRxOver`= 10001;` |
ErrRxParity`= 10002;` |
ErrTxFull`= 10003;` |
dcb_Binary`= $00000001;` |
dcb_ParityCheck`= $00000002;` |
dcb_OutxCtsFlow`= $00000004;` |
dcb_OutxDsrFlow`= $00000008;` |
dcb_DtrControlMask`= $00000030;` |
dcb_DtrControlDisable`= $00000000;` |
dcb_DtrControlEnable`= $00000010;` |
dcb_DtrControlHandshake`= $00000020;` |
dcb_DsrSensivity`= $00000040;` |
dcb_TXContinueOnXoff`= $00000080;` |
dcb_OutX`= $00000100;` |
dcb_InX`= $00000200;` |
dcb_ErrorChar`= $00000400;` |
dcb_NullStrip`= $00000800;` |
dcb_RtsControlMask`= $00003000;` |
dcb_RtsControlDisable`= $00000000;` |
dcb_RtsControlEnable`= $00001000;` |
dcb_RtsControlHandshake`= $00002000;` |
dcb_RtsControlToggle`= $00003000;` |
dcb_AbortOnError`= $00004000;` |
dcb_Reserveds`= $FFFF8000;` |
SB1`= 0;` | stopbit value for 1 stopbit
SB1andHalf`= 1;` | stopbit value for 1.5 stopbit
SB2`= 2;` | stopbit value for 2 stopbits
sOK`= 0;` |
sErr`= integer(-1);` |

Generated by PasDoc 0.8.8.2 on 2005-01-19 20:01:19