From the documentations I see how to write without response like this:
BluetoothGattCharacteristic characteristic = ...
characteristic.setValue(bytes);
mBluetoothGatt.writeCharacteristic(characteristic);
How do you preform a write request operation WITH response?
(In iOS there is option to select write type CBCharacteristicWriteWithResponse and CBCharacteristicWriteWithoutResponse)
Checking whether the characteristic is writable:
(characteristic.getProperties() & (BluetoothGattCharacteristic.PROPERTY_WRITE | BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE))) != 0
From the documentation:
public void setWriteType (int writeType)
Added in API level 18 Set the write type for this characteristic
Setting the write type of a characteristic determines how the writeCharacteristic(BluetoothGattCharacteristic) function write this characteristic.
Parameters writeType The write type to for this characteristic. Can be one of: WRITE_TYPE_DEFAULT, WRITE_TYPE_NO_RESPONSE or WRITE_TYPE_SIGNED.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With