01-23-2012 01:28 PM
Does anyone know how to get previous data point?
For java, last point = current point and put the line after current point.
However, I don't know how to get the previous data point from C programming.
Thank your help.
Solved! Go to Solution.
01-24-2012 03:10 PM
Could you clarify what you mean by "previous data point"? Are you trying to retrieve the previous acceleration/location etc of the device?
01-25-2012 10:22 AM
I tried to get the previous acceleration.
The code is at below. I tried to use buffer to get the previous acceleration. I don't know what's wrong.
The code didn't work.
if(paused==2){
for (i =0; i < 2; i++){
sensor_event_get_xyz(event, &force_x[i], &force_y[i], &force_z[i]);
if(force_x[0] != force_x[1]){
ftime(&tmb[i]);
fprintf(f,"%ld%d, %7.3f, %7.3f, %7.3f\n", tmb[i].time, tmb[i].millitm, force_x[i], force_y[i], force_z[i]);
}
}
}
01-25-2012 11:39 AM
Is the application listening for sensor events? Are you trying to get events as they come in or retrieve previous sensor events from the buffer?
01-25-2012 11:47 AM
Yes, I tried to listen sensor event, and then put data into a buffer in order to get the previous data point.
Or,
If you know other way to get the previous data point.
Could you share the information.
Thank you,
01-25-2012 11:50 AM
Could you follow the guide here:
https://bdsc.webapps.blackberry.com/native/beta/do
Also the Falling Blocks sample shows how to read acceleration as well:
https://bdsc.webapps.blackberry.com/native/beta/sa
You can read all sensor events as they occur, but *not* retrieve previous values. If previous data is needed, could you explain how it would be useful.
01-25-2012 12:04 PM
I can get acceleration.
But, I tried to get the previous data point, which can be calculated with the current data point.
For example:
X = Current acceleration - the previous acceleration.
or
X = Current acceleration - the previous two acceleration.
01-25-2012 12:05 PM
You will need to track this yourself.
01-25-2012 12:11 PM
Do you know what's wrong in my code?
Thank you,
01-25-2012 12:13 PM
Could you explain what your code is trying to achieve and what the results actually are vs what is expected?