예제 #1
0
    def __init__(self):
        # These are here to avoid refcounting hell
        # TODO: Fix this in the fprint API
        self.bound_enroll_progress_callback = self.enroll_progress_callback
        self.bound_identify_callback = self.identify_callback
        self.bound_stop_callback = self.stop_callback

        db = private_api.db.get_conn()
        self.db_api = private_api.bob_api.BobApi(db)
        self.load_db()
        endpoint = DEFAULT_ENDPOINT
        self.send_api = bob_send.BobApi(endpoint, 1, 0)

        self.loop = asyncio.get_event_loop()
        fprint.init()
        ddevs = fprint.DiscoveredDevices()
        if len(ddevs) != 1:
            raise Exception(
                "Unexpected number of fingerprint devices: {0}".format(
                    len(ddevs)))
        self.dev = fprint.Device.open(ddevs[0])
        fds = self.dev.get_pollfds()
        for fd in fds:
            if fd[1] == 1:
                self.loop.add_reader(fd[0], self.dev.handle_events)
            if fd[1] == 4:
                self.loop.add_writer(fd[0], self.dev.handle_events)
        print("FingerprintInterface initialized")
예제 #2
0
    def __init__(self):
        # These are here to avoid refcounting hell
        # TODO: Fix this in the fprint API
        self.bound_enroll_progress_callback = self.enroll_progress_callback
        self.bound_identify_callback = self.identify_callback
        self.bound_stop_callback = self.stop_callback

        db = private_api.db.get_conn()
        self.db_api = private_api.bob_api.BobApi(db)
        self.load_db()
        endpoint = DEFAULT_ENDPOINT
        self.send_api = bob_send.BobApi(endpoint, 1, 0)

        self.loop = asyncio.get_event_loop()
        fprint.init()
        ddevs = fprint.DiscoveredDevices()
        if len(ddevs) != 1:
            raise Exception(
                "Unexpected number of fingerprint devices: {0}".format(
                    len(ddevs)))
        self.dev = fprint.Device.open(ddevs[0])
        fds = self.dev.get_pollfds()
        for fd in fds:
            if fd[1] == 1:
                self.loop.add_reader(fd[0], self.dev.handle_events)
            if fd[1] == 4:
                self.loop.add_writer(fd[0], self.dev.handle_events)
        print("FingerprintInterface initialized")
예제 #3
0
"""
This example shows how to verify a previously saved fingerprint.
"""

import fprint

# Initialization of libfprint
fprint.init()

# Load fingerprint info from a binary file (see enroll.py)
with open('some_fingerprint', 'rb') as fh:
    fingerprint = fprint.PrintData.from_data(fh.read())

# Discover all fingerprint devices in the system
# ddevs: Sequence[fprint.DiscoveredDevice]
ddevs = fprint.DiscoveredDevices()
if len(ddevs) > 0:
    # Choose the first one
    # dev: fprint.Device
    dev = ddevs[0].open_device()

    # Start fingerprint verification. In that moment you should
    # place your finger on the device.
    # matched: bool
    matched = dev.verify_finger_loop(fingerprint)

    if matched:
        print("Hooray!")
    else:
        print("Get out, I don't know you...")