libblepp icon indicating copy to clipboard operation
libblepp copied to clipboard

setup_standard_scan overrides your callbacks.

Open thetoster opened this issue 8 years ago • 4 comments

This is unacceptable from perspective of user, if I set my callbacks on object then I'm not expecting some magic overwrites of it. Especially if I must call this method to get characteristics. I believe there should be channing of callbacks or listener approach or 2 levels of callbacks (special case of chainning).

thetoster avatar Apr 21 '17 09:04 thetoster

Good point. I'll have to consider the best design here.

sent from phone.

On 21 Apr 2017 10:23, "Bartłomiej Żarnowski" [email protected] wrote:

This is unacceptable from perspective of user, if I set my callbacks on object then I'm not expecting some magic overwrites of it. Especially if I must call this method to get characteristics. I believe there should be channing of callbacks or listener approach or 2 levels of callbacks (special case of chainning).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edrosten/libblepp/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGW624dZoYaBTXE9_mdkUcqIq37kZpnks5ryHWSgaJpZM4NEEJw .

edrosten avatar Apr 21 '17 13:04 edrosten

Out of interest, which callbacks were you setting that were getting overridden?

PS replies are going to be a bit sporadic for a while.

sent from phone.

On 21 Apr 2017 14:08, "Edward Rosten" [email protected] wrote:

Good point. I'll have to consider the best design here.

sent from phone.

On 21 Apr 2017 10:23, "Bartłomiej Żarnowski" [email protected] wrote:

This is unacceptable from perspective of user, if I set my callbacks on object then I'm not expecting some magic overwrites of it. Especially if I must call this method to get characteristics. I believe there should be channing of callbacks or listener approach or 2 levels of callbacks (special case of chainning).

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/edrosten/libblepp/issues/14, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGW624dZoYaBTXE9_mdkUcqIq37kZpnks5ryHWSgaJpZM4NEEJw .

edrosten avatar Apr 21 '17 13:04 edrosten

OnConnect/OnDisconnect I've written wrapper around your library to close it into communication abstraction. And I need to know if my IO channel is in connected/disconnected state so I have to react on those callbacks.

thetoster avatar Apr 21 '17 13:04 thetoster

Huh I forgot that it overrode disconnect. I can see what you mean about connect, though if you're scanning then the device isn't really ready to use until the standard scan is compete. I believe you can set up a callback there so you get notified when the scan has competed.

Thinking about it, the standard scan setup could override the callback, but keep a copy of the old one so that it can then call it.

Or maybe it should take a second, optional argument with the on connected callback.

sent from phone.

On 21 Apr 2017 14:12, "Bartłomiej Żarnowski" [email protected] wrote:

OnConnect/OnDisconnect I've written wrapper around your library to close it into communication abstraction. And I need to know if my IO channel is in connected/disconnected state so I have to react on those callbacks.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/edrosten/libblepp/issues/14#issuecomment-296186739, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGW62Uc32enmGesHr0Rta8NbGPtFw0xks5ryKtOgaJpZM4NEEJw .

edrosten avatar Apr 21 '17 13:04 edrosten