Is there a way to read all data in a descriptor when the value is longer than a single MTU?
I have a descriptor where the value is 56 bytes in length. I read the value using CBPeripheral.readValue(for: CBDescriptor)
, but in the callback I only get what I assume is the first MTU's worth of data...
func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor descriptor: CBDescriptor, error: Error?) {
if let data = descriptor.value as? Data,
let newValue = String(data: data, encoding: .utf8) {
print(newValue) // only first 22 characters!
print(data.count) // 22, expecting 56!
}
}
On the Android side I'm able to call gatt.readDescriptor
, and get the full 56 bytes from myDescriptor.getValue()
in onDescriptorRead
.
I need a method that will allow me to read all 56 bytes without making the descriptor into a characteristic on the peripheral side. Is this possible with CoreBluetooth?