zklib
Version:
Attendance Machine Library for NodeJS with a connection to the network using the UDP protocol and port 4370
25 lines (22 loc) • 469 B
JavaScript
const timeParser = require('./timestamp_parser');
module.exports.name = 'legacy';
module.exports.parse = attdata => ({
uid:
parseInt(
attdata
.slice(0, 4)
.toString('ascii')
.split('\0')
.shift()
) || 0,
id:
parseInt(
attdata
.slice(4, 8)
.toString('ascii')
.split('\0')
.shift()
) || 0,
state: attdata[28],
timestamp: timeParser.decode(attdata.readUInt32LE(29))
});