When we:
[[self peripheral] writeValue:data forCharacteristic:self.cbCharacteristic type:CBCharacteristicWriteWithResponse];
Delegate is called with error == nil:
-(void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error;
The characteristic's value (NSData) does not equal the written data. It is old data. Should it equal what we wrote?
We've worked around this by immediately calling:
[[self peripheral] readValueForCharacteristic:self.cbCharacteristic];
Delegate is called with error == nil:
- (void)peripheral:(CBPeripheral *)peripheral didUpdateValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
Behold, the characteristic's value (NSData) equals the written data. This workaround causes more BLE traffic than is necessary. The CBCharacteristic's value is read-only, so we can not modify it to suit reality.
Thoughts?