unit MCSUartExchange;

interface

uses
  Windows;

const
  LibName = 'MCSUartExchange.dll';
type
  TMCSUartState = record
    Parity : Byte;
    StopBits : Byte;
  end;

function GetMCSUartReplaceAPI : Boolean; stdcall; external LibName;
procedure SetMCSUartReplaceAPI(Value : Boolean); stdcall; external LibName;
function MCSUartCreate(aAsync : Boolean) : Boolean; stdcall; external LibName;
function MCSUartClose : Boolean; stdcall; external LibName;
function MCSUartRead(var Buffer; nNumberOfBytesToRead: DWORD; var lpNumberOfBytesRead: DWORD) : Boolean; stdcall; external LibName;
function MCSUartAsyncCheck(var lpNumberOfBytesTransferred: DWORD; bWait: Boolean) : Boolean; stdcall; external LibName;
function MCSUartWrite(const Buffer; nNumberOfBytesToWrite: DWORD;
  var lpNumberOfBytesWritten: DWORD): Boolean; stdcall; external LibName;
function MCSUartGetState(var State : TMCSUartState) : Boolean; stdcall; external LibName;
function MCSUartSetState(const State : TMCSUartState) : Boolean; stdcall; external LibName;
function MCSUartQueryReset : Boolean; stdcall; external LibName;
procedure MCSUartClearReset; stdcall; external LibName;

function CreateFile(lpFileName: PChar; dwDesiredAccess, dwShareMode: DWORD;
  lpSecurityAttributes: PSecurityAttributes; dwCreationDisposition, dwFlagsAndAttributes: DWORD;
  hTemplateFile: THandle): THandle; stdcall; external LibName;
function CloseHandle(hObject: THandle): BOOL; stdcall; external LibName;
function ReadFile(hFile: THandle; var Buffer; nNumberOfBytesToRead: DWORD; var lpNumberOfBytesRead: DWORD; lpOverlapped: POverlapped): BOOL; stdcall; external LibName;
function GetOverlappedResult(hFile: THandle; const lpOverlapped: TOverlapped;
  var lpNumberOfBytesTransferred: DWORD; bWait: BOOL): BOOL; stdcall; external LibName;
function WriteFile(hFile: THandle; const Buffer; nNumberOfBytesToWrite: DWORD;
  var lpNumberOfBytesWritten: DWORD; lpOverlapped: POverlapped): BOOL; stdcall; external LibName;
function GetCommState(hFile: THandle; var lpDCB: TDCB): BOOL; stdcall; external LibName;
function SetCommState(hFile: THandle; const lpDCB: TDCB): BOOL; stdcall; external LibName;

implementation

end.
