Commit bdd0ce76 authored by Harshith Goka's avatar Harshith Goka

ArrayOutOfBound , Last resort

parent 72299da0
......@@ -13,13 +13,18 @@ public class Constants {
public static int READ_STATUS_OK = 0;
public static int READ_STATUS_NOT_OK = 1;
public static String MUSIC_PLAYER = "Music Player";
public static String PLAY_PAUSE = "Play/Pause";
public static String OK_GOOGLE = "Ok Google";
public static String OPEN_CAMERA = "Camera";
public static String GOOGLE_NOW = "GoogleApp";
public static String CAMERA_CLICK = "CameraClick";
public static String VOLUME_UP="VolumeUp";
public static String VOLUME_DOWN="VolumeDown";
public static String VOLUME_CONTROL="Volume Control";
public static String END_CALL="EndCall";
public static String HOME="Home";
public static String BACK = "Back";
public static int MODE_NORMAL = 0;
public static int MODE_VOLUME = 255;
}
......@@ -4,13 +4,13 @@ package com.example.harshith.ddc;
public class Gesture{
public int dataPoints = 50;
public int sensors = 10;
public int sensors = 11;
public int adcLevels = 2;
public int adcUpper = 0;
public int adcLower = 100;
public int mpuLevels = 3;
public int mpuUpper = 18000;
public int mpuLower = -18000;
public int mpuLevels = 100;
public int mpuUpper = 50;
public int mpuLower = -50;
public Gesture(){}
......
......@@ -66,7 +66,7 @@ public class MainActivity extends AppCompatActivity {
checkBTState();
if(checkSelfPermission(android.Manifest.permission.CALL_PHONE) == PackageManager.PERMISSION_DENIED){
requestPermissions(new String[]{android.Manifest.permission.CALL_PHONE},1);
requestPermissions(new String[]{android.Manifest.permission.CALL_PHONE,"android.permission.READ_EXTERNAL_STORAGE"},1);
}
mPairedDevicesArrayAdapter.clear();
......
package com.example.harshith.ddc;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.support.annotation.Nullable;
/**
* Created by harshith on 18/6/16.
*/
public class ProcessService extends Service {
@Override
public void onCreate() {
}
@Nullable
@Override
public IBinder onBind(Intent intent) {
return null;
}
}
package com.example.harshith.ddc;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
/**
* Created by harshith on 18/6/16.
*/
public class ProcessThread extends Thread{
int[] liveReadings;
Handler handler;
GlobalClass globalClass;
public ProcessThread(GlobalClass globalClass) {
liveReadings = null;
this.globalClass = globalClass;
}
@Override
public void run() {
Looper.prepare();
handler = new Handler(){
@Override
public void handleMessage(Message msg) {
liveReadings = (int[]) msg.obj;
L.m(liveReadings.toString());
}
};
globalClass.setProcessHandler(handler);
Looper.loop();
while (true){
if(liveReadings != null){
}
}
}
}
......@@ -49,17 +49,16 @@ public class StaticGesture extends Gesture {
Frame []f = new Frame[sensors];
for (int i=0; i<4; i++) {
f[i] = new Frame(hand[i], false, adcUpper, adcLower, 2);
for (int i=0; i<5; i++) {
f[i] = new Frame(hand[i], false, adcUpper, adcLower, adcLevels);
}
for (int i=4; i<sensors; i++) {
f[i] = new Frame(hand[i], true, mpuUpper, mpuLower, 3);
for (int i=5; i<sensors; i++) {
f[i] = new Frame(hand[i], true, mpuUpper, mpuLower, mpuLevels);
}
for (int i=0; i<sensors; i++) {
f[i].pushLimits(data[i]);
}
this.updateFrame(data);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment