⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 iccarddefine.pas

📁 经典的酒店管理系统
💻 PAS
字号:
unit IcCardDefine;

interface

uses
  SysUtils, Classes, DB, DBTables, StdCtrls, DBCtrls;


var
  IcDev : Longint;
  OutBuf: PChar;
  InBuf : string;

procedure InitStatus(CommPort: Integer);
procedure ExitComm;
function IsCardExists: Boolean;
function CheckPass: Boolean;
procedure ICDown;

implementation

uses drv_unit;

procedure ICDown;
var
  st: SmallInt;
begin
  st := IC_Down(IcDev);
  if st<>0 then
    raise Exception.Create('下电失败!');
end;

function CheckPass: Boolean;
var
  st: SmallInt;
begin
  InBuf := 'FFFFFF';
  st := IC_CheckPass_4442hex(IcDev,PChar(InBuf));
  if st <> 0 then
    Result := False
  else
    Result := True;
end;

procedure InitStatus(CommPort: Integer);
var
  st: SmallInt;
begin
  IcDev := IC_InitComm(CommPort);
  if IcDev < 0 then
    raise Exception.Create('初始化串口失败!');
  st := IC_Status(IcDev);
  if st < 0 then
    raise Exception.Create('读写器存在错误!');
  if st <> 1 then
  begin
    st := IC_InitType(IcDev,16); //4442
    if st <> 0 then
      raise Exception.Create('IC卡类型错误!');
  end;
end;

function IsCardExists: Boolean;
var
  st: SmallInt;
begin
  st := IC_Status(IcDev);
  if st < 0 then
    raise Exception.Create('读写器存在错误!');
  if st = 1 then
    Result := False
  else
    Result := True;
end;

procedure ExitComm;
begin
  IC_ExitComm(IcDev);
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -