0.2.11 • Published 5 years ago

zklib v0.2.11

Weekly downloads
39
License
GPL-3.0
Repository
github
Last release
5 years ago

Build Status

node-zklib

Attendance Machine Library for NodeJS with a connection to the network using the UDP protocol and port 4370

Install with:

npm install zklib

Usage

const ZKLib = require('zklib');

ZK = new ZKLib({
  ip: '192.168.5.11',
  port: 4370,
  inport: 5200,
  timeout: 5000,
});

// connect to access control device
ZK.connect(function(err) {
  if (err) throw err;

  // read the time info from th device
  ZK.getTime(function(err, t) {
    // disconnect from the device
    ZK.disconnect();

    if (err) throw err;

    console.log("Device clock's time is " + t.toString());
  });
});

Configuration

OptionRequiredValuesDefault
ipyesstring
port-number4370
inportyesnumber
timeout-number-
attendanceParser- 'legacy', 'v6.60' 'legacy'
connectionType- 'udp', 'tcp' 'udp'

Currently only getAttendance was tested with TCP

API

  • connect(callback) -> To Connect in machine.
  • disconnect() -> Disconnect connection with machine.
  • serialNumber(callback) -> Get serial number machine.
  • version(callback) -> Get version of machine.
  • enableDevice(callback) -> Enable the device.
  • disableDevice(callback) -> Disable the device.
  • getAttendance(callback) -> Get attendance data.
  • clearAttendanceLog(callback) -> Clear the attendance logs from device.
  • getTime(callback) -> Get time of machine.
  • setTime(value, callback) -> Set time in machine.
  • getUser(callback) -> Get all user in machine.

Handle Callback

ZK.getTime(function(err, time) {
  if (err) throw err;
  console.log("Device clock's time is " + time.toString());
});

Testing

yarn test

Release Process

To release a new version

  1. Make sure current master branch is green on CI
  2. Ensure your local copy is up-to-date, then run sh ./scripts/release-branch.sh. This will create the x.x.x branch and assign tag x.x.x to HEAD and push it all to git origin
  3. CI will automatically create a NPM release if the build is passing.

Contributors

How to Contribute

  • Open a pull request

Notes about versions

  • v0.1.x - Supported nodejs version: >= 0.10.48
  • v0.2.x - Supported nodejs version: >= 7.5.0

Credits

Based on php_zklib (https://github.com/dnaextrim/php_zklib)

0.2.11

5 years ago

0.2.10

6 years ago

0.2.8

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.0.8

9 years ago

0.0.7

9 years ago

0.0.6

9 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago