webbluetooth: getPrimaryService and getCharacteristic fail with numeric short uuid

It fails to find the service/characteristic, but when I change 0x2a2b param to UUID_SHORT('2a2b'), it works. Also tested the same code with WebBluetooth in Chrome and it works as expected with 0x2a2b.

As a workaround, I use this to force all uuids to canonical form:

const UUID_SHORT = (x) => `0000${x}-0000-1000-8000-00805f9b34fb`

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (12 by maintainers)

Most upvoted comments

Have created two fixes:

https://github.com/thegecko/webbluetooth/tree/d/enums https://github.com/thegecko/webbluetooth/tree/d/enums2

I think I’ll use the last one, however as it changes the output code the least:

https://github.com/thegecko/webbluetooth/pull/7

Unfortunately not, you could ask about it on the noble repo?