I can't find clarification on what is a difference between this two functions. Both of them could be used for changing value attibute
I can't find clarification on what is a difference between this two functions. Both of them could be used for changing value attibute
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.
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.
Hello,
in some examples, both functions after another will be called. Why? sd_ble_gatts_hvx()
should be sufficient?
see:
https://github.com/NordicPlayground/nRF52-Bluetooth-Course/blob/master/ble_cus.c
Hello,
It could make sense in some cases. Perhaps you want to set it for later, or in case the value is read later (even though notifications or indications have not been enabled).