J2ME 中的蓝牙服务问题无法发现

发布于 2024-08-31 08:01:00 字数 583 浏览 10 评论 0原文

我尝试创建一个服务:

LocalDevice localDevice = LocalDevice.getLocalDevice();
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
String url = "btl2cap://localhost:"+uuid.toString()+";name="+name+";authorize=true;authenticate=true;encrypt=true";
L2CAPConnectionNotifier notifier = (L2CAPConnectionNotifier)Connector.open(url);
ServiceRecord = localDevice.getRecord(notifier);
// Set some attributes
// ...       
conn = notifier.acceptAndOpen();
//...

我在诺基亚 5800 和诺基亚 2760 上运行此代码,在 5800 上我可以看到 2760,但反之亦然,我不知道问题是什么,我认为存在安全问题...

有什么想法吗?

谢谢!

I try to create a service with:

LocalDevice localDevice = LocalDevice.getLocalDevice();
localDevice.setDiscoverable(DiscoveryAgent.GIAC);
String url = "btl2cap://localhost:"+uuid.toString()+";name="+name+";authorize=true;authenticate=true;encrypt=true";
L2CAPConnectionNotifier notifier = (L2CAPConnectionNotifier)Connector.open(url);
ServiceRecord = localDevice.getRecord(notifier);
// Set some attributes
// ...       
conn = notifier.acceptAndOpen();
//...

I run this code on a Nokia 5800 and Nokia 2760, with 5800 I can see 2760, but not vice versa, I don't know what is the problem, I have think security problems...

Any ideas?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青柠芒果 2024-09-07 08:01:00

问题出在搜索中,设备抛出了一个BluetoothStateException,给出“Busy”。我找到的解决方案是在 deviceSearch 和 serviceSearch 之间引入延迟。

The problem was in the search, the device threw a BluetoothStateException giving "Busy". The solution I have found is introducing a delay between deviceSearch and serviceSearch.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文