3

我使用以下调用通过 BLE 发送数据

[peripheral writeValue:dataPiece forCharacteristic:characteristic
    type:CBCharacteristicWriteWithResponse];

当 dataPiece 大小为180 bytes或小于时,一切正常:接受设备接收所有数据,在调用设备上调用相应的回调 ( peripheral: didWriteValueForCharacteristic: error:)。当大小变大时>180180 bytes但是在后一种情况下,不会调用传输设备上的回调。

[peripheral maximumWriteValueLengthForType:CBCharacteristicWriteWithResponse]返回512超过180,所以我希望200工作正常。

我错过了什么(显然是的,但是什么)?

4

1 回答 1

0

readValueForDescriptor:对于外围设备,它应该在中央调用方法时响应描述符。
如果它没有响应,中央不能向它写入数据。

看:

  • (void)readValueForDescriptor:(CBDescriptor *)descriptor;
  • (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForDescriptor:(CBDescriptor *)descriptor error:(nullable NSError *)error;
于 2020-09-16T10:32:58.877 回答