Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sergiss/anviz-protocol
:hear_no_evil: Javascript library to communicate with Anviz devices
https://github.com/sergiss/anviz-protocol
anviz facepass-7 javascript nodejs protocol
Last synced: 1 day ago
JSON representation
:hear_no_evil: Javascript library to communicate with Anviz devices
- Host: GitHub
- URL: https://github.com/sergiss/anviz-protocol
- Owner: sergiss
- License: mit
- Created: 2022-05-28T09:13:32.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-06-24T15:04:38.000Z (over 2 years ago)
- Last Synced: 2024-07-30T20:04:36.263Z (6 months ago)
- Topics: anviz, facepass-7, javascript, nodejs, protocol
- Language: JavaScript
- Homepage:
- Size: 20.5 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Anviz-protocol
Javascript library to communicate with Anviz devices.
Tested with FacePass 7
## Features:
- Real Time Mode (Record Events)
- Get/Set Device Id
- Get/Set Device Info1
- Get/Set Device Info2
- Get Serial Number
- Get/Set Date Time
- Get Record Information
- Get Records
- Clear Records
- Get/Set User Info
- Get/Set FP Template
- Open Lock
### How to use:
```
const { Device, UserInfo } = require("./index.js");
const host = '192.168.0.110'; // Device IP
var device = new Device(host);
device.listener = {
onRecord: (record)=> {
console.log(record);
console.log(new Date(record.dateTime));
device.clearAllRecordsSign();
device.openLock();
},
onError: (e)=> {
console.log(e);
},
onConnectionLost: () => {
console.log("Connection lost");
}
}
device.connect(); // Open connection
device.getSerialNumber((serialNumber)=> {
console.log("Serial: " + serialNumber);
});
// Set local date time
device.setDateTime(new Date());
device.getRecordInformation((info)=> {
// console.log(info);
});
device.getDeviceInfo1((info)=> {
info.volume = 0;
// info.language = 4; // 4 spanish
device.setDeviceInfo1(info);
});
device.getDeviceInfo2((info)=> {
// console.log(info);
info.realTimeModeSetting = 1; // enable real time mode
info.relayMode = 3; // 0 control lock, 1 scheduled bell, 3 disabled
info.lockDelay = 2; // 2 seconds
device.setDeviceInfo2(info);
// Notify records
device.getNewRecords((records)=> {
for(let i = 0; i < records.length; ++i) {
device.listener.onRecord(records[i]);
}
device.clearAllRecordsSign();
});
});
...
device.disconnect(); // Close connection
```
www.sergiosoriano.com