/node-anviz

NPM package to communicate with Anviz devices.

Primary LanguageJavaScriptMIT LicenseMIT

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