This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Is it possible to get all the characteristic values with sd_ble_gatts_value_get?

Hello.

We are developing using nrf52832 (S132 v7.0.1, SDK v17.0.0) as a peripheral.

I am creating a function to connect to a central device, have the characteristic set to Write Without Response send a 20Byte value, and read that value.
I was able to get the value using sd_ble_gatts_value_get, but I can only get the value of the 1st byte.

Is there a way to read all the values sent?
I want you to tell me.

Best regards.

  • Hi,

    You should be able to get multiple bytes, as long as the ble_gatts_value_t structure pointed to by the p_value argument has a large enough buffer (and length field) set. See the sd_ble_gatts_value_get() documentation.

    For reference you can also have a look at examples\ant\experimental\ant_shared_channel\m2m\ble_controllable_hub.c, where sd_ble_gatts_value_get() is used in the is_cccd_configured function on lines 270 through 294. That function sets up a ble_gatts_value_t structure named value with the proper buffer and parameters, for use for the p_value parameter. Instead of BLE_CCCD_VALUE_LEN you should use the length of your characteristic.

    Please also make sure to check the return value from the function, in case you get an error.

    Regards,
    Terje

  • Hello.

    When I implemented it according to the example you taught me, I was able to read all the values.

    It was very helpful. Thank you very much.

    Best regards.

Related