ANDROID查找特定蓝牙设备的UUID [英] Android Find the UUID of a specific bluetooth device
问题描述
我开始在最近的Android蓝牙工作。
我想建立,可以读取通过蓝牙由传感器记录的数据的应用程序。
I'm starting to work on Bluetooth in Android recently. I want to build an application that can read the data recorded by a sensor through bluetooth.
我有一些样本code,但看起来像我需要一个不同的device.It的另一个UUID是这样的:
I have some sample code, but looks like I need another UUID of a different device.It looks like this:
private static final UUID MY_UUID = UUID
.fromString("00001101-0000-1000-8000-00805F9B34FB");
后来在code,它使用此UUID建立连接:
Later on in the code, it uses this UUID to make a connection:
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);
我已经做了一些研究线上,如[这里] [1]。我想我需要为我工作的新设备不同的UUID号。我如何获得UUID号?
I have done some research online, like [here][1]. I think I need a different UUID number for the new device I'm working on. How do I get the UUID number?
在设备上,有若干的两行说:
On the device, there are two lines of number saying:
SN:1201L0023结果
BT:10:00:E8:C5:16:85
在此先感谢!
杰克
推荐答案
的UUID是不依赖于特定的设备。他们确定软件服务。对于定义的配置文件的一些的UUID是由BT设置。与RFCOMM插座喜欢你的例子中使用的UUID是任意的。你只需要双方使用同一个。一般情况下,设备连接,然后使用服务发现协议找出哪些服务(的UUID)支持远程设备上。
UUIDs are not tied to particular devices. They identify software services. Some UUIDs for defined profiles are set by BT. The UUIDs used with RFCOMM sockets like your example are arbitrary. You just need both sides to use the same one. In general, devices connect and then use service discovery protocol to find out what services (UUIDs) are supported on the remote device.
这篇关于ANDROID查找特定蓝牙设备的UUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!