我无法连接到我的蓝牙服务器,在 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