After a central sends a write request to a peripheral, will there be a callback to indicate that write request was successful?
Solved! Go to Solution.
See leatt_regWriteRspCb() and how hello_client sample app uses this. The callback registered with this function will be invoked when the write is executed successfully by the server.
If your central is an iOS app and you are connected to a BTLE device (peripheral) you can use this:
- (void)writeValue:(NSData *)data forCharacteristic:(CBCharacteristic *)characteristic type:(CBCharacteristicWriteType)type
As type you use:
CBCharacteristicWriteWithResponse (to get the response)
or:
CBCharacteristicWriteWithoutResponse (no response)
If you choose the response you will get a callback:
- (void)peripheral:(CBPeripheral *)peripheral didWriteValueForCharacteristic:(CBCharacteristic *)characteristic error:(NSError *)error
then you can check error value:
if (error == NULL)
{
//write successful
}
See leatt_regWriteRspCb() and how hello_client sample app uses this. The callback registered with this function will be invoked when the write is executed successfully by the server.