Skip to content

Instantly share code, notes, and snippets.

@mariocesar
Created January 24, 2012 01:48
Show Gist options
  • Save mariocesar/1667284 to your computer and use it in GitHub Desktop.
Save mariocesar/1667284 to your computer and use it in GitHub Desktop.
Test fprint with dbus
import sys
import time
import gobject
import dbus, dbus.service
from dbus.mainloop.glib import DBusGMainLoop
dbus_loop = DBusGMainLoop()
dbus.set_default_main_loop(dbus_loop)
loop = gobject.MainLoop()
def scanHandler(state, secondArgument):
">>> estado: %s, %s" % (state, secondArgument)
if state == "enroll-completed":
loop.quit()
elif state == "enroll-disconnected":
loop.quit()
if __name__ == "__main__":
identity = 'mariocesar'
bus = dbus.SystemBus()
manager = bus.get_object("net.reactivated.Fprint","/net/reactivated/Fprint/Manager","net.reactivated.Fprint.Manager")
device = manager.GetDefaultDevice()
print '>>> Device : %s' % device
scanner = bus.get_object("net.reactivated.Fprint",device,"net.reactivated.Fprint.Device")
scanner.connect_to_signal("EnrollStatus", scanHandler)
scanner.Claim(identity)
scanner.EnrollStart("right-index-finger")
loop.run()
print ">>> Huellas registradas: \n%s" % scanner.ListEnrolledFingers(identity)
scanner.EnrollStop()
scanner.Release()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment