Scanners tested
This was tested with the U.are.U 4000B and 4500 scanners.
The DPFJ and DPFPDD libraries
I stumbled upon this library, that aims to allow communication between a nodejs application and the DLL/SO of the DPFJ and DPFPDD libraries created by DigitalPersona/HID Global.
Initializing the reader
Once the fingerprint reader is connected, it must first be initialized.
const { UareU, CONSTANTS } = require("uareu-node");
const uareu = UareU.getInstance();
let reader;
const initializeScanner = async () => {
return await uareu
.loadLibs("./bin/dpfpdd.dll", "./bin/dpfj.dll")
.then(() => {
uareu.dpfpddInit();
})
.then(async () => {
const devices = await uareu.dpfpddQueryDevices();
if (devices.devicesNumber > 0) {
return devices;
}
})
.then((res) => res && uareu.dpfpddOpen(res.devicesList[0]))
.then((res) => res && (reader = res))
.catch((err) => {
throw err;
});
};
The DLL files at .loadLibs("./bin/dpfpdd.dll", "./bin/dpfj.dll")
are provided by DigitalPersona/HID Global
Fingerprint identification
The application: an ElectronJS application that captures fingerprints to record staff attendance.
const identifyForAttendance = async () => {
await uareu.dpfpddCancel(reader);
return await uareu.dpfpddCaptureAsync(
reader,
CONSTANTS.DPFPDD_IMAGE_FMT.DPFPDD_IMG_FMT_ANSI381,
CONSTANTS.DPFPDD_IMAGE_PROC.DPFPDD_IMG_PROC_DEFAULT,
identifyForAttendanceCallback
);
};
const identifyForAttendanceCallback = async (data) => {
uareu
.dpfjCreateFmdFromFid(
data,
CONSTANTS.DPFJ_FMD_FORMAT.DPFJ_FMD_ANSI_378_2004
)
.then(async (res) => {
let FMD_LIST = await AllFingerprints();
let result;
for (let index = 0; index < FMD_LIST.length; index++) {
const fmd = FMD_LIST[index];
result = await uareu.dpfjCompare(res, fmd);
if (result.resultMessage === "Fingers match.") {
await RecordAttendance(fmd.Staff);
ipcMain.emit("staff:found", fmd);
return;
}
}
ipcMain.emit("staff:notfound");
})
.catch((error) => {
console.log(error);
});
};
Fingerprint enrolment
See this article to learn how to enrol fingerprints.