简体   繁体   中英

BLE Characteristic UUIDs assignment

I am currently working on a project that involves building a BLE peripheral and client. I read about the UUIDs in this document https://btprodspecificationrefs.blob.core.windows.net/assigned-values/16-bit%20UUID%20Numbers%20Document.pdf and assigned my own UUIDs to them of the document that fit the description, eg turning a light on and off to 0x2B01 Luminous Intensity. However, that resulted in different behavior depending on the phone and android version used for the client. My phone, Android 11 / Xiaomi Mi A3, did work well with the set characteristics and their assigned UUIDs. My friend's phone, an Android 12 / Samsung S20, did not discover the characteristic. Moreover, when trying other UUIDs of the document, his phone could not read the characteristic, but mine did. That brings me to my questions:

Are these UUIDs predefined on some devices? Can I safely assign my own UUIDs without getting in trouble of one phone not caring at all what the UUID says about the characteristic but another does?

It was a classic Gatt cache problem. My phone clears the Gatt cache somehow periodically, or every time it connects to a BLE device, while the Samsung phone does not. The solution was to clear the cache when discovering available services.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM