资源简介
获取加速度传感器 绘制曲线 并存储 能使用简单的代码实现
代码片段和文件信息
/*
* 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
相关资源
- Android外卖APP
- 基于android平台的校园社交app的设计与
- android火车购票系统登录页面
- Android_Build_Environment_on_Ubuntu_14.04_64-b
- Android项目实战
- Android简单日记本源码
- Android 使用OkHttp3报错处理
- Android家庭理财通源码
- Android安卓开发全套112GB教程很全.txt
- Android studio写的页面滑动
- 基于Android开发的扫雷小游戏
- Android仿照微信App功能代码
- Android大作业
- android-x86_64-7.1-r2.isoandandroid-x86_64-8.1
- usb-serial-for-android
- News_AndroidStudio源代码
- 微信APP支付服务端和Android 端详解及其
- websocket 依赖包,android和java都可以
- android简单音乐播放器源码
- Android系统下选择图片及裁剪
- simg2img工具
- make_ext4fs
- android-serialport-api串口通信精简demo
- android多点触控 两指缩放的demo
- linphone.zip
- AndroidSupportV7
- 疯狂的Android讲义第三版 源码
- 基于android的学生信息管理系统
- 基于Android平台的音乐播放器开发和应
- android 登录 注册
评论
共有 条评论