我无法连接到在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,但我不能,我得到IllegalArgumentException: channel 446118f08b1e11e29e960800200c9a66
答案 0 :(得分:0)
有人吗?我使用的是Java,服务器是在Raspberry pi上设置的,客户端是我的Macbook笔记本电脑。
我是否正确将UUID用作“端口”(如果我们使用的是http)?