gpt4 book ai didi

java-me - 使用蓝牙 L2Cap 连接到 HID 设备

转载 作者:行者123 更新时间:2023-12-04 23:56:37 25 4
gpt4 key购买 nike

在 JAVA ME 中使用 L2CAP 连接到 HID 设备是否有任何解决方法(使用移动设备原生的 JSR-82 规范实现而不是 BlueCove 等)?

我知道 HID 设备通常使用值为 0x0011 的 PSM(协议(protocol)服务多路复用器)。不幸的是,我发现:

Legal PSM values are in the range (0x1001..0xFFFF), and the least significant byte must be odd and all other bytes must be even.

上面解释了为什么 javax.microedition.io.Connector connect() 方法在我尝试以下代码时抛出异常:

Connector.open("btl2cap://600010120296:11");

最佳答案

This page建议在 JSR-82 1.2 中删除限制:

Legal PSM values are in the range (0x0005..0xFFFF), and the least significant byte must be odd and all other bytes must be even. When a server connection string does not have a psm parameter, the server PSM value assigned by the implementation must be no less than 0x1001.

评论:

Remove reserved ranges from L2CAP PSM values, to allow a Java application to use a Bluetooth protocol that is built on top of L2CAP using a PSM value in the "reserved" range.

此外,“中断端点”是 PSM 0x13(这是键盘、鼠标等将发送未经请求的报告的地方,就像它们在控制 channel (0x11) 上发送以响应 GET_REPORT 一样)。

关于java-me - 使用蓝牙 L2Cap 连接到 HID 设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12027310/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com