node-anviz
NPM package to communicate with Anviz devices.
The aim of this project is to implement the TC_B Communication Protocol (V2.15) provided by anviz via e-mail on April 2019 (See dev/tcb_communications_protocol2.5.pdf).
The protocol is not completely implemented, but it's usable.
Want to contribute? Great!
I'm accepting PR's if anyone wants to jump in.
Usage
Install the module
npm install node-anviz
Call a supported method:
const anviz = require("node-anviz");
let request = new anviz.Request("<device ip>");
request.execute("getInformation1", 1).then((res, raw) => {
console.info(res, raw);
request.close();
}, (err) => {
console.info("ERROR", err);
});
Notes
Calling a method returns a Promise.
You should implement your own mutex/sync logic and should only execute one command at a time: The library tries to prevent you from doing it but don't really enforce, it should be up to the implementer to assure proper syncing of calls.
I believe the best way to implement this library is to implement it on an async/await fashion, I've included example files async-downloadRecords.js and async-example.js to help illustrate my point.
Documentation
This project has been a bit sidetracked for years, I implement methods as I need them (to use them on my devices & projects). All implemented methods are documented on the examples folder, with one example per method. So if you want to call a method you'll find a valid call there.
Methods status:
PLEASE NOTE: The method descriptions were taken out DIRECTLY from the protocol document (check the pdf on the dev/ folder); Do not make me questions about the descriptions, some of them are incomprehensible.
| ID | Method Description | Command | Status | Name | Tested On Device |
|---|---|---|---|---|---|
| 1 | Get Device Configuration 1 | 0x30 | getInformation1 | ||
| 2 | Set Device Configuration 1 | 0x31 | setInformation1 | ||
| 3 | Get Device Configuration 2 | 0x32 | getInformation2 | ||
| 4 | Set Device Configuration 2 | 0x33 | |||
| 5 | Get Device Date/Time | 0x38 | getDateTime | ||
| 6 | Set Device Date/Time | 0x39 | setDateTime | ||
| 7 | Get Network Configuration | 0x3A | getNetworkConfiguration | ||
| 8 | Set Network Configuration | 0x3B | |||
| 9 | Get Records Info | 0x3C | getRecordInformation | ||
| 10 | Download T&A Records | 0x40 | downloadAttendanceRecords | ||
| 11 | Upload T&A Record | 0x41 | uploadRecord | ||
| 12 | Download User's Info | 0x42 | |||
| 13 | Upload User’s Info | 0x43 | |||
| 14 | Download FP Template | 0x44 | |||
| 15 | Upload FP Template | 0x45 | |||
| 16 | Get Device ID | 0x46 | |||
| 17 | Set Device ID | 0x47 | |||
| 18 | Get Device Model code | 0x48 | getDeviceModel | ||
| 19 | Set Device Model Code | 0x49 | |||
| 20 | Get Manufacture Code | 0x4A | |||
| 21 | Set Manufacture Code | 0x4B | |||
| 22 | Delete Designated User Data | 0x4C | |||
| 23 | Initialize User Profile | 0x4D | |||
| 24 | Erase all Records/ New Records Flag | 0x4E | eraseNewRecordsFlag | ||
| 25 | Initialize System | 0x4F | |||
| 26 | Get Timezone | 0x50 | |||
| 27 | Set Timezone | 0x51 | |||
| 28 | Get Group Info | 0x52 | |||
| 29 | Set Group Information | 0x53 | |||
| 30 | Get Alarm Setting | 0x54 | |||
| 31 | Set Alarm | 0x55 | |||
| 32 | Get Indexed Messages | 0x56 | |||
| 33 | Add Index Message | 0x57 | |||
| 34 | Get Headers of All Index MSG | 0x58 | |||
| 35 | Delete Index Message | 0x59 | |||
| 36 | Get T&A Status Parameters List | 0x5A | |||
| 37 | Set T&A Status Parameters List | 0x5B | |||
| 38 | Enroll Fingerprint Online | 0x5C | |||
| 39 | Get Device Capacity Parameter | 0x5D | |||
| 40 | Unlock Door Without Authentication | 0x5E | |||
| 41 | Output T&A Records in Real Time | 0x5F | |||
| 42 | Get Customized T&A Statuses | 0x70 | |||
| 43 | Set Customized T&A Statuses | 0x71 | |||
| 44 | Download User Data Extended | 0x72 | |||
| 45 | Upload User Data Extended | 0x73 | |||
| 46 | Get Communication Device ID | 0x74 | |||
| 47 | Modify Communication Device ID | 0x75 | |||
| 48 | Clear Admin Flag | 0x3D | |||
| 49 | Get Time Stamp | 0x3E | |||
| 50 | Set Time Stamp | 0x3F | |||
| 51 | Get Random Number | 0x76 | |||
| 52 | Encrypt Device Model and Language Options with a Random Number | 0x77 | |||
| 53 | Get Specified Index Message | 0x26 | |||
| 54 | Add a Indexed Message | 0x27 | |||
| 55 | Get Headers of a Ranged Message | 0x28 | |||
| 56 | Delete a indexed Message | 0x29 | |||
| 57 | Get T&A Status Auto Switching Setting | 0x20 | |||
| 58 | Set T&A Status Auto Switching Setting | 0x21 | |||
| 59 | Get the Number of Daily Remaining Attempts of a Specified User | 0x10 | |||
| 60 | Set Daily Attempts Number of a Specified User | 0x10 | |||
| 61 | Download User Data Extended | 0x22 | |||
| 62 | Upload User Data Extended | 0x23 | |||
| 63 | Get Device Serial Number | 0x24 | |||
| 64 | Modify Device Serial Number | 0x25 | |||
| 65 | Get Special State | 0x2F | |||
| 66 | Get Number of All Images | 0x2A | |||
| 67 | Get Image Headers | 0x2B | |||
| 68 | Get a Specified Image File | 0x2C | |||
| 69 | Delete a Specified Image | 0x2D | |||
| 70 | Update Firmware/Image/Voice | 0x10 | |||
| 71 | Directory Operation | 0x12 | |||
| 72 | Download Log Files | 0x13 | |||
| 73 | Get Admin Card ID/ Password | 0x1C | |||
| 74 | Set Admin Card ID/ Password | 0x1D | |||
| 75 | Get Daylight Saving Parameters | 0x1A | |||
| 76 | Set Daylight Saving Parameters | 0x1B | |||
| 77 | Get Language Options | 0x18 | |||
| 78 | Set Language Options | 0x19 | |||
| 79 | Send Feature Value/ Card ID to T&A Device | 0x78 | |||
| 80 | Get GPRS Parameters | 0x16 | |||
| 81 | Set GPRS Parameters | 0x17 | |||
| 82 | Get Device Extended Info | 0x7A | |||
| 83 | Modify Device Extended Info | 0x7B | |||
| 84 | Get Card Number | 0x7E | |||
| 85 | Get Reboot Time | 0x14 | |||
| 86 | Set Reboot Time | 0x15 | |||
| 87 | Extended Commands | 0x2E | |||
| 88 | UDP Search Device | 0x02 | |||
| 89 | UDP Set Device Parameter | 0x03 | |||
| 90 | Heartbeat Package | 0x7F | |||
| 91 | Data Modification Alert | 0x7D | |||
| 92 | Download Personnel Change Records | 0x64 | |||
| 93 | Download User’s Information Extended | 0x65 | |||
| 94 | Clear Change of Personnel Records/ Flags | 0x1E | |||
| 95 | Get Device Configuration 3 | 0x34 | |||
| 96 | set Device Configuration 3 | 0x35 | |||
| 97 | Connection Authentication | 0x04 | |||
| 98 | Get Device Configuration4 | 0x36 | |||
| 99 | Add Department | 0x61 | |||
| 100 | Delete Department | 0x62 | |||
| 101 | Download a Specified User’s Templates/Images | 0x66 | |||
| 102 | Batch Download Users’ Images | 0x67 | |||
| 103 | Get Result of Last Authentication Pass/Fail | 0x79 | |||
| 104 | Get Timezone Mode Status | 0x68 | |||
| 105 | Set Timezone Mode Status | 0x69 | |||
| 106 | Upload User’s images | 0x6D | |||
| 107 | Add BT Device/User | 0x6A | |||
| 108 | Delete Specific Address of Bluetooth Device | 0x6B | |||
| 109 | Get Information of All Bluetooth Devices | 0x6C | |||
| 110 | Get IEEE802.11 Network Setting | 0x6E | |||
| 111 | Set IEEE 802.11 Network setting | 0x6F | |||
| 112 | Get Authorization Code | 0x05 | |||
| 113 | Authorize | 0x06 | |||
| 114 | UDP Start Video | 0x07 | |||
| 115 | UDP Stop Video | 0x08 | |||
| 116 | UDP Command | 0x09 | |||
| 117 | Get Server URL | 0x0A | getServerURL | ||
| 118 | Set Server URL | 0x0B | setServerURL | ||
| 119 | Test User | 0x0C |
License
MIT