Fingerprint API

Installation

npm install @cutos/core

npm install @cutos/devices

Import dependencies

import {CoreAPI} from '@cutos/core';
import {DeviceFingerprint} from '@cutos/devices';

DeviceFingerprint

Constructor, create fingerprint device instance

let devFingerprint = new DeviceFingerprint(name);
  • name: fingerprint device name
Example:
devFingerprint = new DeviceFingerprint();

DeviceFingerprint.init

Fingerprint initialization

devFingerprint.init(callback);
  • callback: callback function
Example:
devFingerprint.init((result, error) => {
  if (!error) {
    console.log('onDeviceCreate', result)
  } else {
    console.log(error)
  }
});
  • Return result example:
Driver device-fingerprint loaded

DeviceFingerprint.connect

Connect fingerprint

DevFingerprint.connect(path, callback);
  • path: device port
  • callback: callback function
Example:
DevFingerprint.connect('/dev/ttyS1', (result) => {
  console.log(result)
});
  • Return result example:
{
  "status": true,
  "msg": "open success"
}

DeviceFingerprint.auth

Fingerprint recognition mode

DevFingerprint.auth(callback)
  • callback: callback function
Example:
DevFingerprint.auth((data) => {
  console.log('data', data)
})
  • Return result example:
{
  "status": true,
  "msg": "auth mode"
}

DeviceFingerprint.admin

Fingerprint management mode

DevFingerprint.admin(callback)
  • callback: callback function
Example:
DevFingerprint.admin((data) => {
  console.log(data)
})
  • Return result example:
{
  "status": true,
  "msg": "admin mode"
}

DeviceFingerprint.createUser1

Enter fingerprint step 1

DevFingerprint.createUser1(userID, callback)
  • userID: user ID
  • callback: callback function
Example:
DevFingerprint.createUser1(1, (data) => {
  console.log('data', data)
})
  • Return result example:
{
  "status": true
}

DeviceFingerprint.createUser2

Enter fingerprint step 2

DevFingerprint.createUser2(userID, callback)
  • userID: user ID
  • callback: Callback function
Example:
DevFingerprint.createUser2(1, (data) => {
  console.log('data', data)
})
  • Return result example:
{
  "status": true
}

DeviceFingerprint.createUser3

Enter fingerprint step 3

DevFingerprint.createUser3(userID, callback)
  • userID: user ID
  • callback: callback function
Example:
DevFingerprint.createUser3(1, (data) => {
  console.log('data', data)
})
  • Return result example:
{
  "status": true
}

DeviceFingerprint.deleteUser

Delete user

DevFingerprint.deleteUser(userID, callback)
  • userID: user ID
  • callback: callback function
Example:
DevFingerprint.deleteUser(1, (data) => {
  console.log('data', data)
})
  • Return result example:
{
  "status": true
}

DeviceFingerprint.onData

Get fingerprint data information

DevFingerprint.onData(callback)
  • callback: callback function
Example:
device.onData(data => {
  console.log(data)
})
  • Return result example:
{
  "authorized": 0
}

results matching ""

    No results matching ""