pyztk/zk/finger.py
Arturo Hernandez 402ba438d1 Added support for python3 (WIP)
possible broken a lot of things

still needs more safeguards
2018-04-27 20:00:13 -04:00

24 lines
947 B
Python

# -*- coding: utf-8 -*-
from struct import pack #, unpack
import codecs
class Finger(object):
def __init__(self, size, uid, fid, valid, template):
self.size = size # template only
self.uid = uid
self.fid = fid
self.valid = valid
self.template = template
#self.mark = str().encode("hex")
self.mark = codecs.encode(template[:6], 'hex')
def repack(self): #full
return pack("HHbb%is" % (self.size), self.size+6, self.uid, self.fid, self.valid, self.template)
def repack_only(self): #only template
return pack("H%is" % (self.size), self.size+2, self.template)
def __str__(self):
return "<Finger> [u:%i, fid:%i, size:%i v:%i t:%s...]" % (self.uid, self.fid, self.size, self.valid, self.mark)
def __repr__(self):
return "<Finger> [u:%i, fid:%i, size:%i v:%i t:%s...]" % (self.uid, self.fid, self.size, self.valid, self.mark) #.encode('hex')