【发布时间】:2019-10-03 06:10:11
【问题描述】:
我无法连接到我的蓝牙服务器,在 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
【问题讨论】: