{
  Copyright (C)
  2026 - Uladzimir Karpenka, EW8BAK

  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  as published by the Free Software Foundation; either version 2
  of the License, or (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
}

unit Serial;

{
  Заглушка RTL-модуля Serial для проверки WINDOWS-ветки SerialPort.pas на Linux.
  Повторяет ровно ту часть API, которую наша обёртка переадресует под Windows,
  включая типы: разъезд сигнатур должен ловиться здесь, а не на сборочной
  машине.
}

{$MODE Delphi}

interface

uses
  SysUtils;

type
  TSerialHandle = THandle;
  TParityType   = (NoneParity, OddParity, EvenParity);
  TSerialFlags  = set of (RtsCtsFlowControl);

function  SerOpen(const DeviceName: string): TSerialHandle;
procedure SerClose(Handle: TSerialHandle);
procedure SerSetParams(Handle: TSerialHandle; BitsPerSec: LongInt;
  ByteSize: Integer; Parity: TParityType; StopBits: Integer;
  Flags: TSerialFlags);
function  SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt): LongInt;
function  SerWrite(Handle: TSerialHandle; const Buffer; Count: LongInt): LongInt;
function  SerReadTimeout(Handle: TSerialHandle; var Buffer; mSec: LongInt): LongInt;
procedure SerSetDTR(Handle: TSerialHandle; State: Boolean);
procedure SerSetRTS(Handle: TSerialHandle; State: Boolean);
function  SerGetCTS(Handle: TSerialHandle): Boolean;
function  SerGetDSR(Handle: TSerialHandle): Boolean;
function  SerGetCD(Handle: TSerialHandle): Boolean;
function  SerGetRI(Handle: TSerialHandle): Boolean;

implementation

function  SerOpen(const DeviceName: string): TSerialHandle; begin Result := 0; end;
procedure SerClose(Handle: TSerialHandle); begin end;
procedure SerSetParams(Handle: TSerialHandle; BitsPerSec: LongInt;
  ByteSize: Integer; Parity: TParityType; StopBits: Integer;
  Flags: TSerialFlags); begin end;
function  SerRead(Handle: TSerialHandle; var Buffer; Count: LongInt): LongInt; begin Result := 0; end;
function  SerWrite(Handle: TSerialHandle; const Buffer; Count: LongInt): LongInt; begin Result := 0; end;
function  SerReadTimeout(Handle: TSerialHandle; var Buffer; mSec: LongInt): LongInt; begin Result := 0; end;
procedure SerSetDTR(Handle: TSerialHandle; State: Boolean); begin end;
procedure SerSetRTS(Handle: TSerialHandle; State: Boolean); begin end;
function  SerGetCTS(Handle: TSerialHandle): Boolean; begin Result := False; end;
function  SerGetDSR(Handle: TSerialHandle): Boolean; begin Result := False; end;
function  SerGetCD(Handle: TSerialHandle): Boolean; begin Result := False; end;
function  SerGetRI(Handle: TSerialHandle): Boolean; begin Result := False; end;

end.
