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

Formatting of hex encoded data views is inconsistent between interfaces #719

Closed
peitschie opened this issue Nov 15, 2024 · 0 comments · Fixed by #745
Closed

Formatting of hex encoded data views is inconsistent between interfaces #719

peitschie opened this issue Nov 15, 2024 · 0 comments · Fixed by #745

Comments

@peitschie
Copy link
Collaborator

Describe the bug

A byte array is encoded to a hex strings in two different ways, depending on the direction of flow.

Generally

  • JavaScript => native includes a space between each hex pair (e.g., AE B1 11)
  • native => JavaScript has no spaces between hex pairs (e.g., AEB111)

This inconsistency was introduced in performance optimisations added as part of #701 and was noticed in #717 (comment)

There is no defective behaviour here. However, the inconsistency is likely to be confusing for developers and people debugging.

To Reproduce
The inconsistency can be seen in the JavaScript side by comparing the hex string conversion functions

Native => JS

  • toHexString - contains no spaces - android and iOS
  • hexStringToDataView - expects no spaces - JS

JS => native

  • dataViewToHexString - contains spaces - JS
  • stringToBytes - expects spaces - android and iOS

Expected behavior
A consistent hex-encoding format should be used throughout.

Plugin version:

  • @capacitor-community/bluetooth-le: 6.0.2
@peitschie peitschie added bug Something isn't working and removed bug Something isn't working labels Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant