Android Open Source - SensorLogApp Accelerometer Entry Factory






From Project

Back to project page SensorLogApp.

License

The source code is released under:

GNU General Public License

If you think the Android project SensorLogApp listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

/*
 * Copyright 2014 Andrew Romanenco (andrew@romanenco.com)
 *//from   ww  w.  ja  va  2  s.  c  om
 * This file is part of SensorLog app.
 *
 * SensorLog is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * SensorLog is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with SensorLog.  If not, see <http://www.gnu.org/licenses/>.
 */

package com.romanenco.sensorlog;

/**
 * Accelerometer data to CSV string
 *
 * @author Andrew Romanenco
 *
 */
public class AccelerometerEntryFactory implements LogEntryFactory {

    @Override
    public String createLogEntry(float[] values) {
        float x = values[0];
        float y = values[1];
        float z = values[2];
        return System.currentTimeMillis()
                + "," + Float.toString(x)
                + "," + Float.toString(y)
                + "," + Float.toString(z)
                + "\n";
    }

}




Java Source Code List

com.romanenco.sensorlog.AccelerometerEntryFactory.java
com.romanenco.sensorlog.LogEntryFactory.java
com.romanenco.sensorlog.MainActivity.java
com.romanenco.sensorlog.SensorLogger.java