Ejemplo n.º 1
0
    def index(self):

        ## Tries to initialize the sensor
        try:
            f = PyFingerprint(self.com, self.port, 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)

        ## Gets some sensor information
        print('Currently used templates: ' + str(f.getTemplateCount()) + '/' +
              str(f.getStorageCapacity()))

        ## Tries to show a template index table page
        try:
            page = input(
                'Please enter the index page (0, 1, 2, 3) you want to see: ')
            page = int(page)

            tableIndex = f.getTemplateIndex(page)

            for i in range(0, len(tableIndex)):
                print('Template at position #' + str(i) + ' is used: ' +
                      str(tableIndex[i]))

        except Exception as e:
            print('Operation failed!')
            print('Exception message: ' + str(e))
            exit(1)
Ejemplo n.º 2
0
def check():
    f = PyFingerprint('COM6', 57600, 0xFFFFFFFF, 0x00000000)

    print('Currently used templates: ' + str(f.getTemplateCount()) + '/' +
          str(f.getStorageCapacity()))

    page = input('Please enter the index page (0, 1, 2, 3) you want to see: ')
    page = int(page)

    tableIndex = f.getTemplateIndex(page)

    for i in range(0, len(tableIndex)):
        print('Template at position #' + str(i) + ' is used: ' +
              str(tableIndex[i]))
Ejemplo n.º 3
0
## 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)

## Gets some sensor information
print('Currently used templates: ' + str(f.getTemplateCount()) +'/'+ str(f.getStorageCapacity()))

## Tries to show a template index table page
try:
    page = input('Please enter the index page (0, 1, 2, 3) you want to see: ')
    page = int(page)

    tableIndex = f.getTemplateIndex(page)

    for i in range(0, len(tableIndex)):
        print('Template at position #' + str(i) + ' is used: ' + str(tableIndex[i]))

except Exception as e:
    print('Operation failed!')
    print('Exception message: ' + str(e))
    exit(1)
                                )

                        except Exception as e:
                            print(
                                'The fingerprint sensor couldnot be initialized'
                            )
                            print('Exception message:' + str(e))
                            #display to lcd
                            lcd.lcd_clear()
                            lcd.lcd_display_string('fingerprint', 1, 1)
                            lcd.lcd_display_string('sensor error', 2, 1)
                            exit(1)

                        try:
                            #��Ǩ�ͺ�������¹������ ������������������
                            tableIndex = f.getTemplateIndex(0)
                            if tableIndex[
                                    0] == False:  #�ҡ����ը����ӡ�����ҧ��¹�����������������
                                print 'Create Master finger'
                                lcd.lcd_clear()
                                lcd.lcd_display_string('Add Master', 1, 4)

                                while (f.readImage() == False):
                                    pass

                                f.convertImage(0x01)

                                result = f.searchTemplate()
                                positionNumber = result[0]

                                if (positionNumber >= 0):
Ejemplo n.º 5
0
"""
este programa imprime todas as fingerprint characteristics armazenadas no sensor de fingerprint
"""


from pyfingerprint.pyfingerprint import PyFingerprint

## Tries to initialize the sensor
try:
    f = PyFingerprint('/dev/ttyAMA0', 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)


try:
    templates = f.getTemplateIndex(0)
    for i in range(0, len(templates)):
        if(templates[i]):
            f.loadTemplate(i)
            print(f.downloadCharacteristics())

except Exception as e:
    print('Operation failed!')
    print('Exception message: ' + str(e))
    exit(1)
Ejemplo n.º 6
0
from sys import stdin

## Tries to initialize the sensor
try:
    f = PyFingerprint('/dev/ttyAMA0', 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)

try:
    print("loading fingerprint characteristics...")
    i = 0
    hasTemplate = f.getTemplateIndex(0)
    for line in stdin:  # para cada linha da entrada padrao (termina a leitura no EOF)
        while (i < f.getStorageCapacity()
               ):  # o indice i vai parar quando encontrar um template vazio
            if (not hasTemplate[i]): break
            i += 1
        if (i >= f.getStorageCapacity()): break
        f.uploadCharacteristics(1, eval(line))
        f.storeTemplate(i)
        print("saved fingerprint at ", i)
        i += 1

except Exception as e:
    print('Operation failed!')
    print('Exception message: ' + str(e))
    exit(1)