gpt4 book ai didi

java - 什么是蓝牙 uuid?我怎样才能得到它?

转载 作者:行者123 更新时间:2023-12-01 13:24:21 24 4
gpt4 key购买 nike

我正在尝试使用蓝牙将我的应用程序连接到服务器。但我不知道这个 uuid 是什么以及我应该如何找到它?

class ConnectThread extends Thread {

private final BluetoothSocket mmSocket;
private final BluetoothDevice mmDevice;

// Get a BluetoothSocket to connect with the given BluetoothDevice
try {
// MY_UUID is the app's UUID string, also used by the server code
tmp = device.createRfcommSocketToServiceRecord(MY_UUID);

///这给了我一个错误,我应该如何修复它?

最佳答案

如果您使用的是BluetoothChat源代码,则在文件BluetoothChatService.java中找到UUID,如下所示:

public class BluetoothChatService {
.
.
// Unique UUID for this application
private static final UUID MY_UUID_SECURE =
UUID.fromString("fa87c0d0-afac-11de-8a39-0800200c9a66");
private static final UUID MY_UUID_INSECURE =
UUID.fromString("8ce255c0-200a-11e0-ac64-0800200c9a66");
.
.

关于java - 什么是蓝牙 uuid?我怎样才能得到它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21851943/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com