muaazh / zkteco_pullsdk_wrapper Goto Github PK
View Code? Open in Web Editor NEWA wrapper for ZKTeco's pullsdk & ZKFinger
A wrapper for ZKTeco's pullsdk & ZKFinger
Device name is zkteco k60 Fingerprint access control
After a while of using the library, I'm encountering some problems. Below is my code:
public void btn_conectar_Click(object sender, EventArgs e)
{
if (btn_Connect.Text == "Connect")
{
foreach (var item in _currentSettings)
{
item.AccessPanelData = new AccessPanel();
// connect
if (!item.AccessPanelData.Connect(item.IP, item.Port.Value, 0, item.TimeOuts.Value))
{
logger.Information("Cannot connect:" + item.IP);
MessageBox.Show("Cannot connect this ip " + item.IP + ". Error", "Infomation", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
else
{
logger.Information("Start with IP:" + item.IP);
//call function run backgroud
Task.Run(() => BackgroundTask(item));
}
}
btn_Connect.Text = "Disconnect";
}
else
{
foreach (var item in _currentSettings)
{
item.AccessPanelData.Disconnect();
}
listBoxActive.Items.Clear();
btn_Connect.Text = "Connect";
}
}
//Create thread run backgroud
async Task BackgroundTask(Settings setting)
{
while (setting.IsActive)
{
await Task.Delay(1000);
var listLog = csetting.AccessPanelData.GetEventLog();
if (listLog != null && listLog.Events != null)
{
var list = listLog.Events;
foreach (var item in list)
{
if (list_log1.Items.Count > 20)
{
list_log1.Invoke(new MethodInvoker(() => list_log1.Items.Clear()));
}
list_log1.Invoke(new MethodInvoker(() =>
{
list_log1.Items.Add(setting.IP);
var index = list_log1.Items.Count - 1;
list_log1.Items[index].SubItems.Add(item.Time);
list_log1.Items[index].SubItems.Add(item.Pin);
list_log1.Items[index].SubItems.Add(item.inputString);
list_log1.Items[index].SubItems.Add(item.Door);
list_log1.Items[index].SubItems.Add(item.EventType.ToString());
list_log1.Items[index].SubItems.Add(item.InOrOut.ToString());
list_log1.Items[index].SubItems.Add("");
list_log1.Items[index].SubItems.Add("");
}));
//item.inputString is code I will check to access open door
if (item.inputString.Length > 5 && setting.intPtr != IntPtr.Zero)
{
// call function check true false can access open door
var ticket = await ServiceConnection.CheckTicketAsync(item.inputString, setting.IP);
if (CheckCong(item.inputString, setting.IP) && ticket.ActiveID != null)
{
//create another thread to open Door
var task = Task.Run(async () =>
{
//NumberOfOpenDoor > 1 Open the door multiple times, each time 3 seconds apart
for (int k = 0; k < ticket.NumberOfOpenDoor; k++)
{
setting.AccessPanelData.OpenDoor(1, 1);
//wait 3s
await Task.Delay(3000);
}
});
await task;
}
}
}
}
}
}
The above code works normally, but there is a problem that when used to open the door multiple times, the next time will have to wait the entire time of the first time.
For example, code 1234 opens the door 10 times after opening the door 3 seconds apart as set.
When using code 1235, you will have to wait 10*3=30 seconds for the system to continue opening.
i think the problem is await Task.Delay(3000); must not be removed.
Do you have any way to optimize this problem? Solve the problem of opening the door multiple times when using 1 code.
Can I know what is AccessPanel use QR500?
_failCount
is used to avoid device freezes and silent tcp drops. If an operation succeeds, it should be reset to zero probably. PRs are welcome.
Can I use your DLL files as com interfaces for interaction in other programs? I tried to register your libraries via regsvr32 but I always get the DllRegisterServer error. I also tried to register libzkfp.dll and libzkfpcsharp.dll but without success, even though they are in the C folder: \Windows\SysWOW64
while trying to connect to the device via the code
`using PullSDK_core;
AccessPanel device = new AccessPanel();
// connect
if (!device.Connect("192.168.1.201", 4370, 123456, 5000)) {
return; // could not connect
}`
i get this Exception
Unhandled exception. System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (0x8007000B)
i am using x64 bit OS
I am trying to install it but it kept closing the doors.
Could you provide more details about the intallation process.
all respect.
I wanted to try your wrapper but I can't get it to connect to my access cards. I put up an example repo of how I am attempting to use it at https://github.com/valeryan/zk-access-control
I have 2 US-C3-400-PROs on my local network at 192.168.1.100 and 101. I can ping the cards but when I try to connect to them using your wrapper I can't get a connection. I have the zkaccess software installed and I can connect to the devices with the software. I have confirmed in the software that the cards are configured for port 4370 and have no password set.
I believe the C3 cards are compatible with PullSDK.
Do you have any suggestions?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.