init commit

This commit is contained in:
toni
2016-06-02 18:50:39 +02:00
commit 29a616c3df
49 changed files with 1801 additions and 0 deletions

8
.gitignore vendored Normal file
View File

@@ -0,0 +1,8 @@
*.iml
.gradle
/local.properties
/.idea/workspace.xml
/.idea/libraries
.DS_Store
/build
/captures

1
.idea/.name generated Normal file
View File

@@ -0,0 +1 @@
SensorReadout

22
.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<resourceExtensions />
<wildcardResourcePatterns>
<entry name="!?*.java" />
<entry name="!?*.form" />
<entry name="!?*.class" />
<entry name="!?*.groovy" />
<entry name="!?*.scala" />
<entry name="!?*.flex" />
<entry name="!?*.kt" />
<entry name="!?*.clj" />
<entry name="!?*.aj" />
</wildcardResourcePatterns>
<annotationProcessing>
<profile default="true" name="Default" enabled="false">
<processorPath useClasspath="true" />
</profile>
</annotationProcessing>
</component>
</project>

3
.idea/copyright/profiles_settings.xml generated Normal file
View File

@@ -0,0 +1,3 @@
<component name="CopyrightManager">
<settings default="" />
</component>

18
.idea/gradle.xml generated Normal file
View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="1.8" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

46
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="NullableNotNullManager">
<option name="myDefaultNullable" value="android.support.annotation.Nullable" />
<option name="myDefaultNotNull" value="android.support.annotation.NonNull" />
<option name="myNullables">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.Nullable" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nullable" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.Nullable" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.Nullable" />
</list>
</value>
</option>
<option name="myNotNulls">
<value>
<list size="4">
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
<item index="3" class="java.lang.String" itemvalue="android.support.annotation.NonNull" />
</list>
</value>
</option>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

9
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/SensorReadout.iml" filepath="$PROJECT_DIR$/SensorReadout.iml" />
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
</modules>
</component>
</project>

12
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
</set>
</option>
</component>
</project>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="" />
</component>
</project>

1
app/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/build

29
app/build.gradle Normal file
View File

@@ -0,0 +1,29 @@
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion "23.0.2"
defaultConfig {
applicationId "de.fhws.indoor.sensorreadout"
minSdkVersion 18
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.support:wearable:1.3.0'
compile 'com.google.android.gms:play-services-wearable:8.4.0'
provided 'com.google.android.wearable:wearable:1.0.0'
}

17
app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,17 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /home/toni/Android/Sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

View File

@@ -0,0 +1,13 @@
package de.fhws.indoor.sensorreadout;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
public class ApplicationTest extends ApplicationTestCase<Application> {
public ApplicationTest() {
super(Application.class);
}
}

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="de.fhws.indoor.sensorreadout">>
<!--<uses-feature android:name="android.hardware.type.watch" /> -->
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.BODY_SENSORS"/>
<uses-permission-sdk-23 android:name="android.permission.ACCESS_FINE_LOCATION" />
<application android:allowBackup="true" android:icon="@drawable/icon"
android:label="@string/app_name" android:theme="@style/AppTheme">
<uses-library android:name="com.google.android.wearable"
android:required="false" />
<activity android:name=".MainActivity" android:configChanges="orientation"
android:label="@string/app_name" android:screenOrientation="nosensor">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,289 @@
package de.fhws.indoor.sensorreadout;
import android.Manifest;
import android.content.res.Configuration;
import android.graphics.Color;
import android.media.MediaPlayer;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.app.ActivityCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.Toast;
import android.view.ViewGroup.LayoutParams;
import java.util.ArrayList;
import java.util.List;
import de.fhws.indoor.sensorreadout.sensors.GroundTruth;
import de.fhws.indoor.sensorreadout.sensors.Logger;
import de.fhws.indoor.sensorreadout.sensors.PhoneSensors;
import de.fhws.indoor.sensorreadout.sensors.WiFi;
import de.fhws.indoor.sensorreadout.sensors.iBeacon;
import de.fhws.indoor.sensorreadout.sensors.iBeaconOld;
import de.fhws.indoor.sensorreadout.sensors.mySensor;
import de.fhws.indoor.sensorreadout.sensors.SensorType;
public class MainActivity extends AppCompatActivity {
private final ArrayList<mySensor> sensors = new ArrayList<mySensor>();
private final ArrayList<TextView> txtFields = new ArrayList<TextView>();
private final Logger logger = new Logger(this);
private Button btnStart;
private Button btnStop;
private Button btnGround;
private int groundTruthCounter = 0;
private int loadCounterWifi = 0;
private int loadCounterBeacon = 0;
private boolean isInitialized = false;
final private int MY_PERMISSIONS_REQUEST_READ_CONTACTS = 123;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//init Path spinner
final Spinner pathSpinner = (Spinner) findViewById(R.id.pathspinner);
List<String> pathList = new ArrayList<String>();
for (int i=0; i<=255; i++){
pathList.add("Path: " + i);
}
ArrayAdapter<String> pathDataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, pathList);
pathDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
pathSpinner.setAdapter(pathDataAdapter);
//init GroundTruthPoint spinner
final Spinner groundSpinner = (Spinner) findViewById(R.id.groundspinner);
List<String> groundList = new ArrayList<String>();
for (int i=0; i<=255; i++){
groundList.add("Num: " + i);
}
ArrayAdapter<String> groundDataAdapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, groundList);
groundDataAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
groundSpinner.setAdapter(groundDataAdapter);
//get Buttons
btnStart = (Button) findViewById(R.id.btnStart);
btnStop = (Button) findViewById(R.id.btnStop);
btnGround = (Button) findViewById(R.id.btnGround);
//Click Sound
final MediaPlayer mpStart = MediaPlayer.create(this, R.raw.go);
final MediaPlayer mpStop = MediaPlayer.create(this, R.raw.go);
final MediaPlayer mpGround = MediaPlayer.create(this, R.raw.go);
final MediaPlayer mpFailure = MediaPlayer.create(this, R.raw.go);
// log GroundTruth ButtonClicks using sensor number 99
final GroundTruth grndTruth = new GroundTruth(this);
sensors.add(grndTruth);
grndTruth.setListener(new mySensor.SensorListener() {
@Override public void onData(final String csv) { return; }
@Override public void onData(int id, final String csv) {add(id, csv); }
});
btnStart.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
if(!isInitialized){
start();
isInitialized = true;
mpStart.start();
//Write path id and ground truth point num
grndTruth.writeInitData(Integer.parseInt(pathSpinner.getSelectedItem().toString().replaceAll("[\\D]", "")),
Integer.parseInt(groundSpinner.getSelectedItem().toString().replaceAll("[\\D]", "")));
//Write the first groundTruthPoint
grndTruth.writeGroundTruth(groundTruthCounter);
//Disable the spinners
groundSpinner.setEnabled(false);
pathSpinner.setEnabled(false);
}
else{
mpFailure.start();
}
}
});
btnStop.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
if(isInitialized){
//write the last groundTruthPoint
grndTruth.writeGroundTruth(++groundTruthCounter);
groundTruthCounter = 0;
btnGround.setText("Ground Truth");
stop();
isInitialized = false;
mpStop.start();
//Enable the spinners
groundSpinner.setEnabled(true);
pathSpinner.setEnabled(true);
}
else{
mpFailure.start();
}
}
});
btnGround.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
if(isInitialized) {
String numGroundTruthPoints = groundSpinner.getSelectedItem().toString().replaceAll("[\\D]", "");
btnGround.setText(Integer.toString(++groundTruthCounter) + " / "
+ numGroundTruthPoints
);
mpGround.start();
grndTruth.writeGroundTruth(groundTruthCounter);
}
else{
mpFailure.start();
}
}
});
//all Sensors
final PhoneSensors phoneSensors = new PhoneSensors(this);
sensors.add(phoneSensors);
phoneSensors.setListener(new mySensor.SensorListener(){
@Override public void onData(final String csv) { return; }
@Override public void onData(int id, final String csv) {add(id, csv); }
});
// logo wifi using sensor number 8
final WiFi wifi = new WiFi(this);
sensors.add(wifi);
wifi.setListener(new mySensor.SensorListener() {
@Override public void onData(final String csv) { add(SensorType.WIFI.ordinal(), csv); }
@Override public void onData(int id, final String csv) {return; }
});
// log iBeacons using sensor number 9
final mySensor beacon;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
beacon = new iBeacon(this);
} else{
beacon = new iBeaconOld(this);
}
sensors.add(beacon);
beacon.setListener(new mySensor.SensorListener() {
@Override public void onData(final String csv) { add(SensorType.IBEACON.ordinal(), csv); }
@Override public void onData(int id, final String csv) {return; }
});
final LinearLayout lay = (LinearLayout) findViewById(R.id.layoutMain);
lay.setOrientation(LinearLayout.HORIZONTAL);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
params.setMargins(10,10,10,10);
for (int i = 0; i < sensors.size(); ++i) {
final TextView tv = new TextView(this);
//Set margin and color
tv.setTextColor(Color.parseColor("#2fbf78"));
tv.setLayoutParams(params);
lay.addView(tv);
txtFields.add(tv);
}
if(ActivityCompat.shouldShowRequestPermissionRationale(this,
Manifest.permission.ACCESS_FINE_LOCATION)) {
} else {
ActivityCompat.requestPermissions(this,
new String[]{Manifest.permission.ACCESS_FINE_LOCATION},
MY_PERMISSIONS_REQUEST_READ_CONTACTS);
}
}
private void start() {
logger.start();
txtFields.get(2).setText(logger.getFile().getAbsolutePath());
for (final mySensor s : sensors) {s.onResume(this);}
}
private void stop() {
logger.stop();
for(int i = 0; i < txtFields.size(); i++)
{
txtFields.get(i).setText("");
}
for (final mySensor s : sensors) {s.onPause(this);}
}
/** new sensor data */
private void add(final int nr, final String csv) {
logger.addCSV(nr, csv);
runOnUiThread(new Runnable() {
@Override public void run() {
if (nr == 8) {
if (loadCounterWifi % 2 == 0) {
txtFields.get(0).setText("wifi");
++loadCounterWifi;
} else {
txtFields.get(0).setText("WIFI");
++loadCounterWifi;
}
}
if (nr == 9){
if(loadCounterBeacon % 2 == 0){
txtFields.get(1).setText("beacon");
++loadCounterBeacon;
} else {
txtFields.get(1).setText("BEACON");
++loadCounterBeacon;
}
}
}
});
}
/** pause activity */
protected void onPause() {
//stop();
super.onPause();
}
/** resume activity */
protected void onResume() {
super.onResume();
}
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
// Checks the orientation of the screen
if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
Toast.makeText(this, "landscape", Toast.LENGTH_SHORT).show();
} else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
Toast.makeText(this, "portrait", Toast.LENGTH_SHORT).show();
}
}
}

View File

@@ -0,0 +1,43 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.content.Context;
import android.os.Build;
import android.os.Environment;
import android.util.Log;
import java.io.File;
/**
* Created by toni on 02/06/16.
*/
/**
* Class: DataFolder
* Description: SDK save file class. Is able to open a folder on the device independent of the given
* device and android skd version.
*/
public class DataFolder {
private Context context;
private File folder;
public DataFolder(Context context, String folderName){
this.context = context;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
folder = new File(context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS), folderName);
} else {
folder = new File(Environment.getExternalStorageDirectory() + "/" + folderName);
}
folder.mkdirs();
boolean isExtistingFolder = folder.exists();
boolean isDirectory = folder.isDirectory();
Log.d("DataFolder", String.valueOf(isExtistingFolder));
}
public File getFolder(){
return folder;
}
}

View File

@@ -0,0 +1,38 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.app.Activity;
/**
* Created by Toni on 02.06.2015.
*/
public class GroundTruth extends mySensor {
public GroundTruth(final Activity act){
//empty as my soul
}
public void writeGroundTruth(int groundTruthCounter){
if (listener != null){listener.onData(99,
Integer.toString(groundTruthCounter) + ";"
);}
}
public void writeInitData(int pathID, int numGroundTruthPoints){
if (listener != null){listener.onData(-1,
Integer.toString(pathID) + ";" +
Integer.toString(numGroundTruthPoints) + ";"
);}
}
@Override
public void onResume(Activity act) {
}
@Override
public void onPause(Activity act) {
}
}

View File

@@ -0,0 +1,25 @@
package de.fhws.indoor.sensorreadout.sensors;
/**
* Created by Frank on 04.02.2016.
*/
public class Limiter {
long last_ms = 0;
final int limit_ms;
/** ctor */
Limiter(final int limit_ms) {
this.limit_ms = limit_ms;
}
/** limit reached? */
boolean isOK() {
final long cur_ms = System.currentTimeMillis();
final long diff = cur_ms - last_ms;
final boolean ok = diff > limit_ms;
if (ok) {last_ms = cur_ms;}
return ok;
}
}

View File

@@ -0,0 +1,81 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.content.Context;
import android.os.Environment;
import android.util.Log;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
/**
* log sensor data to file
* Created by Frank on 25.03.2015.
*/
public class Logger {
//private BufferedWriter bw;
private ByteArrayOutputStream baos;
private OutputStreamWriter osw;
private File file;
private Context context;
public Logger(Context context) {
this.context = context;
}
/** start logging (into RAM) */
public void start() {
DataFolder folder = new DataFolder(context, "sensorOutFiles");
file = new File(folder.getFolder(), System.currentTimeMillis() + ".csv");
Log.d("logger", file.toString());
baos = new ByteArrayOutputStream();
osw = new OutputStreamWriter(baos);
}
/** stop logging and flush RAM-data to the flash-chip */
public void stop() {
synchronized (this) {
try {
try {
// finally write the ram data to disk
osw.close();
final FileOutputStream fos = new FileOutputStream(file);
fos.write(baos.toByteArray());
fos.close();
} catch (final Exception e) {
throw new RuntimeException(e);
}
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
public File getFile() {
return file;
}
/** add a new CSV entry for the given sensor number */
public void addCSV(final int sensorNr, final String csv) {
final String s = System.currentTimeMillis() + ";" + sensorNr + ";" + csv;
// log to RAM
synchronized (this) {
try {
osw.write(s);
osw.write("\r\n");
} catch (final Exception e) {
throw new RuntimeException(e);
}
}
}
}

View File

@@ -0,0 +1,408 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.app.Activity;
import android.content.Context;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
/**
* Created by Toni on 25.03.2015.
*/
public class PhoneSensors extends mySensor implements SensorEventListener{
private SensorManager sensorManager;
private Sensor acc;
private Sensor grav;
private Sensor lin_acc;
private Sensor gyro;
private Sensor magnet;
private Sensor press;
private Sensor ori;
private Sensor heart;
private Sensor humidity;
private Sensor rotationVector;
private Sensor light;
private Sensor temperature;
private float[] mGravity = new float[3];
private float[] mGeomagnetic = new float[3];
//Limiter limitGyro = new Limiter(10);
//Limiter limitMag = new Limiter(10);
//Limiter limitAcc = new Limiter(10);
Limiter limitAOri = new Limiter(10);
public PhoneSensors(final Activity act){
sensorManager = (SensorManager) act.getSystemService(Context.SENSOR_SERVICE);
acc = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
grav = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY);
lin_acc = sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
gyro = sensorManager.getDefaultSensor(Sensor.TYPE_GYROSCOPE);
magnet = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
press = sensorManager.getDefaultSensor(Sensor.TYPE_PRESSURE);
ori = sensorManager.getDefaultSensor(Sensor.TYPE_ORIENTATION);
heart = sensorManager.getDefaultSensor(Sensor.TYPE_HEART_RATE);
humidity = sensorManager.getDefaultSensor(Sensor.TYPE_RELATIVE_HUMIDITY);
rotationVector = sensorManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
light = sensorManager.getDefaultSensor(Sensor.TYPE_LIGHT);
temperature = sensorManager.getDefaultSensor(Sensor.TYPE_AMBIENT_TEMPERATURE);
//Write Vendor to file
DataFolder folder = new DataFolder(act, "sensorOutFiles");
File file = new File(folder.getFolder(), "vendors.txt");
try {
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
//write sensor vendor information
bw.write("Device: " + android.os.Build.MODEL);
bw.newLine();
bw.newLine();
bw.write("id" + String.valueOf(SensorType.ACCELEROMETER.ordinal()) + " Accelerometer: " + getSensorName(acc));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.GRAVITY.ordinal()) + " Gravity: " + getSensorName(grav));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.LINEAR_ACCELERATION.ordinal()) + " Linear Acceleration: " + getSensorName(lin_acc));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.GYROSCOPE.ordinal()) + " Gyroscope: " + getSensorName(gyro));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.MAGNETIC_FIELD.ordinal()) + " Magnetic Field: " + getSensorName(magnet));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.PRESSURE.ordinal()) + " Pressure: " + getSensorName(press));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.RELATIVE_HUMIDITY.ordinal()) + " Humidity: " + getSensorName(humidity));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.ORIENTATION_OLD.ordinal()) + " Orientation Old: " + getSensorName(ori));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.LIGHT.ordinal()) + " Gyroscope: " + getSensorName(light));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.AMBIENT_TEMPERATURE.ordinal()) + " Magnetic Field: " + getSensorName(temperature));
bw.newLine();
bw.write("id" + String.valueOf(SensorType.HEART_RATE.ordinal()) + " Heart Rate: " + getSensorName(heart));
bw.newLine();
bw.close();
fw.close();
}catch (IOException e) {
e.printStackTrace();
}
}
private String getSensorName(Sensor sensor){
if(sensor != null){
StringBuilder message = new StringBuilder(2048);
message.append("\nVendor: " + sensor.getVendor() + "\n");
message.append("Version: " + sensor.getVersion() + "\n");
message.append("MinDelay: " + sensor.getMinDelay() + "\n");
//message.append("MaxDelay: " + sensor.getMaxDelay() + "\n");
message.append("MaxRange: " + sensor.getMaximumRange() + "\n");
message.append("Power: " + sensor.getPower() + "\n");
//message.append("ReportingMode: " + sensor.getReportingMode() + "\n");
message.append("Resolution: " + sensor.getResolution() + "\n");
message.append("Type: " + sensor.getType() + "\n\n");
//message.append("FifoMaxEventCount: " + sensor.getFifoMaxEventCount() + "\n");
//message.append("FifoReservedEventCount: " + sensor.getFifoReservedEventCount() + "\n");
return message.toString();
} else{
return "Sensor not in device";
}
}
@Override
public void onSensorChanged(SensorEvent event) {
// to compare with the other orientation
if(event.sensor.getType() == Sensor.TYPE_ORIENTATION) {
if (listener != null){
listener.onData(SensorType.ORIENTATION_OLD.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_HEART_RATE) {
if (listener != null){
listener.onData(SensorType.HEART_RATE.ordinal(),
Float.toString(event.values[0]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_LIGHT) {
if (listener != null){
listener.onData(SensorType.LIGHT.ordinal(),
Float.toString(event.values[0]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_AMBIENT_TEMPERATURE) {
if (listener != null){
listener.onData(SensorType.AMBIENT_TEMPERATURE.ordinal(),
Float.toString(event.values[0]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_RELATIVE_HUMIDITY) {
if (listener != null){
listener.onData(SensorType.RELATIVE_HUMIDITY.ordinal(),
Float.toString(event.values[0]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_ROTATION_VECTOR) {
if (listener != null){
if(event.values.length > 3){
listener.onData(SensorType.ROTATION_VECTOR.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";" +
Float.toString(event.values[3]) + ";"
);
} else {
listener.onData(SensorType.ROTATION_VECTOR.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";"
);
}
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_GYROSCOPE) {
// skip?
//if (!limitGyro.isOK()) {return;}
if (listener != null){
listener.onData(SensorType.GYROSCOPE.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_PRESSURE) {
if (listener != null){
listener.onData(SensorType.PRESSURE.ordinal(),
Float.toString(event.values[0]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_LINEAR_ACCELERATION) {
if (listener != null){
listener.onData(SensorType.LINEAR_ACCELERATION.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";"
);
}
return;
}
if(event.sensor.getType() == Sensor.TYPE_GRAVITY) {
float gravity_X = event.values[0];
float gravity_Y = event.values[1];
float gravity_Z = event.values[2];
if (listener != null){
listener.onData(SensorType.GRAVITY.ordinal(),
Float.toString(gravity_X) + ";" +
Float.toString(gravity_Y) + ";" +
Float.toString(gravity_Z) + ";"
);
}
}
if(event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
// skip?
//if (!limitAcc.isOK()) {return;}
System.arraycopy(event.values, 0, mGravity, 0, 3);
if (listener != null){
listener.onData(SensorType.ACCELEROMETER.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";"
);
}
updateOrientation();
}
if(event.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
// skip?
//if (!limitMag.isOK()) {return;}
System.arraycopy(event.values, 0, mGeomagnetic, 0, 3);
if (listener != null){
listener.onData(SensorType.MAGNETIC_FIELD.ordinal(),
Float.toString(event.values[0]) + ";" +
Float.toString(event.values[1]) + ";" +
Float.toString(event.values[2]) + ";"
);
}
updateOrientation();
}
}
/** calculate orientation from acc and mag */
private void updateOrientation() {
// skip?
if (!limitAOri.isOK()) {return;}
if (mGravity == null) {return;}
if (mGeomagnetic == null) {return;}
//rotationMatrix and orientation
float R[] = new float[16];
float I[] = new float[16];
boolean success = SensorManager.getRotationMatrix(R, I, mGravity, mGeomagnetic);
if (!success) {return;}
float orientation[] = new float[3];
SensorManager.getOrientation(R, orientation);
if (listener != null){
listener.onData(SensorType.ORIENTATION_NEW.ordinal(),
Float.toString(orientation[0]) + ";" +
Float.toString(orientation[1]) + ";" +
Float.toString(orientation[2]) + ";"
);
//Write the whole rotationMatrix R into the Listener.
listener.onData(SensorType.ROTATION_MATRIX.ordinal(),
Float.toString(R[0]) + ";" +
Float.toString(R[1]) + ";" +
Float.toString(R[2]) + ";" +
Float.toString(R[3]) + ";" +
Float.toString(R[4]) + ";" +
Float.toString(R[5]) + ";" +
Float.toString(R[6]) + ";" +
Float.toString(R[7]) + ";" +
Float.toString(R[8]) + ";" +
Float.toString(R[9]) + ";" +
Float.toString(R[10]) + ";" +
Float.toString(R[11]) + ";" +
Float.toString(R[12]) + ";" +
Float.toString(R[13]) + ";" +
Float.toString(R[14]) + ";" +
Float.toString(R[15]) + ";"
);
}
}
@Override
public void onAccuracyChanged(Sensor sensor, int accuracy) {
}
private void applyLowPassFilter(float[] input, float[] output) {
float alpha = 0.90f;
for (int i = 0; i < input.length; ++i) {
//output[i] = (output[i] * (alpha)) + (input[i] * (1-alpha));
output[i] = input[i]; // disabled
}
}
@Override
public void onResume(Activity act) {
// Register a listener for the sensor.
sensorManager.registerListener(this, acc, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, grav, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, gyro, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, lin_acc, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, magnet, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, press, SensorManager.SENSOR_DELAY_FASTEST); // speed OK
sensorManager.registerListener(this, ori, SensorManager.SENSOR_DELAY_FASTEST); // speed OK
sensorManager.registerListener(this, heart, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, humidity, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, rotationVector, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, light, SensorManager.SENSOR_DELAY_FASTEST);
sensorManager.registerListener(this, temperature, SensorManager.SENSOR_DELAY_FASTEST);
}
@Override
public void onPause(Activity act) {
sensorManager.unregisterListener(this);
}
}

View File

@@ -0,0 +1,23 @@
package de.fhws.indoor.sensorreadout.sensors;
/**
* Created by toni on 02/06/16.
*/
public enum SensorType {
ACCELEROMETER, // 0
GRAVITY, // 1
LINEAR_ACCELERATION, // 2
GYROSCOPE, // 3
MAGNETIC_FIELD, // 4
PRESSURE, // 5
ORIENTATION_NEW, // 6
ROTATION_MATRIX, // 7
WIFI, // 8
IBEACON, // 9
RELATIVE_HUMIDITY, // 10
ORIENTATION_OLD, // 11
ROTATION_VECTOR, // 12
LIGHT, // 13
AMBIENT_TEMPERATURE, // 14
HEART_RATE // 15
}

View File

@@ -0,0 +1,78 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.app.Activity;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.wifi.ScanResult;
import android.net.wifi.WifiManager;
import android.util.Log;
import java.util.List;
/**
* Created by Frank on 25.03.2015.
*/
public class WiFi extends mySensor {
private final Activity act;
private final WifiManager wifi;
private BroadcastReceiver receiver;
private boolean isReceiverRegistered;
public WiFi(final Activity act) {
this.act = act;
this.wifi = (WifiManager) act.getSystemService(Context.WIFI_SERVICE);
isReceiverRegistered = true;
this.receiver = new BroadcastReceiver() {
@Override public void onReceive(Context context, Intent intent) {
final StringBuilder sb = new StringBuilder();
final List<ScanResult> res = wifi.getScanResults();
for(final ScanResult sr : res) {
sb.append(sr.BSSID).append(";");
sb.append(sr.frequency).append(";");
sb.append(sr.level).append(";");
}
startScan();
if (listener != null && isReceiverRegistered) {listener.onData(sb.toString());}
//Log.d("wifi", sb.toString());
}
};
}
private void startScan() {
try {
//Method startScanActiveMethod = wifi.getClass().getMethod("startScanActive");
//startScanActiveMethod.invoke(wifi);
wifi.startScan();
Log.e("start", "wifi");
}catch (final Exception e) {
throw new RuntimeException(e);}
}
@Override
public void onResume(Activity act) {
act.registerReceiver(this.receiver, new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
isReceiverRegistered = true;
wifi.createWifiLock(wifi.WIFI_MODE_SCAN_ONLY, "ipin");
wifi.disconnect();
startScan();
}
@Override
public void onPause(Activity act) {
if (isReceiverRegistered) {
try {
act.unregisterReceiver(this.receiver);
} catch (Exception e) {
// Do nothing
}
isReceiverRegistered = false;
}
}
}

View File

@@ -0,0 +1,68 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.widget.Toast;
/**
* Created by Frank on 25.03.2015.
*/
public class iBeacon extends mySensor {
private final BluetoothAdapter bt;
private final BluetoothLeScanner scanner;
private static final int REQUEST_ENABLE_BT = 1;
private ScanCallback mLeScanCallback;
/** ctor */
public iBeacon(final Activity act) {
// sanity check
if (!act.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Toast.makeText(act, "Bluetooth-LE not supported!", Toast.LENGTH_SHORT).show();
}
// Initializes a Bluetooth adapter. For API level 18 and above, get a reference to
// BluetoothAdapter through BluetoothManager.
final BluetoothManager mgr = (BluetoothManager) act.getSystemService(Context.BLUETOOTH_SERVICE);
bt = mgr.getAdapter();
// bluetooth supported?
if (bt == null) {
Toast.makeText(act, "Bluetooth not supported!", Toast.LENGTH_SHORT).show();
}
scanner = bt.getBluetoothLeScanner();
mLeScanCallback = new ScanCallback() {
@Override public void onScanResult(int callbackType, android.bluetooth.le.ScanResult result) {
//Log.d("BT", device + " " + rssi);
if (listener != null) {listener.onData(result.getDevice().getAddress() + ";" + result.getRssi());}
}
};
}
void enableBT(final Activity act) {
if (!bt.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
act.startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
}
@Override public void onResume(final Activity act) {
enableBT(act);
scanner.startScan(mLeScanCallback);
}
@Override public void onPause(final Activity act) {
scanner.stopScan(mLeScanCallback);
}
}

View File

@@ -0,0 +1,66 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.app.Activity;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.widget.Toast;
/**
* Created by toni on 02/06/16.
*/
public class iBeaconOld extends mySensor {
private final BluetoothAdapter bt;
private static final int REQUEST_ENABLE_BT = 1;
private BluetoothAdapter.LeScanCallback mLeScanCallback;
/** ctor */
public iBeaconOld(final Activity act) {
// sanity check
if (!act.getPackageManager().hasSystemFeature(PackageManager.FEATURE_BLUETOOTH_LE)) {
Toast.makeText(act, "Bluetooth-LE not supported!", Toast.LENGTH_SHORT).show();
}
// Initializes a Bluetooth adapter. For API level 18 and above, get a reference to
// BluetoothAdapter through BluetoothManager.
final BluetoothManager mgr = (BluetoothManager) act.getSystemService(Context.BLUETOOTH_SERVICE);
bt = mgr.getAdapter();
// bluetooth supported?
if (bt == null) {
Toast.makeText(act, "Bluetooth not supported!", Toast.LENGTH_SHORT).show();
}
mLeScanCallback = new BluetoothAdapter.LeScanCallback() {
@Override public void onLeScan(final BluetoothDevice device, int rssi, byte[] scanRecord) {
//Log.d("BT", device + " " + rssi);
if (listener != null) {listener.onData(device + ";" + rssi);}
}
};
}
void enableBT(final Activity act) {
if (!bt.isEnabled()) {
Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
act.startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT);
}
}
@Override public void onResume(final Activity act) {
enableBT(act);
bt.startLeScan(mLeScanCallback);
}
@Override public void onPause(final Activity act) {
bt.stopLeScan(mLeScanCallback);
}
}

View File

@@ -0,0 +1,23 @@
package de.fhws.indoor.sensorreadout.sensors;
import android.app.Activity;
/**
* Created by Frank on 25.03.2015.
*/
public abstract class mySensor {
public interface SensorListener {
public void onData(final String csv);
public void onData(int id, final String csv);
}
protected SensorListener listener = null;
public abstract void onResume(final Activity act);
public abstract void onPause(final Activity act);
public void setListener(final SensorListener listener) {this.listener = listener;}
}

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true"
android:drawable="@android:color/holo_green_light" />
<item android:state_focused="false" android:state_pressed="true"
android:drawable="@android:color/holo_green_light" />
<item android:drawable="@android:color/holo_green_dark" />
</selector>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_focused="true" android:state_pressed="true"
android:drawable="@android:color/holo_red_light" />
<item android:state_focused="false" android:state_pressed="true"
android:drawable="@android:color/holo_red_light" />
<item android:drawable="@android:color/holo_red_dark" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

View File

@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
android:keepScreenOn="true"
tools:context="de.fhws.indoor.sensorreadout.MainActivity">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:orientation="vertical"
tools:context=".MainActivity"
android:background="#333">
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="stop"
android:id="@+id/btnStop"
android:background="@drawable/btnstopcolor"/>
<Button
android:layout_width="50dp"
android:layout_height="wrap_content"
android:text="start"
android:id="@+id/btnStart"
android:background="@drawable/btnstartcolor"/>
</LinearLayout>
<Spinner
android:layout_width="58dip"
android:layout_height="48dip"
android:id="@+id/pathspinner"
android:layout_marginLeft="66dip"
android:layout_marginTop="16dip"
android:background="#64bbe5"
/>
<Spinner
android:layout_width="58dip"
android:layout_height="48dip"
android:id="@+id/groundspinner"
android:layout_marginLeft="66dip"
android:layout_marginTop="64dip"
android:background="#64bbe5"
android:layout_alignBottom="@+id/btnGround" />
<Button
android:layout_width="fill_parent"
android:layout_height="96dip"
android:text="Ground Truth"
android:id="@+id/btnGround"
android:layout_gravity="right"
android:layout_marginLeft="125dip"
android:layout_marginTop="16dip"
android:layout_marginRight="16dip"
android:background="#64bbe5"
/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#222"
android:layout_marginTop="126dip"
android:orientation="horizontal"
android:id="@+id/layoutMain">
</LinearLayout>
</RelativeLayout>

View File

@@ -0,0 +1,9 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
tools:context=".MainActivity">
<item android:id="@+id/action_settings"
android:title="@string/action_settings"
android:orderInCategory="100"
app:showAsAction="never"/>
</menu>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

BIN
app/src/main/res/raw/go.wav Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
<resources>
<!-- Example customization of dimensions originally defined in res/values/dimens.xml
(such as screen margins) for screens with more than 820dp of available width. This
would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). -->
<dimen name="activity_horizontal_margin">64dp</dimen>
</resources>

View File

@@ -0,0 +1,5 @@
<resources>
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="activity_horizontal_margin">16dp</dimen>
<dimen name="activity_vertical_margin">16dp</dimen>
</resources>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Sensor Readout</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
</resources>

View File

@@ -0,0 +1,8 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>

View File

@@ -0,0 +1,15 @@
package de.fhws.indoor.sensorreadout;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* To work on unit tests, switch the Test Artifact in the Build Variants view.
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() throws Exception {
assertEquals(4, 2 + 2);
}
}

23
build.gradle Normal file
View File

@@ -0,0 +1,23 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
jcenter()
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

18
gradle.properties Normal file
View File

@@ -0,0 +1,18 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx10248m -XX:MaxPermSize=256m
# org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#Wed Oct 21 11:34:03 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip

160
gradlew vendored Executable file
View File

@@ -0,0 +1,160 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored Normal file
View File

@@ -0,0 +1,90 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

1
settings.gradle Normal file
View File

@@ -0,0 +1 @@
include ':app'