ZK class
The main class for interacting with a ZKTeco biometric device.
This class provides a comprehensive set of methods for managing the device, including connecting, fetching data, managing users, and controlling device operations. It is composed of several mixins, each handling a specific area of functionality.
Constructors
Properties
- adminsCount ↔ int
-
The number of administrators registered on the device.
getter/setter pairinherited
-
dataPacketCompleter
↔ Completer<
Uint8List> ? -
A completer for handling large data packets.
getter/setter pairinherited
- facesCapacity ↔ int
-
The maximum number of face templates the device can store.
getter/setter pairinherited
- facesCount ↔ int
-
The number of face templates stored on the device.
getter/setter pairinherited
- fingersCapacity ↔ int
-
The maximum number of fingerprint templates the device can store.
getter/setter pairinherited
- fingersCount ↔ int
-
The number of fingerprint templates stored on the device.
getter/setter pairinherited
- forceUdp → bool
-
Whether to force UDP communication (not yet supported).
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- incomingBuffer → BytesBuilder
-
A buffer for incoming data from the socket.
finalinherited
- ip → String
-
The IP address of the ZKTeco device.
final
- isConnected ↔ bool
-
Whether the device is currently connected.
getter/setter pairinherited
- password → int
-
The device's communication password.
final
- passwordsCount ↔ int
-
The number of passwords stored on the device.
getter/setter pairinherited
-
pendingReplies
→ Map<
int, Completer< Uint8List> > -
A map of pending replies, keyed by reply ID.
finalinherited
- port → int
-
The port number for the device connection.
final
- recordsCapacity ↔ int
-
The maximum number of attendance records the device can store.
getter/setter pairinherited
- recordsCount ↔ int
-
The number of attendance records stored on the device.
getter/setter pairinherited
- replyId ↔ int
-
The reply ID used to track command-response pairs.
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sessionId ↔ int
-
The session ID assigned by the device upon connection.
getter/setter pairinherited
- socketSubscription ↔ StreamSubscription?
-
The subscription to the socket's stream of data.
getter/setter pairinherited
- tcpSocket ↔ Socket?
-
The underlying TCP socket for communication.
getter/setter pairinherited
- timeout → int
-
The connection timeout in seconds.
final
- userPacketSize ↔ int
-
The size of the user data packet.
getter/setter pairinherited
- usersCapacity ↔ int
-
The maximum number of users the device can store.
getter/setter pairinherited
- usersCount ↔ int
-
The number of users currently stored on the device.
getter/setter pairinherited
Methods
-
auth(
) → Future< void> -
Authenticates with the device using the provided password.
inherited
-
clearAttendance(
) → Future< void> -
Clears all attendance records from the device.
inherited
-
clearData(
) → Future< void> -
Clears all data from the device, including users, attendance records,
and fingerprint templates.
inherited
-
connect(
) → Future< void> -
Establishes a connection to the ZKTeco device.
inherited
-
createChecksum(
Uint8List p) → Uint8List -
Calculates the checksum for a command packet.
(Internal use only)
inherited
-
createHeader(
int command, Uint8List commandString, int sessionId, int replyId) → Uint8List -
Creates the 8-byte header for a command packet.
(Internal use only)
inherited
-
decodeString(
Uint8List data, {Encoding encoding = utf8}) → String -
Decodes a null-terminated string from a byte list.
(Internal use only)
inherited
-
decodeTime(
int t) → DateTime -
Decodes a ZKTeco timestamp integer into a DateTime object.
(Internal use only)
inherited
-
deleteUser(
{int? uid, String? userId}) → Future< void> -
Deletes a user from the device.
inherited
-
disableDevice(
) → Future< void> -
Disables the device, preventing it from accepting user input.
inherited
-
disconnect(
) → Future< void> -
Disconnects from the ZKTeco device.
inherited
-
enableDevice(
) → Future< void> -
Enables the device, allowing it to accept user input and perform operations.
inherited
-
encodeTime(
DateTime t) → int -
Encodes a DateTime object into a ZKTeco timestamp integer.
(Internal use only)
inherited
-
freeData(
) → Future< void> -
Frees the data buffer on the device.
inherited
-
getAttendance(
{DateTime? fromDate, DateTime? toDate, String sort = 'desc'}) → Future< List< Attendance> > -
Retrieves attendance records from the device.
inherited
-
getDeviceName(
) → Future< String> -
Retrieves the name of the device.
inherited
-
getFaceVersion(
) → Future< int?> -
Retrieves the face recognition algorithm version.
inherited
-
getFingerprintVersion(
) → Future< int> -
Retrieves the fingerprint algorithm version.
inherited
-
getFirmwareVersion(
) → Future< String> -
Retrieves the firmware version of the device.
inherited
-
getMacAddress(
) → Future< String> -
Retrieves the MAC address of the device.
inherited
-
getNetworkParams(
) → Future< Map< String, String> > -
Retrieves the network parameters (IP, subnet mask, gateway) of the device.
inherited
-
getPlatform(
) → Future< String> -
Retrieves the platform information of the device.
inherited
-
getSerialNumber(
) → Future< String> -
Retrieves the serial number of the device.
inherited
-
getTime(
) → Future< DateTime> -
Retrieves the current time from the device.
inherited
-
getUsers(
) → Future< List< User> > -
Retrieves a list of all users from the device.
inherited
-
handleResponse(
Uint8List data) → void -
Handles incoming data from the TCP socket.
inherited
-
makeCommandKey(
int key, int sessionId) → Uint8List -
Creates the authentication key for the
authcommand. (Internal use only)inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
parseHeader(
Uint8List data) → List< int> -
Parses the 8-byte header from a response packet.
(Internal use only)
inherited
-
powerOff(
) → Future< void> -
Powers off the device.
inherited
-
readChunk(
int start, int size) → Future< Uint8List> -
Reads a chunk of data from the device's buffer.
(Internal use only)
inherited
-
readSizes(
) → Future< void> -
Reads the device's capacity information (number of users, fingerprints, etc.)
and populates the corresponding properties in
ConnectionMixin.inherited -
readWithBuffer(
int command, {int fct = 0, int ext = 0}) → Future< Uint8List> -
Reads large data records (like users or attendance logs) from the device.
inherited
-
refreshData(
) → Future< void> -
Refreshes the device's internal data.
inherited
-
restart(
) → Future< void> -
Restarts the device.
inherited
-
sendCommand(
int command, {Uint8List? commandString, bool bypassConnectionCheck = false}) → Future< Uint8List> -
Sends a command to the device and waits for a reply.
inherited
-
setTime(
DateTime timestamp) → Future< void> -
Sets the time on the device.
inherited
-
setUser(
{int? uid, String name = '', int privilege = 0, String password = '', String groupId = '', String? userId, int card = 0}) → Future< void> -
Creates a new user or updates an existing user on the device.
inherited
-
testVoice(
{int index = 0}) → Future< bool> -
Plays a pre-recorded voice message on the device.
inherited
-
toString(
) → String -
Returns a string representation of the ZK device, including connection
details and device capacity information.
override
-
unlock(
{int time = 3}) → Future< void> -
Unlocks the door connected to the device's relay.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited