简体   繁体   English

蓝牙到PC:设备,端口和UUID

[英]Bluetooth to PC: Device, port & UUID

I'm working on an app on Android that is supposed to connect to a custom device via Bluetooth, but in order to emulate that device (which I don't have yet), I made a simulator on PC, using Java's Bluecove. 我正在开发Android应用程序,该应用程序应该通过蓝牙连接到自定义设备,但是为了仿真该设备(我还没有),我使用Java的Bluecove在PC上创建了一个模拟器。

However, I'm having a hard time figuring out the different connection's method. 但是,我很难弄清楚不同连接的方法。

First, on Android, we discover the device (here, a PC), then: 首先,在Android上,我们发现设备(在这里是PC),然后:

-We have the "UUID" solution, as explain in android sdk doc . -我们有“ UUID”解决方案,如android sdk doc中所述

-Or the "Port" solution, as proposed here . -或此处建议的“端口”解决方案。

The second one seems more natural to me, as I don't quite understand what is a UUID in this scenario. 第二个对我来说似乎更自然,因为在这种情况下我不太了解什么是UUID。

I do understand that we need to connect to a port of a device, but what does the UUID have to do with that? 我确实知道我们需要连接到设备的端口,但是UUID与该端口有什么关系? Why don't we need to specify it in the second solution? 我们为什么不需要在第二个解决方案中指定它?

If someone could give me a clue, that would be greatly appreciated :) 如果有人可以给我一个线索,将不胜感激:)

蓝牙通信是与服务的通信,因此当您想连接到设备时,您正在尝试连接到服务,而uuid是我们用来连接服务的号码,例如,我要这个uuid(该服务)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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