Simpledatafield

Hi All,

I've developed a simple data field app to be used on my Oregon 700. I know that the compute() method is called by the system once per seconde but I dont' know how to stop running the simpledatafield object or exit it. I thought that the simpledatafield object was exiting/ending when stoping the activity on the peripheral, in my cas an Oregon 700.
Does someone could help me ?

Thanks for your help :-)
Gerald
  • A Data Field runs from when you start an activity until you exit the activity.

    Are you thinking the recording state? (started/paused/etc)

    look at the the onTimer...() calls or timerState in the Activity.Info structure (it's passed to compute)
  • You're right, I use the "Current Activity" function to start the recording and at the end of my activity I put it in "Pause" then record it on my oregon 700. I then reset all data before starting a new recording track but when I do so my datafield is still running and not reset.
  • You need to watch for things in your code and reset your own data if needed. The things I mentioned all you to see when things are happening as far as the recording. either by having the onTimer...() call backs, checking the timer state, or even things like watching timerTime or elapsedTime to see if they've been reset.
  • Does the Oregon 700 work like the Fenix and Forerunners where once you save your activity it goes back to a home screen (like the watch face on watches)? Or does it just stay in a state where you can still see your activity pages, and thus your CIQ field? Last time I used one of the handheld outdoor GPS's, there was no concept of saving activities. But if it doesn't go back to a home screen, do the CIQ fields effectively stay active across activities? With the Fenix/FR's the field is closed after you finish an activity.
  • I think I got it !
    I thought the compute methode was called once per second depending on the Start/Stop of the activity. I fact the compute method is called as soon it is displayed in a datafield, so as you say I just have to check the timerState status and resetting my data according to.

    Thanks a lot got you help :-)
  • When you save/discard you return to the main screen where you can select activities (hike, hunt, fish, etc). The data in a CIQ DF isn't saved between activities if you save/discard.

    But, let's say you start a hike, and while it's recording return to the home page and select mountain biking. The data is from when you started recording the hike to present.

    I threw together a simple DF that simply returns info.elapsedDistance in compute and nothing is saved. Added it to hike and toor cycle.

    I started a hike, walked around a bit, hit home, picked tour cycle, and the df showed the data.as was seen in hike. If instead of home, I do a stop/save in hike, then with to tour cycle, it's back at 0.

    So maybe that's what's going on. Instead of stop/save, "home" is being selected and the recording is still active. I'd actually not tied "home" before as I'm used to save/discarding the activity when I'm done.
  • Oh, yes. Compute is called every second without regard to the recording state. As soon as the activity pages show, (even if the DF isn't visible) compute runs every second, even if you haven't started the recording. That's the same as on other devices. You can see that in the CIQ simulator too.
  • Ok, now I'm facing a new issue. It seems that there is a difference behaviour between the simulator and my GPS Oregon 700.
    When I test my code in the simulator, when I detect that the activity has been saved (timerState=0) I reset my simple data field to 0 and it's work well in the simulator.
    On my GPS Oregon, when saving the activity the data field behaviour keeps the last value and is not reset to 0 as it should be, I think the timerState has not the same behaviour on the oregon than on the simulator. So I will try coding my condition on elapsedTime = 0 instead of timerState = 0 to reset my data.
  • Have you looked into using the onTimer... methods of DataField?

    onTimerLap => Object
    A lap event has occurred.

    onTimerPause => Object
    The activity timer is paused.

    onTimerReset => Object
    The current activity has ended.

    onTimerResume => Object
    The activity time has resumed.

    onTimerStart => Object
    The activity timer has started.

    onTimerStop => Object
    The activity timer has stopped.
  • Oh yessss .... that could be another solution more efficient than checking elapsedTime = 0.
    However I have a question, the onTimerReset() have to be override at which place, in the App class or View class of my simple data field project ?