- close #6 - verbindung klappt und macht was sie soll. sonderfälle fehlen halt noch wie verbindung kackt ab etc.
- ref #8 mal einen filewriter geschrieben, welcher die sensordaten rausschreiben soll. - viele kleine sachen
This commit is contained in:
@@ -1,6 +1,10 @@
|
|||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
signingConfigs {
|
||||||
|
config {
|
||||||
|
}
|
||||||
|
}
|
||||||
compileSdkVersion 26
|
compileSdkVersion 26
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "de.tonifetzer.conductorswatch"
|
applicationId "de.tonifetzer.conductorswatch"
|
||||||
@@ -19,7 +23,7 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
implementation 'com.android.support.constraint:constraint-layout:1.0.2'
|
||||||
testImplementation 'junit:junit:4.12'
|
testImplementation 'junit:junit:4.12'
|
||||||
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
androidTestImplementation 'com.android.support.test:runner:1.0.1'
|
||||||
|
|||||||
@@ -22,8 +22,8 @@
|
|||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name">
|
android:label="@string/app_name"
|
||||||
>
|
android:configChanges="orientation|screenSize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
<category android:name="android.intent.category.LAUNCHER" />
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class DataLayerListenerService extends WearableListenerService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(MessageEvent messageEvent) {
|
public void onMessageReceived(MessageEvent messageEvent) {
|
||||||
LOGD(TAG, "onMessageReceived: " + messageEvent);
|
//LOGD(TAG, "onMessageReceived: " + messageEvent);
|
||||||
|
|
||||||
// Check to see if the message is to start an activity
|
// Check to see if the message is to start an activity
|
||||||
if (messageEvent.getPath().equals(START_ACTIVITY_PATH)) {
|
if (messageEvent.getPath().equals(START_ACTIVITY_PATH)) {
|
||||||
|
|||||||
@@ -1,25 +1,30 @@
|
|||||||
package de.tonifetzer.conductorswatch;
|
package de.tonifetzer.conductorswatch;
|
||||||
|
|
||||||
import android.net.Uri;
|
import android.graphics.Color;
|
||||||
import android.support.annotation.NonNull;
|
import android.media.MediaPlayer;
|
||||||
import android.support.annotation.Nullable;
|
|
||||||
import android.support.v7.app.AppCompatActivity;
|
import android.support.v7.app.AppCompatActivity;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import android.view.SoundEffectConstants;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.google.android.gms.tasks.Task;
|
|
||||||
import com.google.android.gms.wearable.MessageEvent;
|
import com.google.android.gms.wearable.MessageEvent;
|
||||||
import com.google.android.gms.wearable.MessageClient;
|
import com.google.android.gms.wearable.MessageClient;
|
||||||
import com.google.android.gms.wearable.Wearable;
|
import com.google.android.gms.wearable.Wearable;
|
||||||
|
|
||||||
|
import java.util.Timer;
|
||||||
|
|
||||||
public class MainActivity extends AppCompatActivity implements MessageClient.OnMessageReceivedListener{
|
public class MainActivity extends AppCompatActivity implements MessageClient.OnMessageReceivedListener{
|
||||||
|
|
||||||
private TextView mTextView;
|
private TextView mTextView;
|
||||||
private String mCurBPM;
|
Timer mTimer;
|
||||||
|
|
||||||
private static final String TAG = "DataLayerService";
|
private static final String TAG = "DataLayerService";
|
||||||
private static final String START_ACTIVITY_PATH = "/start-activity";
|
private static final String START_ACTIVITY_PATH = "/start-activity";
|
||||||
|
private static final String START_RECORD_PATH = "/start-record";
|
||||||
|
private static final String STOP_RECORD_PATH = "/stop-record";
|
||||||
|
private static final String UPDATE_PATH = "/update";
|
||||||
|
|
||||||
|
private boolean mIsRecording = false;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -44,14 +49,36 @@ public class MainActivity extends AppCompatActivity implements MessageClient.OnM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(MessageEvent messageEvent) {
|
public void onMessageReceived(MessageEvent messageEvent) {
|
||||||
|
|
||||||
|
String[] parts = messageEvent.getPath().split(":");
|
||||||
|
|
||||||
// Check to see if the message is to start an activity
|
// Check to see if the message is to start an activity
|
||||||
if (messageEvent.getPath().equals(START_ACTIVITY_PATH)) {
|
if (messageEvent.getPath().equals(START_ACTIVITY_PATH)) {
|
||||||
Log.d(TAG, "onStartReceived: " + messageEvent);
|
Log.d(TAG, "onStartReceived: " + messageEvent);
|
||||||
|
//this happens if the app is already running
|
||||||
|
//TODO: handle this in wear app
|
||||||
}
|
}
|
||||||
else{
|
else if (messageEvent.getPath().contains(START_RECORD_PATH)){
|
||||||
//update bpm
|
|
||||||
Log.d(TAG, "onBPMReceived: " + messageEvent);
|
if(mIsRecording){
|
||||||
//mTextView.setText(messageEvent.getPath());
|
mTextView.setText(parts[2]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
mTimer = new Timer();
|
||||||
|
mTimer.scheduleAtFixedRate(new Metronome(this) , 0, 60000 / Integer.parseInt(parts[1]));
|
||||||
|
mTextView.setTextColor(Color.parseColor("#EE693F"));
|
||||||
|
mIsRecording = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (messageEvent.getPath().contains(STOP_RECORD_PATH)){
|
||||||
|
|
||||||
|
mTimer.cancel();
|
||||||
|
mTextView.setTextColor(Color.parseColor("#158b69"));
|
||||||
|
mIsRecording = false;
|
||||||
|
}
|
||||||
|
else if (messageEvent.getPath().contains(UPDATE_PATH)){
|
||||||
|
mTextView.setText(parts[2]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package de.tonifetzer.conductorswatch;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.media.AudioManager;
|
||||||
|
import android.media.MediaPlayer;
|
||||||
|
import android.media.SoundPool;
|
||||||
|
|
||||||
|
import java.util.TimerTask;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by toni on 20/12/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Metronome extends TimerTask {
|
||||||
|
|
||||||
|
//private MediaPlayer mMediaPlayer;
|
||||||
|
private SoundPool soundPool;
|
||||||
|
boolean loaded = false;
|
||||||
|
private int soundID;
|
||||||
|
|
||||||
|
public Metronome(Context context){
|
||||||
|
soundPool = new SoundPool.Builder().setMaxStreams(10).build();
|
||||||
|
soundPool.setOnLoadCompleteListener(new SoundPool.OnLoadCompleteListener() {
|
||||||
|
@Override
|
||||||
|
public void onLoadComplete(SoundPool soundPool, int sampleId, int status) {
|
||||||
|
loaded = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
soundID = soundPool.load(context, R.raw.metronom4, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
//TODO: better solution. create sound with the exact length and then loop forever with loop: -1
|
||||||
|
public void run() {
|
||||||
|
if (loaded) {
|
||||||
|
soundPool.stop(soundID);
|
||||||
|
soundPool.play(soundID, 1, 1, 1, 0, 1f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,13 +8,14 @@
|
|||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/bpmText"
|
android:id="@+id/bpmText"
|
||||||
|
android:soundEffectsEnabled="true"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
android:text="240"
|
android:text="80"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
android:textColor="#158b69"
|
android:textColor="#158b69"
|
||||||
android:textSize="100sp"/>
|
android:textSize="100sp"/>
|
||||||
|
|||||||
BIN
android/ConductorsPhone/app/src/main/res/raw/metronom4.ogg
Normal file
BIN
android/ConductorsPhone/app/src/main/res/raw/metronom4.ogg
Normal file
Binary file not shown.
@@ -86,6 +86,8 @@ public class Estimator implements SensorEventListener {
|
|||||||
mAccelerometerWindowBuffer.add(new AccelerometerData(System.currentTimeMillis(), se.values[0], se.values[1], se.values[2]));
|
mAccelerometerWindowBuffer.add(new AccelerometerData(System.currentTimeMillis(), se.values[0], se.values[1], se.values[2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: get also gyro and write stuff into file
|
||||||
|
|
||||||
// mSensorUpdateFlag = false;
|
// mSensorUpdateFlag = false;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,6 +41,10 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
|
|
||||||
// connection to phone stuff
|
// connection to phone stuff
|
||||||
private static final String START_ACTIVITY_PATH = "/start-activity";
|
private static final String START_ACTIVITY_PATH = "/start-activity";
|
||||||
|
private static final String START_RECORD_PATH = "/start-record";
|
||||||
|
private static final String STOP_RECORD_PATH = "/stop-record";
|
||||||
|
private static final String UPDATE_PATH = "/update";
|
||||||
|
|
||||||
public static final String TAG = "DataLayerListenerService";
|
public static final String TAG = "DataLayerListenerService";
|
||||||
private GoogleApiClient mGoogleApiClient;
|
private GoogleApiClient mGoogleApiClient;
|
||||||
private Node mNode;
|
private Node mNode;
|
||||||
@@ -85,6 +89,10 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
args.putInt("bpm", mCroller.getProgress());
|
args.putInt("bpm", mCroller.getProgress());
|
||||||
worker.setArguments(args);
|
worker.setArguments(args);
|
||||||
|
|
||||||
|
//send data to phone, that we start to record
|
||||||
|
String curProgress = Integer.toString(mCroller.getProgress());
|
||||||
|
sendMessage(START_RECORD_PATH + ":" + curProgress + ":" + curProgress);
|
||||||
|
|
||||||
//setter
|
//setter
|
||||||
worker.setCrollerWorker(mCroller);
|
worker.setCrollerWorker(mCroller);
|
||||||
worker.setTextViewWorker(mTextView);
|
worker.setTextViewWorker(mTextView);
|
||||||
@@ -103,6 +111,9 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
mCroller.setBackCircleColor(Color.parseColor("#158b69"));
|
mCroller.setBackCircleColor(Color.parseColor("#158b69"));
|
||||||
mTextView.setTextColor(Color.parseColor("#158b69"));
|
mTextView.setTextColor(Color.parseColor("#158b69"));
|
||||||
mCroller.setProgress(mMetronomBpm);
|
mCroller.setProgress(mMetronomBpm);
|
||||||
|
|
||||||
|
//send data to phone, that we stopped to record
|
||||||
|
sendMessage(STOP_RECORD_PATH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -163,6 +174,10 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
mCroller.interruptMainCircleColorAnimated();
|
mCroller.interruptMainCircleColorAnimated();
|
||||||
mCroller.interruptBackCircleAnimated();
|
mCroller.interruptBackCircleAnimated();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
mCroller.setBackCircleColor(Color.parseColor("#cccccc"));
|
||||||
|
mCroller.setMainCircleColor(Color.parseColor("#ffffff"));
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -252,8 +267,18 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
@Override
|
@Override
|
||||||
public void onProgressChanged(int progress) {
|
public void onProgressChanged(int progress) {
|
||||||
// use the progress
|
// use the progress
|
||||||
mTextView.setText(String.valueOf(progress));
|
String curProgress = Integer.toString(progress);
|
||||||
sendMessage(Integer.toString(progress));
|
String metronomBpm = Integer.toString(mMetronomBpm);;
|
||||||
|
mTextView.setText(curProgress);
|
||||||
|
|
||||||
|
//TODO: too many messages? or just because of thread?
|
||||||
|
if(mModeRecord){
|
||||||
|
sendMessage(START_RECORD_PATH + ":" + metronomBpm + ":" + curProgress);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
sendMessage(UPDATE_PATH + ":" + metronomBpm + ":" + curProgress);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -274,8 +299,10 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
|
|
||||||
private void sendMessage(String Key) {
|
private void sendMessage(String Key) {
|
||||||
|
|
||||||
|
//TODO: sammel key's und schicke nur die hälfte
|
||||||
|
|
||||||
if (mNode != null && mGoogleApiClient!= null && mGoogleApiClient.isConnected()) {
|
if (mNode != null && mGoogleApiClient!= null && mGoogleApiClient.isConnected()) {
|
||||||
Log.d(TAG, "-- " + mGoogleApiClient.isConnected());
|
//Log.d(TAG, "-- " + mGoogleApiClient.isConnected());
|
||||||
Wearable.MessageApi.sendMessage(
|
Wearable.MessageApi.sendMessage(
|
||||||
mGoogleApiClient, mNode.getId(), Key, new byte[0]).setResultCallback(
|
mGoogleApiClient, mNode.getId(), Key, new byte[0]).setResultCallback(
|
||||||
|
|
||||||
@@ -283,7 +310,7 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
@Override
|
@Override
|
||||||
public void onResult(MessageApi.SendMessageResult sendMessageResult) {
|
public void onResult(MessageApi.SendMessageResult sendMessageResult) {
|
||||||
|
|
||||||
Log.d(TAG, "--- " + sendMessageResult.getStatus().getStatusCode());
|
//Log.d(TAG, "-- " + sendMessageResult.getStatus().getStatusCode());
|
||||||
if (!sendMessageResult.getStatus().isSuccess()) {
|
if (!sendMessageResult.getStatus().isSuccess()) {
|
||||||
Log.e(TAG, "Failed to send message with status code: "
|
Log.e(TAG, "Failed to send message with status code: "
|
||||||
+ sendMessageResult.getStatus().getStatusCode());
|
+ sendMessageResult.getStatus().getStatusCode());
|
||||||
@@ -316,7 +343,6 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFragmentStopped(Vector<Double> bpmList) {
|
public void onFragmentStopped(Vector<Double> bpmList) {
|
||||||
|
|
||||||
@@ -332,19 +358,12 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
super.onStart();
|
super.onStart();
|
||||||
if (!mResolvingError) {
|
if (!mResolvingError) {
|
||||||
mGoogleApiClient.connect();
|
mGoogleApiClient.connect();
|
||||||
|
|
||||||
|
//TODO. mGoogleApiClient.disconnect(); implementieren in onPause()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: rename this! onTapBPMNewEstimation or something like that
|
||||||
//start app on phone
|
|
||||||
//TODO: bissle cleverer machen. starten und auf antwort warten. falls er sagt "bin schon an" nicht mehr senden
|
|
||||||
// ansonsten nochmal versuchen.bzw. auch von anderen stellen (bei click etc) aufrufen.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//TODO: disconnect or own class for this stuff
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNewEstimation(int bpm) {
|
public void onNewEstimation(int bpm) {
|
||||||
mTapBpmEstimation = bpm;
|
mTapBpmEstimation = bpm;
|
||||||
@@ -363,6 +382,7 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: rename this! onTapBPMFinished or something like that
|
||||||
@Override
|
@Override
|
||||||
public void onFinished() {
|
public void onFinished() {
|
||||||
|
|
||||||
@@ -387,13 +407,16 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
public void onConnected(@Nullable Bundle bundle) {
|
public void onConnected(@Nullable Bundle bundle) {
|
||||||
resolveNode();
|
resolveNode();
|
||||||
|
|
||||||
|
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
||||||
while(mNode == null){
|
while(mNode == null){
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000L);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
sendMessage(START_ACTIVITY_PATH);
|
sendMessage(START_ACTIVITY_PATH);
|
||||||
}
|
}
|
||||||
@@ -403,12 +426,12 @@ public class MainActivity extends WearableActivity implements WorkerFragment.OnF
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionSuspended(int i) {
|
public void onConnectionSuspended(int i) {
|
||||||
|
//TODO: implement this
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
|
public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
|
||||||
|
//TODO: implement this
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resolveNode() {
|
private void resolveNode() {
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ public class WorkerFragment extends Fragment implements Metronome.OnMetronomeLis
|
|||||||
//mBpmThread = new Thread(mEstimator, "estThread");
|
//mBpmThread = new Thread(mEstimator, "estThread");
|
||||||
mBpmList = new Vector<Double>();
|
mBpmList = new Vector<Double>();
|
||||||
|
|
||||||
|
|
||||||
// init metronome and listener
|
// init metronome and listener
|
||||||
mMetronome = new Metronome(getArguments().getInt("bpm"));
|
mMetronome = new Metronome(getArguments().getInt("bpm"));
|
||||||
mMetronome.add(this);
|
mMetronome.add(this);
|
||||||
@@ -69,7 +68,6 @@ public class WorkerFragment extends Fragment implements Metronome.OnMetronomeLis
|
|||||||
|
|
||||||
mVibrator = (Vibrator) this.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
mVibrator = (Vibrator) this.getActivity().getSystemService(Context.VIBRATOR_SERVICE);
|
||||||
|
|
||||||
|
|
||||||
//keep screen always on
|
//keep screen always on
|
||||||
this.getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
this.getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package de.tonifetzer.conductorswatch.utilities;
|
||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.DataOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by toni on 20/12/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class FileWriter {
|
||||||
|
|
||||||
|
private String mFilename;
|
||||||
|
|
||||||
|
private ByteArrayOutputStream mByteStream;
|
||||||
|
private DataOutputStream mDataStream;
|
||||||
|
|
||||||
|
FileWriter(String filename){
|
||||||
|
mFilename = filename;
|
||||||
|
mByteStream = new ByteArrayOutputStream();
|
||||||
|
mDataStream = new DataOutputStream(mByteStream);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeDouble(double data){
|
||||||
|
try {
|
||||||
|
mDataStream.writeDouble(data);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeString(String data){
|
||||||
|
try {
|
||||||
|
mDataStream.writeChars(data);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void writeInt(int data){
|
||||||
|
try {
|
||||||
|
mDataStream.writeInt(data);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte[] getByteArray(){
|
||||||
|
return mByteStream.toByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getFilename(){
|
||||||
|
return mFilename;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reset(){
|
||||||
|
mByteStream.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close(){
|
||||||
|
try {
|
||||||
|
mByteStream.close();
|
||||||
|
mDataStream.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,5 +33,6 @@ public class MovingFilter {
|
|||||||
|
|
||||||
public void clear(){
|
public void clear(){
|
||||||
mSamples.clear();
|
mSamples.clear();
|
||||||
|
mTotal = 0d;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user