Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Smart Bluetooth

Anonymous
Not applicable

After a central sends a write request to a peripheral, will there be a callback to indicate that write request was successful?

0 Likes
1 Solution
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

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.

View solution in original post

2 Replies
Anonymous
Not applicable

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

}


0 Likes
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

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.