Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a characteristic both read and write?

I understand that a characteristic can have only one property and one permission, and that the property must have the same value as the permission e.g. a characteristic must have the property of being writable if it has permission to be written to... so how can I make a characteristic readable AND writable?

e.g.

How to turn this

int permission = BluetoothGattCharacteristic.PERMISSION_WRITE;
int property = BluetoothGattCharacteristic.PROPERTY_WRITE;

Into read and write

like image 999
the_prole Avatar asked Dec 17 '25 06:12

the_prole


1 Answers

Use a mask

int permission = BluetoothGattCharacteristic.PERMISSION_WRITE | BluetoothGattCharacteristic.PERMISSION_READ;
int property = BluetoothGattCharacteristic.PROPERTY_WRITE|BluetoothGattCharacteristic.PROPERTY_READ;
like image 198
the_prole Avatar answered Dec 19 '25 19:12

the_prole



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!