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

Mock setupNotification overwrites Gatt value #160

Closed
ghost opened this issue Apr 4, 2017 · 4 comments
Closed

Mock setupNotification overwrites Gatt value #160

ghost opened this issue Apr 4, 2017 · 4 comments
Labels
bug Bug that is caused by the library

Comments

@ghost
Copy link

ghost commented Apr 4, 2017

Summary

Why does the setupNotification(...) method overwrite the value of the BluetoothGattCharacteristic?

In detail, look at https://github.com/Polidea/RxAndroidBle/blob/master/mockrxandroidble/src/main/java/com/polidea/rxandroidble/mockrxandroidble/RxBleConnectionMock.java#L430

private void setCharacteristicNotification(UUID notificationCharacteristicUUID, boolean enable) {
   writeCharacteristic(notificationCharacteristicUUID, new byte[]{(byte) (enable ? 1 : 0)}).subscribe();
}
@dariuszseweryn dariuszseweryn added the question / library Issue containing question / discussion about library workings label Apr 4, 2017
@dariuszseweryn
Copy link
Owner

Hello @blakopf
To be honest — I do not see a reason — this may be a bug. Why do you ask?

@ghost
Copy link
Author

ghost commented Apr 5, 2017

Because it messes up my values.

I setup my mock with various services and characteristics with values.
If I connect to the mock later and setupNotifications(...) for a UUID, the value of the characteristic for this UUID becomes 1 (and 0 if I unsubscribe from the notification):

new byte[]{(byte) (enable ? 1 : 0)}

I think this is a bug and the value should not be overwritten.

@dariuszseweryn dariuszseweryn added bug Bug that is caused by the library and removed question / library Issue containing question / discussion about library workings labels Apr 5, 2017
dariuszseweryn added a commit that referenced this issue Apr 5, 2017
…ue on setting notification.

Summary: #160

Reviewers: michal.zielinski, pawel.urban

Reviewed By: michal.zielinski, pawel.urban

Differential Revision: https://phabricator.polidea.com/D2288
@dariuszseweryn
Copy link
Owner

It seems so. The fix has just been landed and should be available shortly in 1.3.0-SNAPSHOT.
Best Regards.

@ghost
Copy link
Author

ghost commented Apr 5, 2017

That was fast, thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is caused by the library
Projects
None yet
Development

No branches or pull requests

1 participant