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

Difference between sd_ble_gatts_hvx() and sd_ble_gatts_value_set()

I can't find clarification on what is a difference between this two functions. Both of them could be used for changing value attibute

Parents
  • They are totally different. sd_ble_gatts_value_set() just changes the value of a characteristic on the device. When another device chooses to read that characteristic, the stack will (by default) return the latest set value. You can change it as many times as you want, but the other side will only see the new value if it happens to read it.

    sd_ble_gatts_hvx() not-only can change the internal value of the characteristic, but also sends it out as a notification/indication to the other side which is subscribed to the characteristic.

Reply
  • They are totally different. sd_ble_gatts_value_set() just changes the value of a characteristic on the device. When another device chooses to read that characteristic, the stack will (by default) return the latest set value. You can change it as many times as you want, but the other side will only see the new value if it happens to read it.

    sd_ble_gatts_hvx() not-only can change the internal value of the characteristic, but also sends it out as a notification/indication to the other side which is subscribed to the characteristic.

Children
Related