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

Is BLE_GATTS_VLOC_INVALID a "valid" option?

Hello,

I want to implement some kind of control point. This means, that I want to handle BLE write events to some characteristic. I've seen that the payload of the ATT Write Request or ATT Write Command is within the event data structure. Am I'm allowed to set the 'vloc' attribute to BLE_GATTS_VLOC_INVALID?

If not, could I set the user Buffer to a one octed buffer and the receive the transmited data through the event structure?

A confused User ;-)

Parents
  • Hi Torsten,

    You mean you want to control if you accept the write request or write command base on the content of the payload ? I don't think it's possible to change vloc after you configure the characteristic. And BLE_GATTS_VLOC_INVALID is not a valid option here.

    What you need is to set the characteristic' attribute metadata to require authorization ( attr_md.wr_auth = 1) so that you will receive BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST and decide if you want to accept the payload or not with sd_ble_gatts_rw_authorize_reply().

  • I see. I don't think you can use BLE_GATTS_VLOC_INVALID when configuring the char. What I can think of is if you have multiple characteristics, you can declare them with the same address in BLE_GATTS_VLOC_USER, so you only need RAM for 1 characteristic, the biggest.

Reply Children
No Data
Related