This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

difference b/w attribute write/read permission with respect to characteristic properties

Hi, I wrote a sample application to remotely control and led on nrf51822_xxaa module. in the application I was able to provide configuration to the characteristics as well as attributes using the char_props for the characteristics (for options like write/read/notify etc.) and also read/write permission to the attributes using read_perm and write_perm in ble_gatts_attr_md_t structure during addition of characteristics to the service. I tried turning on and off the leds with following settings and results:

image description

actually the control over attribute in characteristics is independent of read_perm and write_perm in ble_gatts_attr_md_t and dependent of char_props for the characteristics. why is it so? and if so, what is the significance of the read_perm and write_perm in ble_gatts_attr_md_t.

  • You have attribute permissions and characterisitc properties, not characteristic permissions.

    Attribute permissions are described in Vol. 3, Part F, Section 3.2.5, and Characteristic properties are described in Vol. 3, Part G, Section 3.3.1.1 in the Bluetooth Core Specification v4.2.

    The characteristic properties determine how the characterisitic value can be used, this information is given to the GATT client as a reference.

    The attribute permissions, or the attribute access permissions specifies that it may be read and/or written, this information is not given to the GATT client.

    If you try to write to an attribute that only is readable, you would get an Write Not Permitted error.

    If you try to write to an attribute that is writeable, you would be able to write to it regardless of what the characteristic properties are.

    This is assuming that none of the other type of permissions are set, and that the device with GATT server doesn't check the characteristic permissions first.

  • @Petter Myhre I understood it like this. please correct me if I am wrong. attribute permission is for the knowledge of server to give permission to the client requests. whereas characteristic properties is for the knowledge of the client to understand the permissions of the characteristic value. so the final access permission to the characteristic value is based on the value of the attribute permission even though client tries to read/write to the server characteristic value based on the characteristic value. Is it fine?

  • I think you have understood correctly, but is your table incorrect?

  • @Petter Myhre regarding table, I have to confirm it once more. One more doubt, but why should be two such things(permission and properties)? why can't the server also follow the characteristic properties? will not that make things little bit more easy?

  • I'm not sure exactly why there are two such things. It is two different layers of the protocol, but the spec is the spec. We need to follow it. Do you have any use case where this is unfortunate?

Related