3

网络蓝牙是否在 Windows Chrome 上运行 20 字节 MTU?

我看到写入相同 25 字节的特征值在 Mac OS 上的 Chrome 中成功,而在 Windows 上的 Chrome 中失败。

当我减少字节时,错误继续发生,直到我达到 20 个字节。如果这是 MTU,它是否记录在某处?有没有办法写入大于 20 个字节的值?

我在 TypeScript 中尝试了以下方法:

const writeBytesBuffered = async (
  characteristic: BluetoothRemoteGATTCharacteristic
  bytes: Uint8Array,
  index: number = 0
): Promise<void> => {
  while (index < bytes.length) {
    await characteristic.writeValue(bytes);
    index += 20;
  }
}

没有抛出任何错误,但大概是我设备的 GATT 服务器不知道如何处理它们并且静默失败。

4

0 回答 0