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.
I'm accepting PR's if anyone wants to jump in.
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);
});
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.
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.
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 | π΄ |
MIT