This blog post is written as a C# getting started guide while working with a Realtime biometric device in a windows forms application. This is going to be of a 2 series blog post.
- Working directly with the device on the clients machine.
- Working remotely with the device in the server side.
This one particularly focuses on the second one, server side implementation (Auto push technology) of the device.
The provided steps and source code snippets will help you to successfully setup and test out the FP Server application in your computer.
The FP Server
The FP Server is a server side application that retrieves the fingerprint attendance logs from a remote device on real time.
i.e After you have configured the Server endpoint (Server IP and Port) on your Realtime fingerprint device, the next time you take attendance/fingerprint from the device, the logs are directly sent to the remote server instantly on real time.
You need to download and install them separately from the official Realtime Biometrics website.
The download links will be mentioned as you go along with this article.
Table Of Contents
Device Specifications
This blog intends to provide solution for the device models that are listed below. For a complete list of hardware specifications, follow the link embedded in the model names.
Model : T60
FP Users : 3,000/5,000
Card User : 3,000/5,000/10,000
Password User : 3,000/5,000
Attendance Records : 100,000/300,000
Comn : RS485, USB Drive/Link, TCP/IP
Model : C121ta
FP Users : 1,000
Card User : 1,000
Password User : 1,000
Attendance Records : 100,000
Comn. : RS485, USB Drive/Link, TCP/IP
Model : RS20, RS10, RS9
FP Users: 3,000
Card User : 3,000
Password User : 3,000
Attendance Records : 2,00,000
Comn. : Wi-fi, USB Drive/Link, TCP/IP
Model : T52
FP Users : 1,000/3,000/5,000
Card User : 1,000/3,000/5,000/10,000
Password User : 1,000/3,000/5,000
Attendance Records : 100,000
Comn : RS485, USB Drive/Link, TCP/IP
Background
Biometric Devices are being used extensively in many corporations through out the world these days. They are widely used in various fields like social insurance, public security, time attendance, fingerprint encryption, embedded systems and many others.
Companies like Realtime Biometrics manufacture biometric access control and Time and Attendance in various shapes and sizes with different set of features per model. They provide a better way of user authentication and security in organizations comparing to the traditional authentication and authorization mechanisms.
Implementing The SDK
In order to integrate a Realtime biometric device into your application, you first need to successfully setup the sdk toolkit in your local computer. If you have not grabbed a copy of the sdk, go ahead and download a copy of the SDK for your device model from here.
You will also need to download the necessary dlls which can be found in the link entitled ‘Web Attendance Application‘ in the same page.
Once you have a copy of the sdk, Lets see how you can get it installed on your PC.
Step 1 - Install The Necessary Driver
In the SDK bundle, look for a folder containing a file called ‘FPCLOCK_Svr.ocx‘. Once you have located it, you need to register it along with the other provided dlls within that folder, in your system.
The best practice is to copy all the files into your respected systems directory and register them. To have it done in an instant, perform the following steps :
- Create a register.bat file in that same folder and paste in the following code.
- Open up a command prompt in the administration mode and execute the register.bat file.
This will copy the FPClock_Svr.ocx file along with the other necessary files in that folder to one of your systems directory depending on your systems architecture. After copying the files, it will then register it in the system.
If you wish to verify that you have successfully performed the above step, you can perform a query to the systems registry and see if your file is there. Here is how you do it :
- Open a command prompt
- Execute the following command
Step 2 - Add Reference To The Necessary Class Library
The next thing you need to do is to add up the FPCLOCK_Svr Control in your windows form application.
Here is how you do it :
- In the Toolbar, Right click and Press > Choose Items …
- Navigate to the COM Components Section
- Locate the control with the name FPCLOCK_Svr Control
- Click then checkbox and Press OK
- You can now drag the control and place it in your windows form.
You are now ready to implement the code.
Using The Code
The first thing to do is open the network to listen to incoming requests.
Open The Network
The first thing to do is open the network to listen for incoming requests. Here is the code for it :
using AxFPCLOCK_SVRLib;
public void OpenNetwork()
{
int result = fpClockServer.OpenNetwork(serverPortNumber);
if(result == 1)
{
// All Good
}
else
{
// Something terribly went wrong
}
}
Register To An OnReceiveGLogData Event
This is the where the log data sent by the client devices are obtained.
You need to register to the event named OnReceiveGLogData that is provided by the FPCLOCK_Svr Control.
private void axFPCLOCK_Svr1_OnReceiveGLogData_1(object sender, _DFPCLOCK_SvrEvents_OnReceiveGLogDataEvent e)
{
String strKey = Convert.ToString(nIndex + 1);
String str = e.anSEnrollNumber.ToString("D8");
this.listView1.BeginUpdate();
ListViewItem listViewItem = new ListViewItem();
listViewItem.Text = strKey;
listViewItem.SubItems.Add(str);
str = Helpers.FormString(e.anVerifyMode, e.anSEnrollNumber);
listViewItem.SubItems.Add(str);
if (e.anInOutMode == 1)
{
str = "OUT";
}
else if (0 == e.anInOutMode)
{
str = "IN";
}
else
{
str = "--";
}
listViewItem.SubItems.Add(str);
str = Convert.ToString(e.anLogDate.ToString("yyyy/MM/dd HH:mm"));
listViewItem.SubItems.Add(str);
listViewItem.SubItems.Add(e.astrDeviceIP);
str = Convert.ToString(e.anDevicePort);
listViewItem.SubItems.Add(str);
str = Convert.ToString(e.vnDeviceID);
listViewItem.SubItems.Add(str);
str = Convert.ToString(e.linkindex);
listViewItem.SubItems.Add(str);
this.listView1.Items.Add(listViewItem);
this.listView1.Update();
this.listView1.EnsureVisible(nIndex);
this.listView1.EndUpdate();
int nResult = 1;
fpClockServer.SendResultandTime(e.linkindex, e.vnDeviceID, e.anSEnrollNumber, nResult);
nIndex++;
}
Close The Network
After your work is done, you can close the network and stop listening to any incoming request.
using AxFPCLOCK_SVRLib;
public void CloseNetwork()
{
int result = fpClockServer.CloseNetwork(serverPortNumber);
if (result == 0)
{
// Network Closed
}
else
{
// Something went wrong
}
}
Head over to the GitHub code sample and see it in full action.
Go Beyond the frontiers of yourself. Peace !!!
Hi Ozesh
Sorry my English is not good.
I am writing a program with C # to get information about logging in and out of ZKTeco devices.
I read your article in the code project (C # ZKTeco Biometric Device Getting Started) Thank you for this article.
If possible, try to help me with the following:
1. Can I get login and exit information from several devices simultaneously and in real-time?
2. How can I get personnel images from the device and display them in the program?
Thank you very much
negar
Hello,
Answer 1 :
One way to get the user checkin and checkout information is to register to the device events like shown here:
https://github.com/zaagan/BioMetrix/blob/master/BioMetrixCore/Utilities/ZkemClient.cs#L47
Be advised, Different model of devices support different event handling mechanism.
Another way is to make use of the ADMS feature that sends attendance data from registered users to one common central database (mssql, mysql, postgres) on real-time.
Please do some research about the ADMS feature. I think it is however not free and comes with a price.
Answer 2 :
In order to get the image, you need to make use of the ‘CaptureImage’ function.
https://github.com/zaagan/BioMetrix/blob/master/BioMetrixCore/Utilities/ZkemClient.cs#L317
But be advised, Not all zkteco devices support that feature.
Thank you
Hello
Thank you so much for me answer.
I can receive information from a device using the RealTimeEvent function.
But I can not do a few devices.
The previous device is disconnected when a new device is connected.
What is the solution to this problem?
Thank you
Hello,
If you are using the code that I provided in GitHub :
The code currently only works for a single instance (It works with only one device at a time).
https://github.com/zaagan/BioMetrix/blob/master/BioMetrixCore/Master.cs
—— Note the ZkemClient object here ——
i.e If you connect with one device at a particular time and at the same time you try connecting with the other device, then the object ‘objZkeeper’ that is holding the instance of the previous device gets ‘re-initialized’.
A better option for you would be to maintain multiple instances (may be a list) of the ZkemClient to handle multiple devices.
Hello,
Thank you for the article it was very helpful.
My question is will the C# Realtime Biometric Server Implementation handle multiple devices?
Hello Ashiful,
Yes, It will.
The Realtime Biometric Server is designed to handle multiple devices which can be distinguished via the IP address and Port no.
how to configure port?
Hello Ozesh,
I am trying to get attendance data in real time. I am using T52. I downloaded your sample code and also follow the process that you have described. I ran the project in my local computer by visual studio. I am able to connect network from windows application that you uploaded in github. But unfortunately data is not showing in grid. I have connected my T52 with router. The machine IP 192.168.0.104 and my development computer ip is 192.168.0.102. Can you please help me?