Alteração
This commit is contained in:
parent
425444a196
commit
48e7fe5d04
BIN
DroneAppController.rar
Normal file
BIN
DroneAppController.rar
Normal file
Binary file not shown.
2
DroneAppController/.idea/.name
generated
2
DroneAppController/.idea/.name
generated
@ -1 +1 @@
|
|||||||
Drone App Controller
|
DroneAppController
|
||||||
6
DroneAppController/.idea/gradle.xml
generated
6
DroneAppController/.idea/gradle.xml
generated
@ -5,11 +5,11 @@
|
|||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="distributionType" value="LOCAL" />
|
<option name="distributionType" value="LOCAL" />
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleHome" value="$APPLICATION_HOME_DIR$/gradle/gradle-2.2.1" />
|
<option name="gradleHome" value="C:\Program Files\Android\Android Studio\gradle\gradle-2.2.1" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="/media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="/media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
|
|||||||
31
DroneAppController/.idea/misc.xml
generated
31
DroneAppController/.idea/misc.xml
generated
@ -3,39 +3,8 @@
|
|||||||
<component name="EntryPointsManager">
|
<component name="EntryPointsManager">
|
||||||
<entry_points version="2.0" />
|
<entry_points version="2.0" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
|
||||||
<entry key="Project Default">
|
|
||||||
<profile-state>
|
|
||||||
<expanded-state>
|
|
||||||
<State>
|
|
||||||
<id />
|
|
||||||
</State>
|
|
||||||
</expanded-state>
|
|
||||||
<selected-state>
|
|
||||||
<State>
|
|
||||||
<id>Abstraction issues</id>
|
|
||||||
</State>
|
|
||||||
</selected-state>
|
|
||||||
</profile-state>
|
|
||||||
</entry>
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||||
</component>
|
</component>
|
||||||
<component name="masterDetails">
|
|
||||||
<states>
|
|
||||||
<state key="ScopeChooserConfigurable.UI">
|
|
||||||
<settings>
|
|
||||||
<splitter-proportions>
|
|
||||||
<option name="proportions">
|
|
||||||
<list>
|
|
||||||
<option value="0.2" />
|
|
||||||
</list>
|
|
||||||
</option>
|
|
||||||
</splitter-proportions>
|
|
||||||
</settings>
|
|
||||||
</state>
|
|
||||||
</states>
|
|
||||||
</component>
|
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
3
DroneAppController/.idea/modules.xml
generated
3
DroneAppController/.idea/modules.xml
generated
@ -2,7 +2,8 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectModuleManager">
|
<component name="ProjectModuleManager">
|
||||||
<modules>
|
<modules>
|
||||||
<module fileurl="file:///media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController/app/app.iml" filepath="/media/almeida/Windows 7/Users/Almeida/Documents/android/DroneAppController/app/app.iml" />
|
<module fileurl="file://$PROJECT_DIR$/DroneAppController.iml" filepath="$PROJECT_DIR$/DroneAppController.iml" />
|
||||||
|
<module fileurl="file://$PROJECT_DIR$/app/app.iml" filepath="$PROJECT_DIR$/app/app.iml" />
|
||||||
</modules>
|
</modules>
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
21
DroneAppController/DroneAppController.iml
Normal file
21
DroneAppController/DroneAppController.iml
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||||
|
<component name="FacetManager">
|
||||||
|
<facet type="java-gradle" name="Java-Gradle">
|
||||||
|
<configuration>
|
||||||
|
<option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
||||||
|
</configuration>
|
||||||
|
</facet>
|
||||||
|
</component>
|
||||||
|
<component name="NewModuleRootManager" inherit-compiler-output="false">
|
||||||
|
<output url="file://$MODULE_DIR$/build/classes/main" />
|
||||||
|
<output-test url="file://$MODULE_DIR$/build/classes/test" />
|
||||||
|
<exclude-output />
|
||||||
|
<content url="file://$MODULE_DIR$">
|
||||||
|
<excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
||||||
|
</content>
|
||||||
|
<orderEntry type="inheritedJdk" />
|
||||||
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
|
</component>
|
||||||
|
</module>
|
||||||
|
|
||||||
@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$USER_HOME$/Documentos/android/DroneAppController" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
<module external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="android-gradle" name="Android-Gradle">
|
<facet type="android-gradle" name="Android-Gradle">
|
||||||
<configuration>
|
<configuration>
|
||||||
@ -84,9 +84,9 @@
|
|||||||
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
<orderEntry type="jdk" jdkName="Android API 21 Platform" jdkType="Android SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="appcompat-v7-21.0.3" level="project" />
|
||||||
<orderEntry type="library" exported="" name="asmack-2010.05.07" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
|
||||||
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
<orderEntry type="library" exported="" name="support-v4-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="support-annotations-21.0.3" level="project" />
|
||||||
|
<orderEntry type="library" exported="" name="asmack-2010.05.07" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
|||||||
@ -3,10 +3,9 @@ apply plugin: 'com.android.application'
|
|||||||
android {
|
android {
|
||||||
compileSdkVersion 21
|
compileSdkVersion 21
|
||||||
buildToolsVersion "21.1.2"
|
buildToolsVersion "21.1.2"
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "pt.isep.mei.simov.droneappcontroller"
|
applicationId "pt.isep.mei.simov.droneappcontroller"
|
||||||
minSdkVersion 15
|
minSdkVersion 16
|
||||||
targetSdkVersion 21
|
targetSdkVersion 21
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
@ -17,9 +16,11 @@ android {
|
|||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
productFlavors {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
compile 'com.android.support:appcompat-v7:21.0.3'
|
compile 'com.android.support:appcompat-v7:21.0.3'
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,6 +35,10 @@
|
|||||||
android:name=".ListOfDrones"
|
android:name=".ListOfDrones"
|
||||||
android:label="@string/title_activity_list_of_drones" >
|
android:label="@string/title_activity_list_of_drones" >
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".ExpertMode"
|
||||||
|
android:label="Expert Mode">
|
||||||
|
</activity>
|
||||||
</application>
|
</application>
|
||||||
|
|
||||||
</manifest>
|
</manifest>
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package pt.isep.mei.simov.droneappcontroller;
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
import android.view.Menu;
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
package pt.isep.mei.simov.droneappcontroller;
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.AccountManager;
|
import org.jivesoftware.smack.AccountManager;
|
||||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
import org.jivesoftware.smack.ConnectionConfiguration;
|
||||||
@ -10,11 +9,7 @@ import org.jivesoftware.smack.RosterEntry;
|
|||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
import org.jivesoftware.smack.XMPPException;
|
import org.jivesoftware.smack.XMPPException;
|
||||||
import org.jivesoftware.smack.packet.Presence;
|
import org.jivesoftware.smack.packet.Presence;
|
||||||
import java.lang.InterruptedException;
|
|
||||||
import java.lang.Runnable;
|
|
||||||
import java.lang.String;
|
|
||||||
import java.lang.System;
|
|
||||||
import java.lang.Thread;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
|
|||||||
@ -138,7 +138,7 @@ public class ControllerActivity extends Activity {
|
|||||||
public void onClick(DialogInterface dialog,int id) {
|
public void onClick(DialogInterface dialog,int id) {
|
||||||
// if this button is clicked, close
|
// if this button is clicked, close
|
||||||
// current activity
|
// current activity
|
||||||
Intent i = new Intent(getApplicationContext(), CalibrationActivity.class);
|
Intent i = new Intent(getApplicationContext(), ExpertMode.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@ -0,0 +1,85 @@
|
|||||||
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.hardware.Sensor;
|
||||||
|
import android.hardware.SensorEvent;
|
||||||
|
import android.hardware.SensorEventListener;
|
||||||
|
import android.hardware.SensorManager;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.jivesoftware.smack.packet.Message;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by João on 30-12-2014.
|
||||||
|
*/
|
||||||
|
public class ExpertMode extends Activity implements SensorEventListener {
|
||||||
|
|
||||||
|
|
||||||
|
private SensorManager sensorManager;
|
||||||
|
|
||||||
|
TextView x_tilt;
|
||||||
|
TextView y_tilt;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_expert_mode);
|
||||||
|
|
||||||
|
x_tilt=(TextView)findViewById(R.id.x_tilt);
|
||||||
|
y_tilt=(TextView)findViewById(R.id.y_tilt);
|
||||||
|
|
||||||
|
sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
|
||||||
|
|
||||||
|
// add listener. The listener will be HelloAndroid (this) class
|
||||||
|
sensorManager.registerListener(this,
|
||||||
|
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
|
||||||
|
SensorManager.SENSOR_DELAY_GAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSensorChanged(SensorEvent event) {
|
||||||
|
|
||||||
|
if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){
|
||||||
|
|
||||||
|
// assign directions
|
||||||
|
float x=event.values[0];
|
||||||
|
float y=event.values[1];
|
||||||
|
|
||||||
|
|
||||||
|
if(x > 1){
|
||||||
|
x_tilt.setText("Trás");
|
||||||
|
} else if(x < -1) {
|
||||||
|
x_tilt.setText("Frente");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(y > 1){
|
||||||
|
y_tilt.setText("Direita");
|
||||||
|
}else if(y < -1){
|
||||||
|
y_tilt.setText("Esquerda");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void senMessage(String message) {
|
||||||
|
Message msg = new Message(to, Message.Type.chat);
|
||||||
|
|
||||||
|
msg.setBody(message);
|
||||||
|
if (connection != null) {
|
||||||
|
connection.sendPacket(msg);
|
||||||
|
messages.add(connection.getUser() + ":");
|
||||||
|
messages.add(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -3,8 +3,6 @@ package pt.isep.mei.simov.droneappcontroller;
|
|||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
|
|||||||
@ -1,13 +1,11 @@
|
|||||||
package pt.isep.mei.simov.droneappcontroller;
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.ConnectivityManager;
|
import android.net.ConnectivityManager;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|||||||
@ -1,17 +1,12 @@
|
|||||||
package pt.isep.mei.simov.droneappcontroller;
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.support.v7.app.ActionBarActivity;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.Menu;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.jivesoftware.smack.ConnectionConfiguration;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by almeida on 18-12-2014.
|
* Created by almeida on 18-12-2014.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -0,0 +1,26 @@
|
|||||||
|
<?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">
|
||||||
|
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@+id/x_tilt"
|
||||||
|
android:id="@+id/x_tilt"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@+id/y_tilt"
|
||||||
|
android:id="@+id/y_tilt"
|
||||||
|
android:layout_below="@+id/x_tilt"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true" />
|
||||||
|
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
android:layout_height="match_parent"
|
||||||
|
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||||
android:paddingTop="@dimen/activity_vertical_margin"
|
android:paddingTop="@dimen/activity_vertical_margin"
|
||||||
android:background="@drawable/back"
|
android:background="@drawable/back"
|
||||||
|
|||||||
@ -8,5 +8,7 @@
|
|||||||
<string name="title_activity_main">Controlo</string>
|
<string name="title_activity_main">Controlo</string>
|
||||||
<string name="title_activity_calibration">Calibração</string>
|
<string name="title_activity_calibration">Calibração</string>
|
||||||
<string name="title_activity_list_of_drones">Lista de drones</string>
|
<string name="title_activity_list_of_drones">Lista de drones</string>
|
||||||
|
<string name="x_tilt">X Tilt: </string>
|
||||||
|
<string name="y_tilt">Y Tilt: </string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@ -8,5 +8,7 @@
|
|||||||
<string name="title_activity_main">Controlo</string>
|
<string name="title_activity_main">Controlo</string>
|
||||||
<string name="title_activity_calibration">Calibration Activity</string>
|
<string name="title_activity_calibration">Calibration Activity</string>
|
||||||
<string name="title_activity_list_of_drones">List Of Drones</string>
|
<string name="title_activity_list_of_drones">List Of Drones</string>
|
||||||
|
<string name="x_tilt">X Tilt: </string>
|
||||||
|
<string name="y_tilt">Y Tilt: </string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user