资源简介
获取加速度传感器 绘制曲线 并存储 能使用简单的代码实现
代码片段和文件信息
/*
* Copyright 2012 Greg Milette and Adam Stroud
*
* Licensed under the Apache License Version 2.0 (the “License“);
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package root.gast.playground.sensor.movement;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import android.graphics.Color;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.os.SystemClock;
import android.speech.tts.TextToSpeech;
import android.util.Log;
import com.androidplot.xy.LineAndPointFormatter;
import com.androidplot.xy.LineAndPointRenderer;
import com.androidplot.xy.SimpleXYSeries;
import com.androidplot.xy.XYPlot;
/**
* Receives accelerometer events and writes them to CSV files and plots them on a graph.
*
* @author Adam Stroud <adam.stroud@gmail.com>
*/
public class AccelerationEventListener implements SensorEventListener
{
private static final String TAG = “AccelerationEventListener“;
private static final char CSV_DELIM = ‘‘;
private static final int THRESHHOLD = 2;
private static final String CSV_HEADER =
“X AxisY AxisZ AxisAccelerationTime“;
private static final float ALPHA = 0.8f;
private static final int HIGH_PASS_MINIMUM = 10;
private static final int MAX_SERIES_SIZE = 30;
private static final int CHART_REFRESH = 125;
private PrintWriter printWriter;
private long startTime;
private float[] gravity;
private int highPassCount;
private SimpleXYSeries xAxisSeries;
private SimpleXYSeries yAxisSeries;
private SimpleXYSeries zAxisSeries;
private SimpleXYSeries accelerationSeries;
private XYPlot xyPlot;
private long lastChartRefresh;
private boolean useHighPassFilter;
private TextToSpeech tts;
private HashMap ttsParams;
private String movementText;
public AccelerationEventListener(XYPlot xyPlot
boolean useHighPassFilter
File dataFile
TextToSpeech tts
HashMap ttsParams
String movementText)
{
this.xyPlot = xyPlot;
this.useHighPassFilter = useHighPassFilter;
this.tts = tts;
this.ttsParams = ttsParams;
this.movementTex
相关资源
- AndroidStudio版直连sqlserver
- android带百分比进度条的文件上传,使
- 美食天下项目Android版源码和Web版源码
- Android之自定义ToggleButton使用
- Android非常漂亮的登录界面
- pc与android通过usb socket实现手机通信
- android毕业设计
- 百度地图自定义Markerandroid
- Android分区工具包
- android-support-v4.jar已打包进去源代码
- u-blox_Android_GNSS_Driver_v3.10驱动源码+中
- 个人根据Android移动开发案例详解手写
- android 视频播放器 项目和原码
- Android【动画】【特效】 17种动画特效
- 基于Android智能家居详细设计(经典)
- android通过JDBC连接Mysql数据库
- Android通讯录的源代码
- android 瀑布流Demo
- 指纹传感器FPC1080在android下的驱动
- delphi xe5 android 调用照相机摄像头拍照
- Android手机连连看游戏源码
- android-sdk-windows v2.3离线完整版
- android 底部弹出菜单(带透明背景)
- Android工程模式简介.rar
- Android蓝牙和Cors网络开发源码
- Android powermanger wakelock
- Android v7的一些jar包
- 最新android supportV7包
- android图片压缩工具类分享
- 单机搭建Android(解决Network is unreach
评论
共有 条评论