-
Notifications
You must be signed in to change notification settings - Fork 26
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
Unify callback / iterator approaches #163
Comments
One possibility might be to modify the |
So to handle interaction in an event based model, the event should contain a continuation object with methods to allow the host to complete the handling of the event. I talked about this some in #133 (comment) (the fourth option listed in that comment). At that point the iterator/stream API is a strict superset of the callback API. |
just to make a record of the conversation we had about improving WriteEvent, that might be relevant to this work. |
I think having the iterator/stream with continuation object would be nice for a 0.1 (feel free to disagree!) |
What do you mean by continuation object? |
@jamessizeland An API like this:
And the code using it:
Probably lots of inconsistencies in the above, but the point is that one can iterate async over the events, and decide how to handle it (either store/process it in server), or deal with it separately. |
Aha I see! I've got some time today to look at write events, I was going to see if I could create an enum within the macro that gives the name of the written characteristic rather than just the handle Id. |
Currently there are two mechanisms for interacting with gatt events in TrouBLE:
server.next()
iterator/stream approachEach of these methods currently have different strengths and weaknesses to one another:
@lulf has suggested a unification of these two mechanisms to provide the benefits of both: (from #151 (comment)):
The text was updated successfully, but these errors were encountered: