A.J. S.
A.J. S.

Reputation: 218

Core Bluetooth - Unable to Write Value using CBCharacteristicWriteType.WithResponse

I am designing an iOS app with a custom made bluetooth enabled device that sends and receives text from my iPhone. I am able to send text data to the device when I send a CBCharacteristicWriteType.WithoutResponse, but that using that sends data as best-effort and not guaranteed according to Apple documentation. When I try writing data using .WithResponse, I get an unknown error, so I downloaded the BT Server Log on my iPhone, and saw the following message:

writeCharacteristic - Notice - ATT - Writing value with response to characteristic handle 0x0025 on device "(#my device number#)"

runCommand - Error - ATT - Characteristic handle 0x0024 is not writeable!

processCommands - Error - ATT - Command failed for device "(#my device number#)"

Would this be an issue with the bluetooth chip? Or am I doing something wrong? Any input is greatly appreciated! If any extra code is required, let me know and I'll put it up!

Upvotes: 1

Views: 2159

Answers (1)

Paulw11
Paulw11

Reputation: 115002

You need to examine the properties of your CBCharacteristic on your CBService - If CBCharacteristicPropertyWrite is specified then the characteristic supports write with a response. If only CBCharacteristicPropertyWriteWithoutResponse is specified then you can't execute a write with response.

To change this you will need to modify the firmware in your BLE device.

Upvotes: 4

Related Questions