Created
January 24, 2012 01:48
-
-
Save mariocesar/1667284 to your computer and use it in GitHub Desktop.
Test fprint with dbus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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