You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							43 lines
						
					
					
						
							1.2 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							43 lines
						
					
					
						
							1.2 KiB
						
					
					
				
								from struct import pack, unpack
							 | 
						|
								from .zkconst import *
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								def zkplatform(self):
							 | 
						|
								    """Start a connection with the time clock"""
							 | 
						|
								    command = CMD_DEVICE
							 | 
						|
								    command_string = '~Platform'
							 | 
						|
								    chksum = 0
							 | 
						|
								    session_id = self.session_id
							 | 
						|
								    reply_id = unpack('HHHH', self.data_recv[:8])[3]
							 | 
						|
								
							 | 
						|
								    buf = self.createHeader(command, chksum, session_id,
							 | 
						|
								        reply_id, command_string)
							 | 
						|
								    self.zkclient.sendto(buf, self.address)
							 | 
						|
								    #print buf.encode("hex")
							 | 
						|
								    try:
							 | 
						|
								        self.data_recv, addr = self.zkclient.recvfrom(1024)
							 | 
						|
								        self.session_id = unpack('HHHH', self.data_recv[:8])[2]
							 | 
						|
								        return self.data_recv[8:]
							 | 
						|
								    except:
							 | 
						|
								        return False
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								def zkplatformVersion(self):
							 | 
						|
								    """Start a connection with the time clock"""
							 | 
						|
								    command = CMD_DEVICE
							 | 
						|
								    command_string = '~ZKFPVersion'
							 | 
						|
								    chksum = 0
							 | 
						|
								    session_id = self.session_id
							 | 
						|
								    reply_id = unpack('HHHH', self.data_recv[:8])[3]
							 | 
						|
								
							 | 
						|
								    buf = self.createHeader(command, chksum, session_id,
							 | 
						|
								        reply_id, command_string)
							 | 
						|
								    self.zkclient.sendto(buf, self.address)
							 | 
						|
								    #print buf.encode("hex")
							 | 
						|
								    try:
							 | 
						|
								        self.data_recv, addr = self.zkclient.recvfrom(1024)
							 | 
						|
								        self.session_id = unpack('HHHH', self.data_recv[:8])[2]
							 | 
						|
								        return self.data_recv[8:]
							 | 
						|
								    except:
							 | 
						|
								        return False
							 | 
						|
								
							 | 
						|
								
							 |