【问题标题】:The data length in BluetoothGattServer.sendResponse can't exceed 20 bytes. (BLE)BluetoothGattServer.sendResponse 中的数据长度不能超过 20 字节。 (低功耗蓝牙)
【发布时间】:2015-08-11 08:28:32
【问题描述】:

我已经根据g-ortuno 的工作尝试了在 Nexus 6 上运行的 BLE GATT 外设,它工作正常,但是 sendResponse 方法无法发送大于 20 字节的数据。 并为 writeCharacteristic 发现了同样的问题,它的 answer 对我不起作用。有没有人遇到同样的问题并知道可能的解决方案?谢谢。

【问题讨论】:

    标签: android bluetooth-lowenergy gatt


    【解决方案1】:

    发送超过20字节的数据,需要更改MTU-exchange。

    到 API LEVEL 21,你可以使用 requestMtu,它与外围设备协商,你可以定义直到 512 字节。

    MTU 值在外设端定义。请记住,您可以发送的数据大小是 MTU-3 字节。

    对于小于 21 的 API LEVEL,MTU 是预定义的,您无法修改。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-01-31
      • 1970-01-01
      • 1970-01-01
      • 2023-03-14
      • 1970-01-01
      • 2014-08-23
      相关资源
      最近更新 更多