zklib-ts 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,98 +1,194 @@
1
1
  export declare enum COMMANDS {
2
2
  CMD_ACK_DATA = 2002,
3
- CMD_ACK_ERROR = 2001,//There was an error when processing the request.
3
+ /** There was an error when processing the request.*/
4
+ CMD_ACK_ERROR = 2001,
4
5
  CMD_ACK_ERROR_CMD = 65533,
5
6
  CMD_ACK_ERROR_DATA = 65531,
6
7
  CMD_ACK_ERROR_INIT = 65532,
7
- CMD_ACK_OK = 2000,//The request was processed sucessfully.
8
+ /** [0xD0, 0x07] The request was processed sucessfully. */
9
+ CMD_ACK_OK = 2000,
8
10
  CMD_ACK_REPEAT = 2004,
9
11
  CMD_ACK_RETRY = 2003,
10
- CMD_ACK_UNAUTH = 2005,//Connection not authorized.
11
- CMD_ACK_UNKNOWN = 65535,//Received unknown command.
12
- CMD_ATTLOG_RRQ = 13,//Request attendance log.
13
- CMD_AUTH = 1102,//Request to begin session using commkey.
14
- CMD_CANCELCAPTURE = 62,//Disable normal authentication of users.
15
- CMD_CAPTUREFINGER = 1009,//Capture fingerprint picture.
16
- CMD_CAPTUREIMAGE = 1012,//Capture the entire image.
17
- CMD_CHANGE_SPEED = 1101,//Change transmission speed.
18
- CMD_CHECKSUM_BUFFER = 119,//Get checksum of machine's buffer.
19
- CMD_CLEAR_ACC = 32,//Restore access control to default.
20
- CMD_CLEAR_ADMIN = 20,//Clears admins privileges.
21
- CMD_CLEAR_ATTLOG = 15,//Delete attendance record.
22
- CMD_CLEAR_DATA = 14,//Delete data.
23
- CMD_CLEAR_LCD = 67,//Clear screen captions.
24
- CMD_CLEAR_OPLOG = 33,//Delete operations log.
25
- CMD_CONNECT = 1000,//Begin connection.
26
- CMD_DATA = 1501,//Data packet.
27
- CMD_DATA_RDY = 1504,//Indicates that it is ready to receive data.
28
- CMD_DATA_WRRQ = 1503,//Read/Write a large data set.
29
- CMD_DB_RRQ = 7,//Read saved data.
30
- CMD_DEL_FPTMP = 134,//Deletes fingerprint template.
31
- CMD_DELETE_SMS = 72,//Delete short message.
32
- CMD_DELETE_UDATA = 74,//Delete user short message.
33
- CMD_DELETE_USER = 18,//Delete user.
34
- CMD_DELETE_USERTEMP = 19,//Delete user fingerprint template.
35
- CMD_DISABLEDEVICE = 1003,//Disables fingerprint, rfid reader and keyboard.
36
- CMD_DOORSTATE_RRQ = 75,//Get door state.
37
- CMD_EMPTY_MIFARE = 78,//Clear Mifare card.
38
- CMD_ENABLE_CLOCK = 57,//Enables the ":" in screen clock.
39
- CMD_ENABLEDEVICE = 1002,//Change machine state to "normal work".
40
- CMD_EXIT = 1001,//Disconnect.
41
- CMD_FREE_DATA = 1502,//Release buffer used for data transmission.
42
- CMD_GET_FREE_SIZES = 50,//Request machine status (remaining space).
43
- CMD_GET_PINWIDTH = 69,//Request max size for users id.
44
- CMD_GET_TIME = 201,//Request machine time.
12
+ /** [0xD5, 0x07] Connection not authorized. */
13
+ CMD_ACK_UNAUTH = 2005,
14
+ /** Received unknown command. */
15
+ CMD_ACK_UNKNOWN = 65535,
16
+ /** Request attendance log. */
17
+ CMD_ATTLOG_RRQ = 13,
18
+ /** [0x4E, 0x04] Request to begin session using commkey. */
19
+ CMD_AUTH = 1102,
20
+ /** [0x3e, 0x00] Disable normal authentication of users. */
21
+ CMD_CANCELCAPTURE = 62,
22
+ /** Capture fingerprint picture. */
23
+ CMD_CAPTUREFINGER = 1009,
24
+ /** Capture the entire image. */
25
+ CMD_CAPTUREIMAGE = 1012,
26
+ /** Change transmission speed. */
27
+ CMD_CHANGE_SPEED = 1101,
28
+ /** [0x77, 0x00] Get checksum of machine's buffer. */
29
+ CMD_CHECKSUM_BUFFER = 119,
30
+ /** Restore access control to default. */
31
+ CMD_CLEAR_ACC = 32,
32
+ /** Clears admins privileges. */
33
+ CMD_CLEAR_ADMIN = 20,
34
+ /** Delete attendance record. */
35
+ CMD_CLEAR_ATTLOG = 15,
36
+ /** Delete data. */
37
+ CMD_CLEAR_DATA = 14,
38
+ /** Clear screen captions. */
39
+ CMD_CLEAR_LCD = 67,
40
+ /** Delete operations log. */
41
+ CMD_CLEAR_OPLOG = 33,
42
+ /** [0xE8, 0x03] Begin connection. */
43
+ CMD_CONNECT = 1000,
44
+ /** [0xDD, 0x05] Data packet. */
45
+ CMD_DATA = 1501,
46
+ /** Indicates that it is ready to receive data. */
47
+ CMD_DATA_RDY = 1504,
48
+ /** Read/Write a large data set. */
49
+ CMD_DATA_WRRQ = 1503,
50
+ /** Read saved data. */
51
+ CMD_DB_RRQ = 7,
52
+ /** Deletes fingerprint template. */
53
+ CMD_DEL_FPTMP = 134,
54
+ /** Delete short message. */
55
+ CMD_DELETE_SMS = 72,
56
+ /** Delete user short message. */
57
+ CMD_DELETE_UDATA = 74,
58
+ /** Delete user. */
59
+ CMD_DELETE_USER = 18,
60
+ /** Delete user fingerprint template. */
61
+ CMD_DELETE_USERTEMP = 19,
62
+ /** Disables fingerprint, rfid reader and keyboard. */
63
+ CMD_DISABLEDEVICE = 1003,
64
+ /** Get door state. */
65
+ CMD_DOORSTATE_RRQ = 75,
66
+ /** Clear Mifare card. */
67
+ CMD_EMPTY_MIFARE = 78,
68
+ /** Enables the ":" in screen clock. */
69
+ CMD_ENABLE_CLOCK = 57,
70
+ /** Change machine state to "normal work". */
71
+ CMD_ENABLEDEVICE = 1002,
72
+ /** [0xE9, 0x03] Disconnect. */
73
+ CMD_EXIT = 1001,
74
+ /** [0xDE, 0x05] Release buffer used for data transmission. */
75
+ CMD_FREE_DATA = 1502,
76
+ /** Request machine status (remaining space). */
77
+ CMD_GET_FREE_SIZES = 50,
78
+ /** Request max size for users id. */
79
+ CMD_GET_PINWIDTH = 69,
80
+ /** Request machine time. */
81
+ CMD_GET_TIME = 201,
45
82
  CMD_GET_USERTEMP = 88,
46
- CMD_GET_VERSION = 1100,//Request the firmware edition.
47
- CMD_GRPTZ_RRQ = 25,//Get group timezone.
48
- CMD_GRPTZ_WRQ = 26,//Set group timezone.
49
- CMD_OPLOG_RRQ = 34,//Read operations log.
50
- CMD_OPTIONS_RRQ = 11,//Read configuration value of the machine.
51
- CMD_OPTIONS_WRQ = 12,//Change configuration value of the machine.
52
- CMD_POWEROFF = 1005,//Shut-down machine.
53
- CMD_PREPARE_DATA = 1500,//Prepare for data transmission.
54
- CMD_REFRESHDATA = 1013,//Refresh the machine stored data.
55
- CMD_REFRESHOPTION = 1014,//Refresh the configuration parameters.
56
- CMD_REG_EVENT = 500,//Realtime events.
57
- CMD_RESTART = 1004,//Restart machine.
58
- CMD_RESUME = 1007,//Change machine state to "awaken".
59
- CMD_SET_TIME = 202,//Set machine time.
60
- CMD_SLEEP = 1006,//Change machine state to "idle".
61
- CMD_SMS_RRQ = 71,//Download short message.
62
- CMD_SMS_WRQ = 70,//Upload short message.
63
- CMD_STARTENROLL = 61,//Start enroll procedure.
64
- CMD_STARTVERIFY = 60,//Set the machine to authentication state.
65
- CMD_STATE_RRQ = 64,//Query state.
66
- CMD_TEST_TEMP = 1011,//Test if fingerprint exists.
67
- CMD_TESTVOICE = 1017,//Test voice.
68
- CMD_TMP_WRITE = 87,//Transfer fp template from buffer.
69
- CMD_TZ_RRQ = 27,//Get device timezones.
70
- CMD_TZ_WRQ = 28,//Set device timezones.
71
- CMD_UDATA_WRQ = 73,//Set user short message.
72
- CMD_ULG_RRQ = 29,//Get group combination to unlock.
73
- CMD_ULG_WRQ = 30,//Set group combination to unlock.
74
- CMD_UNLOCK = 31,//Unlock door for a specified amount of time.
75
- CMD_USER_WRQ = 8,//Upload user data.
76
- CMD_USERGRP_RRQ = 21,//Read user group.
77
- CMD_USERGRP_WRQ = 22,//Set user group.
78
- CMD_USERTEMP_RRQ = 9,//Read user fingerprint template.
79
- CMD_USERTEMP_WRQ = 10,//Upload user fingerprint template.
80
- CMD_USERTZ_RRQ = 23,//Get user timezones.
81
- CMD_USERTZ_WRQ = 24,//Set the user timezones.
82
- CMD_VERIFY_RRQ = 80,//Read verification style of a given user.
83
- CMD_VERIFY_WRQ = 79,//Change verification style of a given user.
84
- CMD_WRITE_LCD = 66,//Prints chars to the device screen.
85
- CMD_WRITE_MIFARE = 76,//Write data to Mifare card.
86
- EF_ALARM = 512,//Triggered alarm.
87
- EF_ATTLOG = 1,//Attendance entry.
88
- EF_BUTTON = 16,//Pressed keyboard key.
89
- EF_ENROLLFINGER = 8,//Upload user data.
90
- EF_ENROLLUSER = 4,//Enrolled user.
91
- EF_FINGER = 2,//Pressed finger.
92
- EF_FPFTR = 256,//Fingerprint score in enroll procedure.
93
- EF_UNLOCK = 32,//Restore access control to default.
83
+ /** Request the firmware edition. */
84
+ CMD_GET_VERSION = 1100,
85
+ /** Get group timezone. */
86
+ CMD_GRPTZ_RRQ = 25,
87
+ /** Set group timezone. */
88
+ CMD_GRPTZ_WRQ = 26,
89
+ /** Read operations log. */
90
+ CMD_OPLOG_RRQ = 34,
91
+ /** Read configuration value of the machine. */
92
+ CMD_OPTIONS_RRQ = 11,
93
+ /** Change configuration value of the machine. */
94
+ CMD_OPTIONS_WRQ = 12,
95
+ /** Shut-down machine. */
96
+ CMD_POWEROFF = 1005,
97
+ /** [0xDC, 0x05] Prepare for data transmission. */
98
+ CMD_PREPARE_DATA = 1500,
99
+ /** [0xF5, 0x03] Refresh the machine stored data. */
100
+ CMD_REFRESHDATA = 1013,
101
+ /** Refresh the configuration parameters. */
102
+ CMD_REFRESHOPTION = 1014,
103
+ /** Realtime events. */
104
+ CMD_REG_EVENT = 500,
105
+ /** Restart machine. */
106
+ CMD_RESTART = 1004,
107
+ /** Change machine state to "awaken". */
108
+ CMD_RESUME = 1007,
109
+ /** Set machine time. */
110
+ CMD_SET_TIME = 202,
111
+ /** Change machine state to "idle". */
112
+ CMD_SLEEP = 1006,
113
+ /** Download short message. */
114
+ CMD_SMS_RRQ = 71,
115
+ /** Upload short message. */
116
+ CMD_SMS_WRQ = 70,
117
+ /** [0x3d, 0x00] Start enroll procedure. */
118
+ CMD_STARTENROLL = 61,
119
+ /** [0x3c, 0x00] Set the machine to authentication state. */
120
+ CMD_STARTVERIFY = 60,
121
+ /** Query state. */
122
+ CMD_STATE_RRQ = 64,
123
+ /** Test if fingerprint exists. */
124
+ CMD_TEST_TEMP = 1011,
125
+ /** Test voice. */
126
+ CMD_TESTVOICE = 1017,
127
+ /** [0x77, 0x00] Transfer fp template from buffer. */
128
+ CMD_TMP_WRITE = 87,
129
+ /** Get device timezones. */
130
+ CMD_TZ_RRQ = 27,
131
+ /** Set device timezones. */
132
+ CMD_TZ_WRQ = 28,
133
+ /** Set user short message. */
134
+ CMD_UDATA_WRQ = 73,
135
+ /** Get group combination to unlock. */
136
+ CMD_ULG_RRQ = 29,
137
+ /** Set group combination to unlock. */
138
+ CMD_ULG_WRQ = 30,
139
+ /** Unlock door for a specified amount of time. */
140
+ CMD_UNLOCK = 31,
141
+ /** Upload user data. */
142
+ CMD_USER_WRQ = 8,
143
+ /** Read user group. */
144
+ CMD_USERGRP_RRQ = 21,
145
+ /** Set user group. */
146
+ CMD_USERGRP_WRQ = 22,
147
+ /** [0x09, 0x00] Read user fingerprint template. */
148
+ CMD_USERTEMP_RRQ = 9,
149
+ /** Upload user fingerprint template. */
150
+ CMD_USERTEMP_WRQ = 10,
151
+ /** Get user timezones. */
152
+ CMD_USERTZ_RRQ = 23,
153
+ /** Set the user timezones. */
154
+ CMD_USERTZ_WRQ = 24,
155
+ /** Read verification style of a given user. */
156
+ CMD_VERIFY_RRQ = 80,
157
+ /** Change verification style of a given user. */
158
+ CMD_VERIFY_WRQ = 79,
159
+ /** Prints chars to the device screen. */
160
+ CMD_WRITE_LCD = 66,
161
+ /** Write data to Mifare card. */
162
+ CMD_WRITE_MIFARE = 76
163
+ }
164
+ export declare enum RTEvent {
165
+ /** Triggered alarm. */
166
+ EF_ALARM = 512,
167
+ /** Attendance entry. */
168
+ EF_ATTLOG = 1,
169
+ /** Pressed keyboard key. */
170
+ EF_BUTTON = 16,
171
+ /** Upload user data. */
172
+ EF_ENROLLFINGER = 8,
173
+ /** Enrolled user. */
174
+ EF_ENROLLUSER = 4,
175
+ /** Pressed finger. */
176
+ EF_FINGER = 2,
177
+ /** Fingerprint score in enroll procedure. */
178
+ EF_FPFTR = 256,
179
+ /** Restore access control to default. */
180
+ EF_UNLOCK = 32,
181
+ /** Registered user placed finger. */
94
182
  EF_VERIFY = 128
95
183
  }
184
+ export declare enum DISCOVERED_CMD {
185
+ /** [0x7f, 0x13] */
186
+ UNKNOWN = 4991,
187
+ /** Returned when the Finger id not exists in the user uid, when attempting to download single finger template */
188
+ FID_NOT_FOUND = 4993,
189
+ /** [0x87, 0x13] i guess is an error reply code, is returned when attempint to read options ~isABCPinEnable and ~T9FunOn */
190
+ UNKNOWN_OR_NOT_SUPPORTED = 4999
191
+ }
96
192
  export type CommandKeys = keyof typeof COMMANDS;
97
193
  export type CommandValues = typeof COMMANDS[CommandKeys];
98
194
  export declare enum Constants {
@@ -102,6 +198,8 @@ export declare enum Constants {
102
198
  MACHINE_PREPARE_DATA_2 = 32130
103
199
  }
104
200
  interface RequestData {
201
+ /** Fixed buffer to start every TCP packet */
202
+ START_TAG: Buffer;
105
203
  DISABLE_DEVICE: Buffer;
106
204
  GET_REAL_TIME_EVENT: Buffer;
107
205
  GET_ATTENDANCE_LOGS: Buffer;