ZkTecoFingerPrint 1.2.1

dotnet add package ZkTecoFingerPrint --version 1.2.1
NuGet\Install-Package ZkTecoFingerPrint -Version 1.2.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZkTecoFingerPrint" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZkTecoFingerPrint --version 1.2.1
#r "nuget: ZkTecoFingerPrint, 1.2.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ZkTecoFingerPrint as a Cake Addin
#addin nuget:?package=ZkTecoFingerPrint&version=1.2.1

// Install ZkTecoFingerPrint as a Cake Tool
#tool nuget:?package=ZkTecoFingerPrint&version=1.2.1

ZkTecoFingerPrint:

a robust and simple to use library to use ZkTeco Fingerprint Reader Device.

this library uses native ZkTeco dlls directly instead of the buggy libzkfpcsharp implementation shipped with the SDK

Installation:

Nuget Pacakge Downloads
Latest version Downloads
dotnet add package ZkTecoFingerPrint

Usage:

  1. Initiliaze and Query devices count:
// Initialize the ZkTeco Library first
ZkTecoFingerHost.Initialize();

// Get how many ZkTeco devices are connected
var deviceCount = ZkTecoFingerHost.GetDeviceCount();
  1. Using a device (The recommended way):

/*
Watching a device for fingerprints
PS: if device count is 1, deviceIndex is 0
*/
var deviceObservable = ZkTecoFingerHost.ObserveDevice(deviceIndex: 0)
                .Where(deviceResult => deviceResult.IsSuccess)
                .Select(deviceResult => deviceResult.Value)
                .Do(fingerPrintResult =>
                    {
                        var bitmapImage = fingerPrintResult.Bitmap;
                        var fingerPrintTemplate = fingerPrintResult.Template;
                        /*
                         * ...store in a db or whatever
                         */
                    })
                .Subscribe();
(open device is exclusive to the application using it and cannot be used elsewhere before closing it or terminating the application)
  1. Closing a device:
deviceObservable.Dispose();
ZkTecoFingerHost.Close();
  1. Comparing a fingerprint template against another:
var minimumSimilarity = 50;
var similarityRatio = fingerPrintResult.Match(template: anotherTemplate);

if(similarityRatio >= 50)
{
    /* ... */ 
}
  • Example usage identifying a user from database:
// db.GetAll<User>() is a hypothetical database query
var users = db.GetAll<User>();
var matchedUser = fingerPrintResult.Identify<User>(candidates: users,
                                    templateSelector: user => user.ingerPrintTemplate,
                                    threshold: 50);
  1. Getting Device Information:

Polling for fingerprints manually:

ZkTecoFingerHost.Initialize();

var deviceCount = ZkTecoFingerHost.GetDeviceCount();

if (deviceCount > 0)
{
    var deviceResult = ZkTecoFingerHost.OpenDevice(0);
    if (deviceResult.IsSuccess)
    {
        var device = device.Value;
        while (true)
        {
            var fingerprintResult = await AcquireFingerprintAsync();
            if (fingerprintResult.IsSuccess)
            {
                var fingerprint = fingerprintResult.Value;
                /*
                 * ....
                 */
            }
        }
    }
}

Missing ZkTeco features found in SDK:

  • This library uses SourceAFIS for fingerprint templates and matching instead of ZkTeco's
  • DB functions from the SDK were deemed unnecessary, so they weren't implemented.

Rant about ZkTeco

The ZkTeco SDK and C# library is the worst API I've ever had to deal with. Those dumb developers at ZkTeco should be ashamed of releasing an SDK in this state.

If you want to interface with a fingerprint device programmatically, avoid ZKTECO products.

After wasted hours and frustrating trials and errors, I ended up creating a more sane way to use the Abomination, which is the ZkTeco USB Fingerprint Reader, still not perfect but a dozen times better than their own SDK.

Message to ZkTeco Developers or whoever is in charge of making SDKs:

Your C++ library interface sucks, with no documentation. Your.net library is just a half-ass attempt at wrapping your shitty dlls. Why the fuck don't you interface with your USB devices directly using the proper.net library?

I can make your SDK better and faster, and it does not make whoever uses it want to shoot themselves rather than spend any more seconds trying to decipher why and how things are done.

Bugs and Issues:

If the issue can be fixed by tweaking the C# code, I'm open to suggestions and code contributions.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.1 228 11/20/2023
1.2.0 105 11/15/2023
1.1.0 99 11/15/2023
1.0.5 107 11/15/2023
1.0.4 106 11/15/2023
1.0.3-beta 97 10/27/2023
1.0.2-beta 91 10/27/2023
1.0.1-beta 111 10/27/2023
1.0.0-beta 99 10/27/2023