Closed ArthurKun21 closed 5 years ago
Hi,
what are mPressure, mHumidity acc?
let's assume that you enable the notification for the pressure and the humidity, and use the same listener for both.
The onUpdate method will be called 2 times, one when a new pressure arrive and one when a new humidity arrive. the getPressure/getHumidity just return the first value inside the Sample object. so if you call the getHumidity with a pressure sample you got a humidity of, for example, 1000 and no errors.. probably in your case both mPressure and mHumidity are true, and you update the getPressure and getHumidity string with the same values.
to fix it you can:
define a listener for each feature like here
use something like: feature instanceof FeaturePressure
to understand witch data are inside the sample object like here
in this way you will update only the string associated with the feature that got updated.
Best Regards Giovanni
Hi, thanks for the reply.
what are mPressure, mHumidity acc?
it is a boolean expression to see if the Feature is called
let's assume that you enable the notification for the pressure and the humidity, and use the same listener for both.
The onUpdate method will be called 2 times, one when a new pressure arrive and one when a new humidity arrive.
probably in your case both mPressure and mHumidity are true, and you update the getPressure and getHumidity string with the same values.
yes, looks like calling the same listener for both function is wrong
Thank you very much for the support you have provided
Hi @GiovanniVisentini
would like to ask if there is a way to control the timing of Feature Listener?
the notification are asynchronous, so the timing is controlled by the firmware.
what you can do is:
Best Regards Giovanni
ps: for different question please open different issue
Thanks for the help!
sorry for not opening another issue, will try next time
@ArthurKun21 do you have sample repositrory of your app SAMPLE???
take a look here https://github.com/STMicroelectronics/STBlueMS_Android/tree/FullAppSnapshot
Il giorno mar 21 mar 2023 alle ore 03:46 John Vincent Gonzales < @.***> ha scritto:
@ArthurKun21 https://github.com/ArthurKun21 do you have sample repositrory of your app SAMPLE???
— Reply to this email directly, view it on GitHub https://github.com/STMicroelectronics/BlueSTSDK_Android/issues/21#issuecomment-1477206547, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEMVJZUCWWEJYKZ5RVFUUSTW5EJCBANCNFSM4IKR4PHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
-- Luca Pezzoni
I am using STM32F446RE nucleo for this, when i have tried this block of code to get the features needed and tried to putting them in a recyclerview, i am somehow getting errors because the values are jumping from one paramater to another.
What is the correct or better way to do this?