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

📄 asc2setup.pas

📁 朗铭科技Ls-810 门禁控制器接口 delphi源程
💻 PAS
📖 第 1 页 / 共 4 页
字号:

  actime := StrToInt(ActiveTimeEditL.Text);
  password := format('%6.6d',[StrToInt(PasswordEditL.Text)]);

  event := $0000;
  for i:=0 to 15 do alarm[i] := 0;
  if ErrUnknowChkBoxL.Checked then
  begin
    event := event or $8000;
    alarm[0] := $80;
  end;
  if ErrPINChkBoxL.Checked then
  begin
    event := event or $4000;
    alarm[2] := $80;
  end;
  if ErrDateChkBoxL.Checked then
  begin
    event := event or $2000;
    alarm[4] := $80;
  end;
  if ErrTimeChkBoxL.Checked then
  begin
    event := event or $1000;
    alarm[6] := $80;
  end;
  if ErrPassBackChkBoxL.Checked then
  begin
    event := event or $0800;
    alarm[8] := $80;
  end;
  if ErrDoorCloseChkBoxL.Checked then
  begin
    event := event or $0400;
    alarm[10] := $80;
  end;
  if ErrDoorOpenChkBoxL.Checked then
  begin
    event := event or $0200;
    alarm[12] := $80;
  end;
  if AlarmingChkBoxL.Checked then
  begin
    event := event or $0100;
    alarm[14] := $80;
  end;
  if ExitButtonRecChkBoxL.Checked then
  begin
    event := event or $0080;
  end;

  alarm[0] := alarm[0]+(StrToInt(AlarmCountEditL1.Text) shl 2)+StrToInt(AlarmCodeCboBoxL1.Text)-1;
  alarm[1] := (StrToInt(bgAlarmCboBoxL1.Text) shl 5)+31;
  alarm[2] := alarm[2]+(StrToInt(AlarmCountEditL2.Text) shl 2)+StrToInt(AlarmCodeCboBoxL2.Text)-1;
  alarm[3] := (StrToInt(bgAlarmCboBoxL2.Text) shl 5)+31;
  alarm[4] := alarm[4]+(StrToInt(AlarmCountEditL3.Text) shl 2)+StrToInt(AlarmCodeCboBoxL3.Text)-1;
  alarm[5] := (StrToInt(bgAlarmCboBoxL3.Text) shl 5)+31;
  alarm[6] := alarm[6]+(StrToInt(AlarmCountEditL4.Text) shl 2)+StrToInt(AlarmCodeCboBoxL4.Text)-1;
  alarm[7] := (StrToInt(bgAlarmCboBoxL4.Text) shl 5)+31;
  alarm[8] := alarm[8]+(StrToInt(AlarmCountEditL5.Text) shl 2)+StrToInt(AlarmCodeCboBoxL5.Text)-1;
  alarm[9] := (StrToInt(bgAlarmCboBoxL5.Text) shl 5)+31;
  alarm[10] := alarm[10]+(StrToInt(AlarmCountEditL6.Text) shl 2)+StrToInt(AlarmCodeCboBoxL6.Text)-1;
  alarm[11] := (StrToInt(bgAlarmCboBoxL6.Text) shl 5)+31;
  alarm[12] := alarm[12]+(StrToInt(AlarmCountEditL7.Text) shl 2)+StrToInt(AlarmCodeCboBoxL7.Text)-1;
  alarm[13] := (StrToInt(bgAlarmCboBoxL7.Text) shl 5)+31;
  alarm[14] := alarm[14]+(StrToInt(AlarmCountEditL8.Text) shl 2)+StrToInt(AlarmCodeCboBoxL8.Text)-1;
  alarm[15] := (StrToInt(bgAlarmCboBoxL8.Text) shl 5)+31;
  if ascSetReaderProp(hComDev,1,devid,1,ctrl,password,actime,event,8,@alarm)=0 then
    SetLamp(3)
  else
    SetLamp(1);

  ctrl := $0000;
  if PINChkBoxR.Checked then ctrl := ctrl or $8000;
  if PasswordChkBoxR.Checked then ctrl := ctrl or $4000;
  if MstSlvChkBoxR.Checked then ctrl := ctrl or $2000;
  if AntiPassBackChkBoxR.Checked then ctrl := ctrl or $1000;
  if ExitButtonChkBoxR.Checked then ctrl := ctrl or $0800;
  if LockStatusChkBoxR.Checked then ctrl := ctrl or $0400;
  if INCChkBoxR.Checked then ctrl := ctrl or $0200;
  if InterLockChkBox.Checked then ctrl := ctrl or $0100;

  actime := StrToInt(ActiveTimeEditR.Text);
  password := PasswordEditR.Text;

  event := $0000;
  for i:=0 to 15 do alarm[i] :=0 ;
  if ErrUnknowChkBoxR.Checked then
  begin
    event := event or $8000;
    alarm[0] := $80;
  end;
  if ErrPINChkBoxR.Checked then
  begin
    event := event or $4000;
    alarm[2] := $80;
  end;
  if ErrDateChkBoxR.Checked then
  begin
    event := event or $2000;
    alarm[4] := $80;
  end;
  if ErrTimeChkBoxR.Checked then
  begin
    event := event or $1000;
    alarm[6] := $80;
  end;
  if ErrPassBackChkBoxR.Checked then
  begin
    event := event or $0800;
    alarm[8] := $80;
  end;
  if ErrDoorCloseChkBoxR.Checked then
  begin
    event := event or $0400;
    alarm[10] := $80;
  end;
  if ErrDoorOpenChkBoxR.Checked then
  begin
    event := event or $0200;
    alarm[12] := $80;
  end;
  if AlarmingChkBoxR.Checked then
  begin
    event := event or $0100;
    alarm[14] := $80;
  end;
  if ExitButtonRecChkBoxR.Checked then
  begin
    event := event or $0080;
  end;

  alarm[0] := alarm[0]+(StrToInt(AlarmCountEditR1.Text) shl 2)+StrToInt(AlarmCodeCboBoxR1.Text)-1;
  alarm[1] := (StrToInt(bgAlarmCboBoxR1.Text) shl 5)+31;
  alarm[2] := alarm[2]+(StrToInt(AlarmCountEditR2.Text) shl 2)+StrToInt(AlarmCodeCboBoxR2.Text)-1;
  alarm[3] := (StrToInt(bgAlarmCboBoxR2.Text) shl 5)+31;
  alarm[4] := alarm[4]+(StrToInt(AlarmCountEditR3.Text) shl 2)+StrToInt(AlarmCodeCboBoxR3.Text)-1;
  alarm[5] := (StrToInt(bgAlarmCboBoxR3.Text) shl 5)+31;
  alarm[6] := alarm[6]+(StrToInt(AlarmCountEditR4.Text) shl 2)+StrToInt(AlarmCodeCboBoxR4.Text)-1;
  alarm[7] := (StrToInt(bgAlarmCboBoxR4.Text) shl 5)+31;
  alarm[8] := alarm[8]+(StrToInt(AlarmCountEditR5.Text) shl 2)+StrToInt(AlarmCodeCboBoxR5.Text)-1;
  alarm[9] := (StrToInt(bgAlarmCboBoxR5.Text) shl 5)+31;
  alarm[10] := alarm[10]+(StrToInt(AlarmCountEditR6.Text) shl 2)+StrToInt(AlarmCodeCboBoxR6.Text)-1;
  alarm[11] := (StrToInt(bgAlarmCboBoxR6.Text) shl 5)+31;
  alarm[12] := alarm[12]+(StrToInt(AlarmCountEditR7.Text) shl 2)+StrToInt(AlarmCodeCboBoxR7.Text)-1;
  alarm[13] := (StrToInt(bgAlarmCboBoxR7.Text) shl 5)+31;
  alarm[14] := alarm[14]+(StrToInt(AlarmCountEditR8.Text) shl 2)+StrToInt(AlarmCodeCboBoxR8.Text)-1;
  alarm[15] := (StrToInt(bgAlarmCboBoxR8.Text) shl 5)+31;
  if ascSetReaderProp(hComDev,1,devid,2,ctrl,password,actime,event,8,@alarm)=0 then
    SetLamp(3)
  else
    SetLamp(1);
end;

procedure TASC2SetupForm.ReadPropButtonClick(Sender: TObject);
var
  ctrl,actime,event,password,almcnt: string;
  alarm: array[0..255] of Byte;
begin
  ctrl := StringOfChar(' ',16);
  actime := StringOfChar(' ',16);
  event := StringOfChar(' ',16);
  password := StringOfChar(' ',16);
  almcnt := StringOfChar(' ',16);  
  if ascGetReaderProp(hComDev,1,devid,1,ctrl,password,actime,event,almcnt,@alarm)=0 then
  begin
    if (( StrToInt(ctrl) shr 15 ) and $01 )=$01 then
      PINChkBoxL.Checked := True
    else
      PINChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 14 ) and $01 )=$01 then
      PasswordChkBoxL.Checked := True
    else
      PasswordChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 13 ) and $01 )=$01 then
      MstSlvChkBoxL.Checked := True
    else
      MstSlvChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 12 ) and $01 )=$01 then
      AntiPassBackChkBoxL.Checked := True
    else
      AntiPassBackChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 11 ) and $01 )=$01 then
      ExitButtonChkBoxL.Checked := True
    else
      ExitButtonChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 10 ) and $01 )=$01 then
      LockStatusChkBoxL.Checked := True
    else
      LockStatusChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 9 ) and $01 )=$01 then
      INCChkBoxL.Checked := True
    else
      INCChkBoxL.Checked := False;
    if (( StrToInt(ctrl) shr 8 ) and $01 )=$01 then
      InterLockChkBox.Checked := True
    else
      InterLockChkBox.Checked := False;

    ActiveTimeEditL.Text := actime;
    PasswordEditL.Text := password;

    if (( StrToInt(event) shr 15 ) and $01 )=$01 then
      ErrUnknowChkBoxL.Checked := True
    else
      ErrUnknowChkBoxL.Checked := False;
    if (( StrToInt(event) shr 14 ) and $01 )=$01 then
      ErrPINChkBoxL.Checked := True
    else
      ErrPINChkBoxL.Checked := False;
    if (( StrToInt(event) shr 13 ) and $01 )=$01 then
      ErrDateChkBoxL.Checked := True
    else
      ErrDateChkBoxL.Checked := False;
    if (( StrToInt(event) shr 12 ) and $01 )=$01 then
      ErrTimeChkBoxL.Checked := True
    else
      ErrTimeChkBoxL.Checked := False;
    if (( StrToInt(event) shr 11 ) and $01 )=$01 then
      ErrPassBackChkBoxL.Checked := True
    else
      ErrPassBackChkBoxL.Checked := False;
    if (( StrToInt(event) shr 10 ) and $01 )=$01 then
      ErrDoorCloseChkBoxL.Checked := True
    else
      ErrDoorCloseChkBoxL.Checked := False;
    if (( StrToInt(event) shr 9 ) and $01 )=$01 then
      ErrDoorOpenChkBoxL.Checked := True
    else
      ErrDoorOpenChkBoxL.Checked := False;
    if (( StrToInt(event) shr 8 ) and $01 )=$01 then
      AlarmingChkBoxL.Checked := True
    else
      AlarmingChkBoxL.Checked := False;
    if (( StrToInt(event) shr 7 ) and $01 )=$01 then
      ExitButtonRecChkBoxL.Checked := True
    else
      ExitButtonRecChkBoxL.Checked := False;

    AlarmCountEditL1.Text := IntToStr((alarm[0] shr 2) and $1F);
    AlarmCodeCboBoxL1.Text := IntToStr((alarm[0] and $03)+1);
    bgAlarmCboBoxL1.Text := IntToStr(alarm[1] shr 5);
    AlarmCountEditL2.Text := IntToStr((alarm[2] shr 2) and $1F);
    AlarmCodeCboBoxL2.Text := IntToStr((alarm[2] and $03)+1);
    bgAlarmCboBoxL2.Text := IntToStr(alarm[3] shr 5);
    AlarmCountEditL3.Text := IntToStr((alarm[4] shr 2) and $1F);
    AlarmCodeCboBoxL3.Text := IntToStr((alarm[4] and $03)+1);
    bgAlarmCboBoxL3.Text := IntToStr(alarm[5] shr 5);
    AlarmCountEditL4.Text := IntToStr((alarm[6] shr 2) and $1F);
    AlarmCodeCboBoxL4.Text := IntToStr((alarm[6] and $03)+1);
    bgAlarmCboBoxL4.Text := IntToStr(alarm[7] shr 5);
    AlarmCountEditL5.Text := IntToStr((alarm[8] shr 2) and $1F);
    AlarmCodeCboBoxL5.Text := IntToStr((alarm[8] and $03)+1);
    bgAlarmCboBoxL5.Text := IntToStr(alarm[9] shr 5);
    AlarmCountEditL6.Text := IntToStr((alarm[10] shr 2) and $1F);
    AlarmCodeCboBoxL6.Text := IntToStr((alarm[10] and $03)+1);
    bgAlarmCboBoxL6.Text := IntToStr(alarm[11] shr 5);
    AlarmCountEditL7.Text := IntToStr((alarm[12] shr 2) and $1F);
    AlarmCodeCboBoxL7.Text := IntToStr((alarm[12] and $03)+1);
    bgAlarmCboBoxL7.Text := IntToStr(alarm[13] shr 5);
    AlarmCountEditL8.Text := IntToStr((alarm[14] shr 2) and $1F);
    AlarmCodeCboBoxL8.Text := IntToStr((alarm[14] and $03)+1);
    bgAlarmCboBoxL8.Text := IntToStr(alarm[15] shr 5);
    SetLamp(3);
  end else
    SetLamp(1);

  if ascGetReaderProp(hComDev,1,devid,2,ctrl,password,actime,event,almcnt,@alarm)=0 then
  begin
    if (( StrToInt(ctrl) shr 15 ) and $01 )=$01 then
      PINChkBoxR.Checked := True
    else
      PINChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 14 ) and $01 )=$01 then
      PasswordChkBoxR.Checked := True
    else
      PasswordChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 13 ) and $01 )=$01 then
      MstSlvChkBoxR.Checked := True
    else
      MstSlvChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 12 ) and $01 )=$01 then
      AntiPassBackChkBoxR.Checked := True
    else
      AntiPassBackChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 11 ) and $01 )=$01 then
      ExitButtonChkBoxR.Checked := True
    else
      ExitButtonChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 10 ) and $01 )=$01 then
      LockStatusChkBoxR.Checked := True
    else
      LockStatusChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 9 ) and $01 )=$01 then
      INCChkBoxR.Checked := True
    else
      INCChkBoxR.Checked := False;
    if (( StrToInt(ctrl) shr 8 ) and $01 )=$01 then
      InterLockChkBox.Checked := True
    else
      InterLockChkBox.Checked := False;

    ActiveTimeEditR.Text := actime;
    PasswordEditR.Text := password;

    if (( StrToInt(event) shr 15 ) and $01 )=$01 then
      ErrUnknowChkBoxR.Checked := True
    else
      ErrUnknowChkBoxR.Checked := False;
    if (( StrToInt(event) shr 14 ) and $01 )=$01 then
      ErrPINChkBoxR.Checked := True
    else
      ErrPINChkBoxR.Checked := False;
    if (( StrToInt(event) shr 13 ) and $01 )=$01 then
      ErrDateChkBoxR.Checked := True
    else
      ErrDateChkBoxR.Checked := False;
    if (( StrToInt(event) shr 12 ) and $01 )=$01 then
      ErrTimeChkBoxR.Checked := True
    else
      ErrTimeChkBoxR.Checked := False;
    if (( StrToInt(event) shr 11 ) and $01 )=$01 then
      ErrPassBackChkBoxR.Checked := True
    else
      ErrPassBackChkBoxR.Checked := False;
    if (( StrToInt(event) shr 10 ) and $01 )=$01 then
      ErrDoorCloseChkBoxR.Checked := True
    else
      ErrDoorCloseChkBoxR.Checked := False;
    if (( StrToInt(event) shr 9 ) and $01 )=$01 then
      ErrDoorOpenChkBoxR.Checked := True
    else
      ErrDoorOpenChkBoxR.Checked := False;
    if (( StrToInt(event) shr 8 ) and $01 )=$01 then
      AlarmingChkBoxR.Checked := True
    else
      AlarmingChkBoxR.Checked := False;
    if (( StrToInt(event) shr 7 ) and $01 )=$01 then
      ExitButtonRecChkBoxR.Checked := True
    else
      ExitButtonRecChkBoxR.Checked := False;

    AlarmCountEditR1.Text := IntToStr((alarm[0] shr 2) and $1F);
    AlarmCodeCboBoxR1.Text := IntToStr((alarm[0] and $03)+1);
    bgAlarmCboBoxR1.Text := IntToStr(alarm[1] shr 5);
    AlarmCountEditR2.Text := IntToStr((alarm[2] shr 2) and $1F);
    AlarmCodeCboBoxR2.Text := IntToStr((alarm[2] and $03)+1);
    bgAlarmCboBoxR2.Text := IntToStr(alarm[3] shr 5);
    AlarmCountEditR3.Text := IntToStr((alarm[4] shr 2) and $1F);
    AlarmCodeCboBoxR3.Text := IntToStr((alarm[4] and $03)+1);
    bgAlarmCboBoxR3.Text := IntToStr(alarm[5] shr 5);
    AlarmCountEditR4.Text := IntToStr((alarm[6] shr 2) and $1F);
    AlarmCodeCboBoxR4.Text := IntToStr((alarm[6] and $03)+1);
    bgAlarmCboBoxR4.Text := IntToStr(alarm[7] shr 5);
    AlarmCountEditR5.Text := IntToStr((alarm[8] shr 2) and $1F);
    AlarmCodeCboBoxR5.Text := IntToStr((alarm[8] and $03)+1);
    bgAlarmCboBoxR5.Text := IntToStr(alarm[9] shr 5);
    AlarmCountEditR6.Text := IntToStr((alarm[10] shr 2) and $1F);
    AlarmCodeCboBoxR6.Text := IntToStr((alarm[10] and $03)+1);
    bgAlarmCboBoxR6.Text := IntToStr(alarm[11] shr 5);
    AlarmCountEditR7.Text := IntToStr((alarm[12] shr 2) and $1F);
    AlarmCodeCboBoxR7.Text := IntToStr((alarm[12] and $03)+1);
    bgAlarmCboBoxR7.Text := IntToStr(alarm[13] shr 5);
    AlarmCountEditR8.Text := IntToStr((alarm[14] shr 2) and $1F);
    AlarmCodeCboBoxR8.Text := IntToStr((alarm[14] and $03)+1);
    bgAlarmCboBoxR8.Text := IntToStr(alarm[15] shr 5);
    SetLamp(3);
  end else
    SetLamp(1);
end;

// 钥匙卡

procedure TASC2SetupForm.ReadCardDefButtonClick(Sender: TObject);
var
  count,enacs,cardid,cardidx,properties,expdate,timecode,password: string;
  i,j: Smallint;
begin
  count := StringOfChar(' ',8);
  enacs := StringOfChar(' ',8);
  cardid := StringOfChar(' ',16);
  cardidx := StringOfChar(' ',8);
  properties := StringOfChar(' ',8);
  expdate := StringOfChar(' ',12);
  timecode := StringOfChar(' ',8);
  password := StringOfChar(' ',16);
  if ascGetCardCount(hComDev,1,devid,count)=0 then
  begin
    CardCountEdit.Text := count;

    with CardStringGrid do
    begin
      for i:=1 to 4096 do
        for j:= 0 to 4 do
          Cells[j,i] := ''
    end;

    SetLamp(3);
  end else
    SetLamp(1);

  for i:=0 to StrToInt(count)-1 do
  begin
    if ascGetCard(hComDev,1,devid,i,enacs,cardid,cardidx,properties,
                  expdate,timecode,password)=0 then
    begin
      with CardStringGrid do
      begin

⌨️ 快捷键说明

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