Skip to content

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

Description

@joshbrown-eg

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...];

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions