Hello,
I'm trying to write a simple app that logs accelerometer data.
It's a "Watch app" application type, Processing.mc class looks something like this:
// Constructor
function initialize() {
// initialize FIR filter
var options = {:coefficients => [ -0.0278f, 0.9444f, -0.0278f ], :gain => 0.001f};
try {
mFilter = new Math.FirFilter(options);
mLogger = new SensorLogging.SensorLogger({:enableAccelerometer => true});
mSession = ActivityRecording.createSession({:name=>"AccelLoggerProcess", :sport=>ActivityRecording.SPORT_GENERIC, :sensorLogger => mLogger});
}
catch(e) {
System.println(e.getErrorMessage());
}
}
// Start
function onStart() {
try {
mSession.start();
}
catch(e) {
System.println(e.getErrorMessage());
}
}
// Stop
function onStop() {
mSession.stop();
}
// Return current samples count
function getSamples() {
return mLogger.getStats().sampleCount;
}
So it's basically logs data and has a getSamples() function, which I call from View.mc class to display it on screen:
function initialize() {
View.initialize();
mAccelLoggerProcess = new AccelLoggerProcess();
}
function onLayout(dc) {
setLayout(Rez.Layouts.MainLayout(dc));
mLabelY = View.findDrawableById("value");
}
function onUpdate(dc) {
mLabelY.setText("Samples:" + mAccelLoggerProcess.getSamples().toString());
// Call parent's onUpdate(dc) to redraw the layout
View.onUpdate(dc);
}
function onShow() {
mAccelLoggerProcess.onStart();
}
function onHide() {
mAccelLoggerProcess.onStop();
}
I launch the app, go to Simulation -> FIT data -> Simulate Data, wait for like 10 sec, then Save FIT Session.
But the field on screen is not updating and the resulting FIT file is basically empty.
Could you tell me please what I'm doing wrong?