藍牙 BLE 三種 UUID 格式轉換


藍牙廣播中對服務 UUID 格式定義都有三種 16 bit UUID、32 bit UUID、128 bit UUID。

但是熟悉安卓開發的小伙伴都知道接口都 UUID 格式,fromString 時候 16bit 的 UUID 該咋辦呢?

16bit 和 32bit 的 UUID 與 128bit 的值之間轉換關系:

128_bit_UUID = 16_bit_UUID * 2^96 + Bluetooth_Base_UUID

128_bit_UUID = 32_bit_UUID * 2^96 + Bluetooth_Base_UUID

其中 Bluetooth_Base_UUID 定義為 00000000-0000-1000-8000-00805F9B34FB 

如果你想說這是啥呀,那我這樣說你應該可以明白點:

若 16 bit UUID為xxxx,那么 128 bit UUID 為 0000xxxx-0000-1000-8000-00805F9B34FB

若 32 bit UUID為xxxxxxxx,那么 128 bit UUID 為 xxxxxxxx-0000-1000-8000-00805F9B34FB


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM