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

Authorized write request with VLOC_USER

Hello,

i have a characteristic kept in user space with VLOC_USER. It has read/write with response props and has auth permissions set, both for read and write.

In the past i experienced weird behaviour because i was setting the update flag to 1 in the auth read reply.

Now I have tried the auth write request, and found that it always fails the reply with INVALID_PARAM error. Looks like this is caused by update flag set to 0.

According to the documentation on update flag:

If set, data supplied in p_data will be used to update the attribute value. Please note that for BLE_GATTS_OP_WRITE_REQ operations this bit must always be set, as the data to be written needs to be stored and later provided by the application.

Is it safe to use update=1 in reply params if characteristic value is kept in VLOC_USER?

Thank you

Parents
  • Yes, it is safe. I am not sure what made you ask this question. It could be that the documentation is misinterpreted. When you receive a BLE_GATTS_OP_WRITE_REQ , then the update flag SHALL be set to '1'. Else you will get an error as you did. So please go ahead and set the update flag to '1'.

  • In the past i was getting Hardfault because i was setting update flag with attribute kept in VLOC_USER when doing a reply to auth_read.

    In a ticket reply i've been told that you can't set update flag unless attribute is in VLOCK_STACK, so this is why i did ask. So, to recap and if understood right, if attribute is in VLOC_USER you MUST NOT set update flag if replying to authorized read, and you MUST set it if replying to authorized write request regardless its location in memory.

Reply
  • In the past i was getting Hardfault because i was setting update flag with attribute kept in VLOC_USER when doing a reply to auth_read.

    In a ticket reply i've been told that you can't set update flag unless attribute is in VLOCK_STACK, so this is why i did ask. So, to recap and if understood right, if attribute is in VLOC_USER you MUST NOT set update flag if replying to authorized read, and you MUST set it if replying to authorized write request regardless its location in memory.

Children
No Data
Related