How to correctly use UUID.fromString method?

馋奶兔 提交于 2019-12-06 09:48:31

In the BLE specification there are two kinds of UUIDs.

  • Fully qualified 128 bits long which are usually assigned for a specific vendor of the BLE device for non-standard functionality: UUID.fromString("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx");

  • Also fully qualified (but defined by standard) UUIDs which have the same prefix and postfix: UUID.fromString("F000xxxx-0451-4000-B000-000000000000"); where xxxx is the place to fill the four characters you get from the SensorTag specification. For convenience the standard UUIDs are usually referenced with the four characters identifier.

Additionally if you're dealing with a SensorTag device you can checkout the library demo application that was shown on MCE^3 conference this year:

The talk: https://www.youtube.com/watch?v=0aKfUGCxUDM

The demo application repository: https://github.com/dariuszseweryn/2016_MCE_Demo_RxAndroidBLE

I hope that will help you.

Best Regards.

If you need a faster java.util.UUID.fromString(), you can use Fast-UUID-Parser instead. It returns java.util.UUID and it's 4 times faster than java.util.UUID.fromString().

SaravInfern

You must provide a full uuid:

UUID uid = UUID.fromString("f000aa01-0451-4000-b000-000000000000"); 
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!