-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request: timeout on wait_for_tag #44
Comments
Just wanted to open a new feature request for So GitHub "similar issues" works 😃 |
Based on @tlongeri 's suggestion in ondryaso#44 I addded the timeout functionality to the wait_for_tag method so that it will return after a given number of seconds. The timeout param is optional with default value of 0 (=no timeout) so that existing users of the library will not have any change in functionality unless they provide the new param. This functionality is useful for detecting that the reader could not find a RFID tag, e.g. the card was removed.
wait_for_tag now returns after timeout seconds but unfortunatelly there is no way to know whether it returned normally or because the time out. In case there is a timeout when i call self._reader.request() I would get an error. Would be possible to use a Timeout Exception so you can handle the timeout in the caller method. Something like this:
Should i raise a new issue or could this be reopened ? |
It would be nice to have a timeout argument on the
wait_for_tag
function. I'm using it to listen for tags on a looping thread that checks on a 'global' exit flag at each loop, but sincewait_for_tag
can never exit I have no nice way of killing it so I was forced to make my own modified version.It should be a simple change, like this:
It's just a little detail that would improve usability.
The text was updated successfully, but these errors were encountered: