Re: Question about CBATTRequest.offset
Re: Question about CBATTRequest.offset
- Subject: Re: Question about CBATTRequest.offset
- From: Sébastien Martini <email@hidden>
- Date: Fri, 12 Apr 2013 13:33:58 +0200
Ok, thank you Etan I see now.
I've just tested
with a long read characteristic value request and indeed it asks for
increasing offset values on my peripheral manager delegate method, here
is my code:
- (void)peripheralManager:(CBPeripheralManager *)peripheral didReceiveReadRequest:(CBATTRequest *)request {
NSData *value = ... // my long value
NSRange chunkRange = NSMakeRange(request.offset, [value length] - request.offset);
request.value = [value subdataWithRange:chunkRange];
[self.peripheralManager respondToRequest:request
withResult:CBATTErrorSuccess];
}
So what happens if I understand correctly is that when I emit a
-readValueForCharacteristic: on my central, it internally asks the
peripheral to send him the data by issuing requests with increasing
offset values and will detect there is no more data to read when a
returned chunk is 0 or less than the size of the MTU. Is this correct?
Thanks for your help!
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Bluetooth-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden