tohenk / node-dplib

Digital Persona Fingerprint Library
MIT License
2 stars 1 forks source link

Process exit after first / before next raw capture #5

Closed AdibSS closed 10 months ago

AdibSS commented 11 months ago

It seems like process exited after first capture or before the next capture.

Since it exited without any error or warning, I assume that it is intentional?

code (based on this code sample ):

const fs = require('fs');
const path = require('path');
const dp = require('@ntlab/dplib');
let xstatus = null;
dp.init();
console.log('Readers:', dp.getReaders());
function capture(callback) {
    console.log('\n=== Capture raw image ===\n');
    dp.startAcquire({ raw: true }, (status, data) => {
        switch (status) {
            case 'disconnected':
                if (xstatus != status) {
                    console.log('Please connect fingerprint reader...');
                }
                break;
            case 'connected':
                console.log('Swipe your finger to capture the image...');
                break;
            case 'error':
                break;
            case 'complete':
                dp.stopAcquire(() => {
                    callback(data);
                });
                break;
        }
        xstatus = status;
    });
}
function loopCapture() {
    capture(async (data) => {
        const filename = path.join(process.cwd(), 'finger.bmp');
        fs.writeFileSync(filename, Buffer.from(data));
        console.log(`Saved to ${filename}`);
        loopCapture();
    });
};

loopCapture();

console: image

On console, the process exited after I put my finger on the reader.

Is this how it is intended? If so, is there any way to make it looping, instead of exiting after one capture?

I tried the other code sample and the process doesn't exit after enrolling once, only after matching / identification which is intended on the code. So it looks like it's not something from my system environment that's messing with the process.

tohenk commented 10 months ago

Fixed in 24cdcef7933771b0dc17c52baa8dd8e48dad531b.

AdibSS commented 10 months ago

oh it's a bug it's properly working now, great job 👍