-
Notifications
You must be signed in to change notification settings - Fork 85
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
Version 6.0.2 breaks bytesToString() and startNotification() #717
Comments
Hi @paolosanchi Just to confirm, are you finding this change in internal behaviour is causing an observable difference when used as part of |
@peitschie I've found this issue because the callback of startNotification() on the js side receives always an empty string. bluetooth-le/src/conversion.ts Line 19 in 8e99165
|
The code here is a bit different to what you're describing 🙂 The real flow here is:
I've just tested this again locally, and can confirm that for me at least, the proper values are coming through: As you can see... the Are you able to confirm the conversion.ts implementation embedded in your app matches this code, i.e., there's not a stale version of the plugin source somewhere in your setup? Can you share an example of a full payload you're transferring, so I can see if there's any issues with the size or data contained? |
@peitschie my bad, you are right. I've got this issue because I use ionic's Live Update, and I had the version 6.0.2 for android and 6.0.1 for web (I forgot to commit the package.json). It is fine if the old web version is not compatible with the new one for android, the opposite would not be good, wich this is not the case. While reporting the js code reference, I've been confused by textToDataView() wich uses .split(' '), but the function is not used anymore (I did a quick search on the repo). That said, the issue on the android side may still cause unwanted behaviour since stringToBytes() cannot handle strings without spaces, and stringToBytes(). My issue was not a bug, and it is solved on my side. If you think it doesn't worth to fix stringToBytes() I guess it's fine. |
Fantastic to hear that you've found a solution. I appreciate you taking the time to detail what you encountered here!
Yeah... on close inspection, although the behaviour in stringToBytes is not buggy, it's definitely a bit inconsistent. There is no bug/regression here currently, because the conversion pair is It does feel a bit inconsistent though that we put spaces between hex pairs going JS => native, but don't put these on the way out going native => JS. I'll close this particular issue out, but will raise a new one for the inconsistency between these interfaces. |
Describe the bug
This commit seems to break startNotification() on js side:
perf: improve byte to hex string conversion optimizations (#701)
The issue is caused by bytesToString(), because it returns a hex string without spaces between the hex couple of values.
To Reproduce
Steps to reproduce the behavior:
originalData is different from data
This is what I have debugging
Expected behavior
value shoud be like this instead:
"4D 53 47 5F 49 4E 49 54 5F 4F 4B 3A 30 0A"
the issue resides in here:
bluetooth-le/android/src/main/java/com/capacitorjs/community/plugins/bluetoothle/Conversion.kt
Line 21 in 8e99165
because the following function from the kotlin framework StringsJVM.kt returns the string without spaces:
Screenshots
see above
Plugin version:
Desktop:
not applicable
Smartphone:
Device: Huawei MediaPad 5 Lite
OS: Android 8
Version: SDK 26
Proposed solution
or even better
I can't verify if this invalidates the performance enhancements gained by the above commit
The text was updated successfully, but these errors were encountered: