Java 如何连接到蓝牙服务器并发现服务?

Java 如何连接到蓝牙服务器并发现服务?,java,bluetooth,bluecove,Java,Bluetooth,Bluecove,我无法连接到在rpi上设置的蓝牙服务器。我需要一个connectionUrl,大概是从ServiceRecord获取的。但我似乎无法让它发挥作用 我使用bluecove设置了它,并且有一个运行的服务器,可发现。但是,我在设备上找不到任何服务。 服务器: UUID uuid = new UUID("446118f08b1e11e29e960800200c9a66", false); String connectionString = "btspp://localhost:" + uuid + ";

我无法连接到在rpi上设置的蓝牙服务器。我需要一个connectionUrl,大概是从ServiceRecord获取的。但我似乎无法让它发挥作用

我使用bluecove设置了它,并且有一个运行的服务器,可发现。但是,我在设备上找不到任何服务。 服务器:

UUID uuid = new UUID("446118f08b1e11e29e960800200c9a66", false);
String connectionString = "btspp://localhost:" + uuid + ";name=Mine";
StreamConnectionNotifier streamConnNotifier = (StreamConnectionNotifier) Connector.open(connectionString);
客户:

UUID[] uuidSet = new UUID[1];
uuidSet[0] = new UUID("446118f08b1e11e29e960800200c9a66", false);
agent.searchServices(null, uuidSet, remoteDevice, client);

public void servicesDiscovered(int transID, ServiceRecord[] servRecord) {
System.out.println("service discovered");
但没有发现任何服务。如果我在服务器中执行以下操作:

ServiceRecord sr = local.getRecord(streamConnNotifier);
System.out.println(sr);
…除其他外,我看到:

0x1:
    DATSEQ {
UUID 446118f08b1e11e29e960800200c9a66
UUID 0000110100001000800000805f9b34fb
}
我想我可以通过url连接到该服务
btspp://b827ebe97e0e:446118f08b1e11e29e960800200c9a66,但我不能,我得到了非法的辩论例外:446118F08B111E29E960800200C9A66频道有人吗?我使用java,服务器设置在Raspberry pi上,客户端是我的macbook笔记本电脑

我使用UUID作为“端口”(如果我们使用http)正确吗?

我的蓝牙经验:知道的人不说话。说话的人不知道。