libfprint
|
These functions are only applicable to users of libfprint's asynchronous API. More...
Functions | |
int | fp_handle_events_timeout (struct timeval *timeout) |
Handle any pending events. More... | |
int | fp_handle_events (void) |
Convenience function for calling fp_handle_events_timeout() with a sensible default timeout value of two seconds (subject to change if we decide another value is more sensible). More... | |
size_t | fp_get_pollfds (struct fp_pollfd **pollfds) |
Retrieve a list of file descriptors that should be polled for events interesting to libfprint. More... | |
These functions are only applicable to users of libfprint's asynchronous API.
libfprint does not create internal library threads and hence can only execute when your application is calling a libfprint function. However, libfprint often has work to be do, such as handling of completed USB transfers, and processing of timeouts required in order for the library to function. Therefore it is essential that your own application must regularly "phone into" libfprint so that libfprint can handle any pending events.
The function you must call is fp_handle_events() or a variant of it. This function will handle any pending events, and it is from this context that all asynchronous event callbacks from the library will occur. You can view this function as a kind of iteration function.
If there are no events pending, fp_handle_events() will block for a few seconds (and will handle any new events should anything occur in that time). If you wish to customise this timeout, you can use fp_handle_events_timeout() instead. If you wish to do a nonblocking iteration, call fp_handle_events_timeout() with a zero timeout.
TODO: document how application is supposed to know when to call these functions.
int fp_handle_events_timeout | ( | struct timeval * | timeout | ) |
Handle any pending events.
If a non-zero timeout is specified, the function will potentially block for the specified amount of time, although it may return sooner if events have been handled. The function acts as non-blocking for a zero timeout.
timeout | Maximum timeout for this blocking function |
Referenced by fp_handle_events().
int fp_handle_events | ( | void | ) |
Convenience function for calling fp_handle_events_timeout() with a sensible default timeout value of two seconds (subject to change if we decide another value is more sensible).
References fp_handle_events_timeout().
Referenced by fp_dev_close(), fp_dev_open(), fp_enroll_finger_img(), fp_identify_finger_img(), and fp_verify_finger_img().
size_t fp_get_pollfds | ( | struct fp_pollfd ** | pollfds | ) |
Retrieve a list of file descriptors that should be polled for events interesting to libfprint.
This function is only for users who wish to combine libfprint's file descriptor set with other event sources - more simplistic users will be able to call fp_handle_events() or a variant directly.
pollfds | output location for a list of pollfds. If non-NULL, must be released with free() when done. |