Skip to content
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

Allow methods to be called with a timeout parameter instead of using global timeout #102

Open
joshbrown-eg opened this issue Mar 8, 2019 · 1 comment

Comments

@joshbrown-eg
Copy link
Contributor

Issue

As a user, I want to be able to call methods using a timeout parameter, rather than using a global timeout. For example, I'd like to be able to pass timeouts to the following:

-[RZBCentralManager scanForPeripheralsWithServices:options:onDiscoveredPeripheral:]

-[RZBPeripheral writeData:characteristicUUID:serviceUUID:completion:]

...so that I can call them with a different timeouts rather than changing the global timeout every time I want to call a method with a different timeout value.

As it is, I'd have to do something like:

[RZBUserInteraction setTimeout:3];
[centralManager scanForPeripheralsWithServices:...];
[RZBUserInteraction setTimeout:5];
[peripheral writeData:...];

This is painful for multiple reasons, but the biggest concern I have is multithreading. If I change the global timeout in multiple threads, one could affect the other and break what we're trying to do.

Ideally, we'd be able to do this instead:

[centralManager scanForPeripheralsWithServices:<services> timeout:3...];
[peripheral writeData:<data> timeout:5...];
@joshbrown-eg
Copy link
Contributor Author

We have a fix for this in our fork (egineering-llc/RZBluetooth:master), but there are other changes there awaiting PR reviews in RZBluetooth #92 and #100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant