print('Waiting for same finger again...') ## Wait that finger is read again while (f.readImage() == False): pass ## Converts read image to characteristics and stores it in charbuffer 2 f.convertImage(0x02) ## Compares the charbuffers if (f.compareCharacteristics() == 0): raise Exception('Fingers do not match') ## Creates a template f.createTemplate() ## Saves template at new position number positionNumber = f.storeTemplate() print('Finger enrolled successfully!') print('New template position #' + str(positionNumber)) template = str(positionNumber) unq = f.generateRandomNumber() unqData = str(positionNumber) + str(unq) print('Generated Unique Fingerprint ID: ' + str(unqData)) print('Saving to database Server') except Exception as e: print('Operation failed!') print('Exception message: ' + str(e)) exit(1)
from pyfingerprint.pyfingerprint import PyFingerprint ## Generates a 32-bit random number ## ## Tries to initialize the sensor try: f = PyFingerprint('/dev/ttyUSB0', 57600, 0xFFFFFFFF, 0x00000000) if ( f.verifyPassword() == False ): raise ValueError('The given fingerprint sensor password is wrong!') except Exception as e: print('The fingerprint sensor could not be initialized!') print('Exception message: ' + str(e)) exit(1) ## Tries to generate a 32-bit random number try: print(f.generateRandomNumber()) except Exception as e: print('Operation failed!') print('Exception message: ' + str(e)) exit(1)
All rights reserved. """ from pyfingerprint.pyfingerprint import PyFingerprint ## Generates a 32-bit random number ## ## Tries to initialize the sensor try: f = PyFingerprint('/dev/ttyS0', 57600, 0xFFFFFFFF, 0x00000000) if ( f.verifyPassword() == False ): raise ValueError('The given fingerprint sensor password is wrong!') except Exception as e: print('The fingerprint sensor could not be initialized!') print('Exception message: ' + str(e)) exit(1) ## Tries to generate a 32-bit random number try: print(f.generateRandomNumber()) except Exception as e: print('Operation failed!') print('Exception message: ' + str(e)) exit(1)