我已成功连接到生物识别设备,并能够使用以下方法使用Zkemkeeper.dll提取所有记录
axCZKEM1.ReadGeneralLogData(iMachineNumber)
每次使用上述方法时,它会拉出设备中特定时间的所有数据。
但我希望每次都能获得新插入的数据。是否有可能在Zkemkeeper,如果不是最好的方法来完成这个? Plz分享你的想法。提前致谢
答案 0 :(得分:1)
ReadGeneralLogData用于加载所有考勤日志。要获得新注册,您必须使用您拥有的DLL文件中的RegEvent api注册该事件。
RegEvent的签名
VARIANT_BOOL RegEvent([in] LONG dwMachineNumber,[in] LONG EventMask) dwMachineNumber为零 EventMask是1
注册后,每次登记时都会调用OnAttTransactionEx事件。
事件签名是
OnAttTransactionEx(BSTR EnrollNumber,LONG IsInValid,LONG AttState,LONG VerifyMethod,LONG Year,LONG Month,LONG Day,LONG Hour,LONG Minute,LONG Second, LONG WorkCode)
如果您正在寻找WebApi支持,可以参考http://camsunit.com/application/biometric-web-api.html
答案 1 :(得分:1)
但即时通讯使用essl f18型号,我的供应商表示此硬件不支持实时事件
^这就是让我写下我的答案,它确实支持实时事件。正如我自己用F-18系列一样。
继续Ramshri的回答,有两种方法可以达到你想要的效果。
1:通过注册实时事件
2:获取您已经从机器获得的所有数据,然后仅重构为您需要的数据。
第一种方法:
public int sta_RegRealTime(ListBox lblOutputInfo)
{
if (GetConnectState() == false)
{
lblOutputInfo.Items.Add("*Please connect first!");
return -1024;
}
int ret = 0;
if (axCZKEM1.RegEvent(GetMachineNumber(), 65535))//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
{
//common interface
this.axCZKEM1.OnFinger += new zkemkeeper._IZKEMEvents_OnFingerEventHandler(axCZKEM1_OnFinger);
this.axCZKEM1.OnVerify += new zkemkeeper._IZKEMEvents_OnVerifyEventHandler(axCZKEM1_OnVerify);
this.axCZKEM1.OnFingerFeature += new zkemkeeper._IZKEMEvents_OnFingerFeatureEventHandler(axCZKEM1_OnFingerFeature);
this.axCZKEM1.OnDeleteTemplate += new zkemkeeper._IZKEMEvents_OnDeleteTemplateEventHandler(axCZKEM1_OnDeleteTemplate);
this.axCZKEM1.OnNewUser += new zkemkeeper._IZKEMEvents_OnNewUserEventHandler(axCZKEM1_OnNewUser);
this.axCZKEM1.OnHIDNum += new zkemkeeper._IZKEMEvents_OnHIDNumEventHandler(axCZKEM1_OnHIDNum);
this.axCZKEM1.OnAlarm += new zkemkeeper._IZKEMEvents_OnAlarmEventHandler(axCZKEM1_OnAlarm);
this.axCZKEM1.OnDoor += new zkemkeeper._IZKEMEvents_OnDoorEventHandler(axCZKEM1_OnDoor);
//only for color device
this.axCZKEM1.OnAttTransactionEx += new zkemkeeper._IZKEMEvents_OnAttTransactionExEventHandler(axCZKEM1_OnAttTransactionEx);
this.axCZKEM1.OnEnrollFingerEx += new zkemkeeper._IZKEMEvents_OnEnrollFingerExEventHandler(axCZKEM1_OnEnrollFingerEx);
//only for black&white device
this.axCZKEM1.OnAttTransaction -= new zkemkeeper._IZKEMEvents_OnAttTransactionEventHandler(axCZKEM1_OnAttTransaction);
this.axCZKEM1.OnWriteCard += new zkemkeeper._IZKEMEvents_OnWriteCardEventHandler(axCZKEM1_OnWriteCard);
this.axCZKEM1.OnEmptyCard += new zkemkeeper._IZKEMEvents_OnEmptyCardEventHandler(axCZKEM1_OnEmptyCard);
this.axCZKEM1.OnKeyPress += new zkemkeeper._IZKEMEvents_OnKeyPressEventHandler(axCZKEM1_OnKeyPress);
this.axCZKEM1.OnEnrollFinger += new zkemkeeper._IZKEMEvents_OnEnrollFingerEventHandler(axCZKEM1_OnEnrollFinger);
ret = 1;
}
else
{
axCZKEM1.GetLastError(ref idwErrorCode);
ret = idwErrorCode;
if (idwErrorCode != 0)
{
lblOutputInfo.Items.Add("*RegEvent failed,ErrorCode: " + idwErrorCode.ToString());
}
else
{
lblOutputInfo.Items.Add("*No data from terminal returns!");
}
}
return ret;
}
及其定义:
//If your fingerprint(or your card) passes the verification,this event will be triggered,only for color device
void axCZKEM1_OnAttTransactionEx(string EnrollNumber, int IsInValid, int AttState, int VerifyMethod, int Year, int Month, int Day, int Hour, int Minute, int Second, int WorkCode)
{
string time = Year + "-" + Month + "-" + Day + " " + Hour + ":" + Minute + ":" + Second;
gRealEventListBox.Items.Add("Verify OK.UserID=" + EnrollNumber + " isInvalid=" + IsInValid.ToString() + " state=" + AttState.ToString() + " verifystyle=" + VerifyMethod.ToString() + " time=" + time);
throw new NotImplementedException();
}
//If your fingerprint(or your card) passes the verification,this event will be triggered,only for black%white device
private void axCZKEM1_OnAttTransaction(int EnrollNumber, int IsInValid, int AttState, int VerifyMethod, int Year, int Month, int Day, int Hour, int Minute, int Second)
{
string time = Year + "-" + Month + "-" + Day + " " + Hour + ":" + Minute + ":" + Second;
gRealEventListBox.Items.Add("Verify OK.UserID=" + EnrollNumber.ToString() + " isInvalid=" + IsInValid.ToString() + " state=" + AttState.ToString() + " verifystyle=" + VerifyMethod.ToString() + " time=" + time);
throw new NotImplementedException();
}
//After you have placed your finger on the sensor(or swipe your card to the device),this event will be triggered.
//If you passes the verification,the returned value userid will be the user enrollnumber,or else the value will be -1;
void axCZKEM1_OnVerify(int UserID)
{
if (UserID != -1)
{
gRealEventListBox.Items.Add("User fingerprint verified... UserID=" + UserID.ToString());
}
else
{
gRealEventListBox.Items.Add("Failed to verify... ");
}
throw new NotImplementedException();
}
第二种方法:
现在让我们假设您已经获取了所有数据,但您只需要在上次提取的之后的数据。举个例子;每次调用axCZKEM1.ReadGeneralLogData(iMachineNumber);
时,都需要将更新后的数据存储到dB中
将返回listData与dB中的值进行比较(使用DateTime column
,因为它将作为表中的唯一值),例如;
ICollection<AttendanceLog> lstMachineInfo = manipulator.GetLogData(objZkeeper2, machineNum);
if (lstMachineInfo != null && lstMachineInfo.Count > 0)
{
var lastRecord = db.yourTableNameHere.OrderByDescending(x => x.DateTime).FirstOrDefault();
if (lastRecord != null)
{
lstMachineInfo = lstMachineInfo.Where(x => x.DateTime > lastRecord.DateTime).ToList();
}
foreach (var p in lstMachineInfo)
{
db.yourTableNameHere.Add(p);
}
db.SaveChanges();
使用第一种方法:
答案 2 :(得分:1)
要执行您想要执行的操作,您可以按照以下步骤操作:
componentDidMount() {
this.fetchData();
}
)。 通过这样做,每次您获取考勤记录时,您都会获得最新信息
您可以尝试在每次有人进入时获取实时事件,但是您将错过在计算机未开启时注册的事件。如果您不想错过任何出勤日志,您应该这样做
此外,您应该在获取日志数据之前禁用该设备,并在从设备中删除它后启用它。您可以使用ClearGLog()
。