如何将蓝牙16位服务UUID转换为128位UUID? [英] How can I convert a Bluetooth 16 bit service UUID into a 128 bit UUID?

查看:1564
本文介绍了如何将蓝牙16位服务UUID转换为128位UUID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所有分配的服务仅声明16位UUID.如果必须以这种格式指定服务,如何确定128位对应项?

All assigned services only state the 16 bit UUID. How can I determine the 128 bit counterpart if I have to specify the service in that format?

服务发现协议概述中,我知道有128位UUID基于所谓的"BASE UUID",在该网址中也有说明:

From Service Discovery Protocol Overview I know that 128 bit UUIDs are based on a so called "BASE UUID" which is also stated there:

00000000-0000-1000-8000-00805F9B34FB

但是如何从16位对应对象创建128位UUID?可能需要替换0位数中的某些数字,但是哪个以及如何替换?

But how do I create a 128 bit UUID from the 16 bit counterpart? Probably some of the 0 digits have to be replaced, but which and how?

推荐答案

这可以在Bluetooth 4.0 Core规范 Vol中找到. 3-核心系统.请参见已采用的规范列表.

This can be found in the Bluetooth 4.0 Core spec Vol. 3 - Core System. See the list of adopted specs.

B部分中,涵盖了第2.5.1章搜索服务/UUID" 下的服务发现协议(SDP)如何计算UUID.

In Part B, covering the Service Discovery Protocol (SDP) under Chapter 2.5.1 "Searching for Services / UUID" will explain how to calculate the UUID.

可以通过简单的算术运算来计算16位或32位UUID的完整128位值.

The full 128-bit value of a 16-bit or 32-bit UUID may be computed by a simple arithmetic operation.

128_bit_value = 16_bit_value * 2^96 + Bluetooth_Base_UUID
128_bit_value = 32_bit_value * 2^96 + Bluetooth_Base_UUID

通过将16位值零扩展到32位,可以将16位UUID转换为32位UUID格式.一种等效方法是将16位UUID值添加到零值32位UUID.

A 16-bit UUID may be converted to 32-bit UUID format by zero-extending the 16-bit value to 32-bits. An equivalent method is to add the 16-bit UUID value to a zero-valued 32-bit UUID.

请注意,在另一部分中,有一个方便的助记符:

Note that, in another section, there's a handy mnemonic:

或者,更简单地说,16位属性UUID在以下内容中替换了x, ing:

Or, to put it more simply, the 16-bit Attribute UUID replaces the x’s in the follow- ing:

0000xxxx-0000-1000-8000-00805F9B34FB

此外,32位属性UUID在以下内容中替换了x:

In addition, the 32-bit Attribute UUID replaces the x's in the following:

xxxxxxxx-0000-1000-8000-00805F9B34FB


相同的等式适用于属性UUID.请参见 F部分,涵盖第3.2.1章协议要求/基本概念" 下的属性协议(ATT).首先在Bluetooth Core 4.1规范中指定32位属性UUID.


The same equations go for attribute UUIDs. See Part F, covering the Attribute Protocol (ATT) under Chapter 3.2.1 "Protocol Requirements / Basic Concepts". 32 bit attribute UUIDs are first specified in the Bluetooth Core 4.1 spec.

这篇关于如何将蓝牙16位服务UUID转换为128位UUID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆