Bluetooth GATTSCharacteristic set permissions
-
Hello everyone,
I'm currently trying to setup a characteristic which only allows reading, but not writing.
In the docs https://docs.pycom.io/chapter/firmwareapi/pycom/network/bluetooth/gattsservice.html it's described that this was possible, but it's sadly not stated which are the values and how I can put them.Does someone know more about this and can help me out?
Thanks already!
-
Got the issue sorted out myself.
The values are documented in the esp-idf: https://github.com/espressif/esp-idf/blob/master/components/bt/bluedroid/api/include/esp_gatt_defs.h#L267
just set the values corresponding to your needs. Be sure to set both permissions and properties. Example:
The below characteristic supports only READ and NOTIFY:
service.characteristic(uuid=0x2001, permissions=(1<<0), properties=(1 << 1) | (1 << 4), value=0)