📄 u_card.pas
字号:
unit U_Card;
{* 作者:肖景峰
*开发时间:2005-10-30
*模块作用:对读卡器进行处理
}
interface
{1} //打开设备,进行口令验正
function Open_Card():Boolean;
{2} // 关闭设备
function CLose_Card():boolean;
{3} // 写卡,对卡进行写操作
function Write_card(COntent:string):boolean;
{4}//对卡进行读操作
function Read_Card():string;
{5} //写卡时内容组织
function Content(aa:string):string;
{6}//卡片比效函数
function Card_Compare():boolean;
implementation
uses u_public_define,dialogs,sysutils,StrUtils;
{1} //打开设备,进行口令验正
function Open_Card():Boolean;
var
Status:integer;
aa:array[0..2]of char;
begin
//
aa:=chr(0)+chr(0)+chr(0);
// g_icdev:=auto_init(0,9600);
G_st := cmp_dvsc(G_icdev, 3, aa);
G_st:=setsc_md(G_icdev, 1);
G_st:=get_status(G_icdev, @Status);
If G_st < 0 Then
begin
showmessage('驱动器有错误!请检查设备后继续使用!');
OPen_Card:= False;
// G_st :=ic_exit(G_icdev);
Exit;
end;
If Status =0 Then
begin
showmessage('请插入卡后使用!');
OPen_Card:= False;
// G_st := ic_exit(G_icdev);
Exit;
End;
G_st := dv_beep(G_icdev, 10);
OPen_Card := True;
end;
{2} // 关闭设备
function CLose_Card():boolean;
begin
{ G_st := ic_exit(G_icdev);
If G_st < 0 Then
begin
showmessage('关闭设备时有误,请重新启动系统');
close_card:=false;
exit;
end; }
close_card:=true;
//
end;
{3} // 写卡,对卡进行写操作
function Write_card(COntent:string):boolean;
var
password:array[0..4] of char;
password1:array[0..2] of char;
cent:pchar;
begin
cent:=pchar(content);
g_st:=chk_4428(g_icdev);
password:='ffff';
g_st:=asc_hex(password,password1,2);
g_st:=csc_4428(g_icdev,2,password1);
// data1:='abc';
g_st:=swr_4428(g_icdev,32,255,cent);
If G_st < 0 Then
begin
showmessage('写卡时出错,请检查后使用!');
Write_card := False;
exit;
end;
Write_card:= True;
//
end;
{4}//对卡进行读操作
function Read_Card():string;
var
Cent:array[0..256] of char;
tent:array[0..256] of char;
I,j:integer;
DD:string;
begin
G_st:= srd_4428(G_icdev, 32, 255, Cent);
If G_st < 0 Then
begin
showmessage('读卡时出错,请检查后使用!');
Exit;
end;
For i := 0 To 383 do
begin
If i > 15 Then
begin
for j:=0 to 12 do
begin
dd:=dd+cent[j];
end;
Read_Card:= dd;
Exit;
end;
end;
end;
{If asc(Mid(Cent, i, 1)) = 17 Then
Read_Card = TEnt
Exit Function
End If
TEnt := TEnt & Mid(Cent, i, 1);
end;
//Read_Card := cEnt; }
//
{5} //写卡时内容组织
function Content(aa:string):string;
begin
//
end;
{6}//卡片比效函数
function Card_Compare():boolean;
begin
//
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -