Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT
Accepted Solution

How to get previous data point such as acceleration, GPS, or time??

 

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.

 

 

-Fight with BB10
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: How to get previous data point such as acceleration, GPS, or time??

Could you clarify what you mean by "previous data point"? Are you trying to retrieve the previous acceleration/location etc of the device?

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: How to get previous data point such as acceleration, GPS, or time??

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]);
                                }
                            }
                        }

-Fight with BB10
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: How to get previous data point such as acceleration, GPS, or time??

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?

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: How to get previous data point such as acceleration, GPS, or time??

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,

 

-Fight with BB10
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: How to get previous data point such as acceleration, GPS, or time??

Could you follow the guide here:

https://bdsc.webapps.blackberry.com/native/beta/documentation/recipe_accelerometer_1935321_11.html

 

Also the Falling Blocks sample shows how to read acceleration as well:

https://bdsc.webapps.blackberry.com/native/beta/sampleapps

 

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.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: How to get previous data point such as acceleration, GPS, or time??

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.

 

 

-Fight with BB10
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: How to get previous data point such as acceleration, GPS, or time??

You will need to track this yourself.

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.
Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.
My Carrier: TT

Re: How to get previous data point such as acceleration, GPS, or time??

Do you know what's wrong in my code?

 

Thank you,

 

-Fight with BB10
Please use plain text.
BlackBerry Development Advisor (Retired)
gbeukeboom
Posts: 2,559
Registered: ‎10-16-2009
My Device: BlackBerry Z10
My Carrier: Bell

Re: How to get previous data point such as acceleration, GPS, or time??

Could you explain what your code is trying to achieve and what the results actually are vs what is expected?

Garett
@garettBeuk
--
Goodbye everybody!
Please use plain text.