Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 55ffe42de1 | |||
| 5757be23dd | |||
| e6ac8d3a59 | |||
| 7bf1ab9e73 | |||
| 8bd38d2b6d | |||
| 7c5439eb92 | |||
| 286b2a6fc9 | |||
| 3d88987730 |
6
CHANGELOG
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
# Changelog
|
||||||
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
|
## [0.0.1] - 2019-05-07
|
||||||
|
### Added
|
||||||
|
- migration from github to gitlab
|
||||||
92
CONTRIBUTING.md
Normal file
@ -0,0 +1,92 @@
|
|||||||
|
# Contributing
|
||||||
|
|
||||||
|
When contributing to this repository, please first discuss the change you wish to make via issue,
|
||||||
|
email, or any other method with the owners of this repository before making a change.
|
||||||
|
|
||||||
|
Please note we have a code of conduct, please follow it in all your interactions with the project.
|
||||||
|
|
||||||
|
## Pull Request Process
|
||||||
|
|
||||||
|
1. Ensure any install or build dependencies are removed before the end of the layer when doing a
|
||||||
|
build.
|
||||||
|
2. Update the README.md with details of changes to the interface, this includes new environment
|
||||||
|
variables, exposed ports, useful file locations and container parameters.
|
||||||
|
3. Increase the version numbers in any examples files and the README.md to the new version that this
|
||||||
|
Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
|
||||||
|
4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
|
||||||
|
do not have permission to do that, you may request the second reviewer to merge it for you.
|
||||||
|
|
||||||
|
## Code of Conduct
|
||||||
|
|
||||||
|
### Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as
|
||||||
|
contributors and maintainers pledge to making participation in our project and
|
||||||
|
our community a harassment-free experience for everyone, regardless of age, body
|
||||||
|
size, disability, ethnicity, gender identity and expression, level of experience,
|
||||||
|
nationality, personal appearance, race, religion, or sexual identity and
|
||||||
|
orientation.
|
||||||
|
|
||||||
|
### Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment
|
||||||
|
include:
|
||||||
|
|
||||||
|
* Using welcoming and inclusive language
|
||||||
|
* Being respectful of differing viewpoints and experiences
|
||||||
|
* Gracefully accepting constructive criticism
|
||||||
|
* Focusing on what is best for the community
|
||||||
|
* Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
* The use of sexualized language or imagery and unwelcome sexual attention or
|
||||||
|
advances
|
||||||
|
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
* Public or private harassment
|
||||||
|
* Publishing others' private information, such as a physical or electronic
|
||||||
|
address, without explicit permission
|
||||||
|
* Other conduct which could reasonably be considered inappropriate in a
|
||||||
|
professional setting
|
||||||
|
|
||||||
|
### Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable
|
||||||
|
behavior and are expected to take appropriate and fair corrective action in
|
||||||
|
response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or
|
||||||
|
reject comments, commits, code, wiki edits, issues, and other contributions
|
||||||
|
that are not aligned to this Code of Conduct, or to ban temporarily or
|
||||||
|
permanently any contributor for other behaviors that they deem inappropriate,
|
||||||
|
threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
### Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces
|
||||||
|
when an individual is representing the project or its community. Examples of
|
||||||
|
representing a project or community include using an official project e-mail
|
||||||
|
address, posting via an official social media account, or acting as an appointed
|
||||||
|
representative at an online or offline event. Representation of a project may be
|
||||||
|
further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
### Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||||
|
reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
|
||||||
|
complaints will be reviewed and investigated and will result in a response that
|
||||||
|
is deemed necessary and appropriate to the circumstances. The project team is
|
||||||
|
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||||
|
Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good
|
||||||
|
faith may face temporary or permanent repercussions as determined by other
|
||||||
|
members of the project's leadership.
|
||||||
|
|
||||||
|
### Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
||||||
|
available at [http://contributor-covenant.org/version/1/4][version]
|
||||||
|
|
||||||
|
[homepage]: http://contributor-covenant.org
|
||||||
|
[version]: http://contributor-covenant.org/version/1/4/
|
||||||
@ -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$/Documents/android/DroneAppController" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
<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">
|
||||||
<component name="FacetManager">
|
<component name="FacetManager">
|
||||||
<facet type="android-gradle" name="Android-Gradle">
|
<facet type="android-gradle" name="Android-Gradle">
|
||||||
<configuration>
|
<configuration>
|
||||||
|
|||||||
@ -25,9 +25,12 @@
|
|||||||
</activity>
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ControllerActivity"
|
android:name=".ControllerActivity"
|
||||||
android:screenOrientation="landscape"
|
|
||||||
android:label="@string/title_activity_main" >
|
android:label="@string/title_activity_main" >
|
||||||
</activity>
|
</activity>
|
||||||
|
<activity
|
||||||
|
android:name=".CalibrationActivity"
|
||||||
|
android:label="@string/title_activity_calibration" >
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".ListOfDrones"
|
android:name=".ListOfDrones"
|
||||||
android:label="@string/title_activity_list_of_drones" >
|
android:label="@string/title_activity_list_of_drones" >
|
||||||
|
|||||||
@ -0,0 +1,43 @@
|
|||||||
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
|
import android.support.v7.app.ActionBarActivity;
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.view.Menu;
|
||||||
|
import android.view.MenuItem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by almeida on 23-12-2014.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class CalibrationActivity extends Activity {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
setContentView(R.layout.activity_calibration);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
|
getMenuInflater().inflate(R.menu.menu_calibration, menu);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
//noinspection SimplifiableIfStatement
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,6 +1,7 @@
|
|||||||
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;
|
||||||
@ -9,7 +10,11 @@ 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;
|
||||||
@ -21,11 +26,6 @@ public class Connection {
|
|||||||
String HOST = "aalmeid.ddns.net";
|
String HOST = "aalmeid.ddns.net";
|
||||||
int PORT = 5222;
|
int PORT = 5222;
|
||||||
String SERVICE = "xmppserver";
|
String SERVICE = "xmppserver";
|
||||||
|
|
||||||
/*String HOST = "sibacsimovisep2014.noip.me";
|
|
||||||
int PORT = 5222;
|
|
||||||
String SERVICE = "sibacsimovisep2014";*/
|
|
||||||
|
|
||||||
String USERNAME = "";
|
String USERNAME = "";
|
||||||
String PASSWORD = "";
|
String PASSWORD = "";
|
||||||
|
|
||||||
@ -104,11 +104,6 @@ public class Connection {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean closeConnection(){
|
|
||||||
connection.disconnect();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean createAccount (String username, String password){
|
public boolean createAccount (String username, String password){
|
||||||
try {
|
try {
|
||||||
AccountManager accountManager = connection.getAccountManager();
|
AccountManager accountManager = connection.getAccountManager();
|
||||||
|
|||||||
@ -2,22 +2,15 @@ package pt.isep.mei.simov.droneappcontroller;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.hardware.Sensor;
|
import android.content.Intent;
|
||||||
import android.hardware.SensorEvent;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
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.CompoundButton;
|
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.jivesoftware.smack.PacketListener;
|
import org.jivesoftware.smack.PacketListener;
|
||||||
@ -28,68 +21,31 @@ import org.jivesoftware.smack.packet.Message;
|
|||||||
import org.jivesoftware.smack.packet.Packet;
|
import org.jivesoftware.smack.packet.Packet;
|
||||||
import org.jivesoftware.smack.util.StringUtils;
|
import org.jivesoftware.smack.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by almeida on 18-12-2014.
|
* Created by almeida on 18-12-2014.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class ControllerActivity extends Activity implements SensorEventListener {
|
public class ControllerActivity extends Activity {
|
||||||
private SensorManager sensorManager;
|
|
||||||
private String to;
|
private String to;
|
||||||
private XMPPConnection connection = Connection.getConnection();
|
private XMPPConnection connection = Connection.getConnection();
|
||||||
private int speed;
|
private ArrayList<String> messages = new ArrayList<String>();
|
||||||
private TextView tv;
|
|
||||||
private Switch onOff;
|
|
||||||
private Switch expertmode;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.activity_controller);
|
setContentView(R.layout.activity_controller);
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
|
||||||
Button left = (Button) findViewById(R.id.buttonLeft);
|
Button left = (Button) findViewById(R.id.buttonLeft);
|
||||||
Button right = (Button) findViewById(R.id.buttonRight);
|
Button right = (Button) findViewById(R.id.buttonRight);
|
||||||
Button up = (Button) findViewById(R.id.buttonUp);
|
Button up = (Button) findViewById(R.id.buttonUp);
|
||||||
Button down = (Button) findViewById(R.id.buttonDown);
|
Button down = (Button) findViewById(R.id.buttonDown);
|
||||||
Button acelerate = (Button) findViewById(R.id.buttonAcelerate);
|
Button acelerate = (Button) findViewById(R.id.buttonAcelerate);
|
||||||
Button desacelarate = (Button) findViewById(R.id.buttonBreak);
|
Button breake = (Button) findViewById(R.id.buttonBreak);
|
||||||
|
Button on_off = (Button) findViewById(R.id.buttonOnOff);
|
||||||
sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
|
Button calibration = (Button) findViewById(R.id.buttonCallibration);
|
||||||
|
|
||||||
sensorManager.registerListener(this,
|
|
||||||
sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
|
|
||||||
SensorManager.SENSOR_DELAY_GAME);
|
|
||||||
|
|
||||||
tv = (TextView) findViewById(R.id.tv);
|
|
||||||
|
|
||||||
onOff = (Switch) findViewById(R.id.onOff);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
onOff.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
|
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
|
||||||
if (isChecked) {
|
|
||||||
senMessage("v-"+100);
|
|
||||||
senMessage("v-"+30);
|
|
||||||
speed = 30;
|
|
||||||
} else {
|
|
||||||
senMessage("v-" + 0);
|
|
||||||
speed = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
expertmode = (Switch) findViewById(R.id.expertmode);
|
|
||||||
|
|
||||||
expertmode.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (!onOff.isChecked()) {
|
|
||||||
expertmode.setChecked(false);
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Bundle b = getIntent().getExtras();
|
Bundle b = getIntent().getExtras();
|
||||||
to = b.getString("to");
|
to = b.getString("to");
|
||||||
@ -99,136 +55,128 @@ public class ControllerActivity extends Activity implements SensorEventListener
|
|||||||
left.setOnClickListener(new View.OnClickListener() {
|
left.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if(onOff.isChecked()) {
|
Toast.makeText(getApplicationContext(), "left pressed!",
|
||||||
senMessage("e");
|
Toast.LENGTH_LONG).show();
|
||||||
}else{
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
senMessage("left");
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
right.setOnClickListener(new View.OnClickListener() {
|
right.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (onOff.isChecked()) {
|
Toast.makeText(getApplicationContext(), "right pressed!",
|
||||||
senMessage("d");
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*acelerate.setOnClickListener(new View.OnClickListener() {
|
senMessage("rigth");
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (onOff.isChecked()) {
|
|
||||||
if (speed < 91) {
|
|
||||||
speed = speed + 10;
|
|
||||||
senMessage("v-" + speed);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
acelerate.setOnTouchListener(new View.OnTouchListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
|
||||||
if (onOff.isChecked()) {
|
|
||||||
if (speed < 100) {
|
|
||||||
speed = speed + 1;
|
|
||||||
senMessage("v-" + speed);
|
|
||||||
tv.setText(speed+"/100");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
/*desacelarate.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if(onOff.isChecked()) {
|
|
||||||
if(speed > 9) {
|
|
||||||
speed = speed - 10;
|
|
||||||
senMessage("v-" + speed);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});*/
|
|
||||||
|
|
||||||
desacelarate.setOnTouchListener(new View.OnTouchListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
|
||||||
if (onOff.isChecked()) {
|
|
||||||
if (speed > 0) {
|
|
||||||
speed = speed - 1;
|
|
||||||
senMessage("v-" + speed);
|
|
||||||
tv.setText(speed+"/100");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
up.setOnClickListener(new View.OnClickListener() {
|
up.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (onOff.isChecked()) {
|
Toast.makeText(getApplicationContext(), "up pressed!",
|
||||||
senMessage("up");
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
senMessage("up");
|
||||||
Toast.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
down.setOnClickListener(new View.OnClickListener() {
|
down.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (onOff.isChecked()) {
|
Toast.makeText(getApplicationContext(), "down pressed!",
|
||||||
senMessage("down");
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.turnOn,
|
senMessage("down");
|
||||||
Toast.LENGTH_LONG).show();
|
}
|
||||||
}
|
});
|
||||||
|
|
||||||
|
acelerate.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(getApplicationContext(), "acelerate pressed!",
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
senMessage("acelerate");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
breake.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(getApplicationContext(), "break pressed!",
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
senMessage("break");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
on_off.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
Toast.makeText(getApplicationContext(), "on_off pressed!",
|
||||||
|
Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
|
senMessage("On/Off");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
calibration.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(v.getContext());
|
||||||
|
|
||||||
|
// set title
|
||||||
|
alertDialogBuilder.setTitle("Expert Mode");
|
||||||
|
|
||||||
|
// set dialog message
|
||||||
|
alertDialogBuilder
|
||||||
|
.setMessage("Atention: Expert Mode")
|
||||||
|
.setCancelable(false)
|
||||||
|
.setPositiveButton("Yes",new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog,int id) {
|
||||||
|
// if this button is clicked, close
|
||||||
|
// current activity
|
||||||
|
Intent i = new Intent(getApplicationContext(), CalibrationActivity.class);
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setNegativeButton("No",new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog,int id) {
|
||||||
|
// if this button is clicked, just close
|
||||||
|
// the dialog box and do nothing
|
||||||
|
dialog.cancel();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// create alert dialog
|
||||||
|
AlertDialog alertDialog = alertDialogBuilder.create();
|
||||||
|
|
||||||
|
// show it
|
||||||
|
alertDialog.show();
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public void senMessage(String message) {
|
public void senMessage(String message) {
|
||||||
Message msg = new Message(to, Message.Type.chat);
|
Message msg = new Message(to, Message.Type.chat);
|
||||||
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
|
|
||||||
|
|
||||||
msg.setBody(message);
|
msg.setBody(message);
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
if (!(networkInfo != null && networkInfo.isConnected())) {
|
connection.sendPacket(msg);
|
||||||
Toast.makeText(getApplicationContext(), R.string.droneConnection, Toast.LENGTH_SHORT).show();
|
messages.add(connection.getUser() + ":");
|
||||||
finish();
|
messages.add(message);
|
||||||
}else{
|
|
||||||
connection.sendPacket(msg);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setConnection(XMPPConnection connection) {
|
public void setConnection(XMPPConnection connection) {
|
||||||
this.connection = connection;
|
this.connection = connection;
|
||||||
|
|
||||||
|
System.out.println ("connection"+connection);
|
||||||
if (connection != null) {
|
if (connection != null) {
|
||||||
|
// Add a packet listener to get messages sent to us
|
||||||
PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
|
PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
|
||||||
connection.addPacketListener(new PacketListener() {
|
connection.addPacketListener(new PacketListener() {
|
||||||
@Override
|
@Override
|
||||||
@ -237,41 +185,34 @@ public class ControllerActivity extends Activity implements SensorEventListener
|
|||||||
if (message.getBody() != null) {
|
if (message.getBody() != null) {
|
||||||
String fromName = StringUtils.parseBareAddress(message.getFrom());
|
String fromName = StringUtils.parseBareAddress(message.getFrom());
|
||||||
Log.i("XMPPChatDemoActivity ", " Text Recieved " + message.getBody() + " from " + fromName);
|
Log.i("XMPPChatDemoActivity ", " Text Recieved " + message.getBody() + " from " + fromName);
|
||||||
|
messages.add(fromName + ":");
|
||||||
|
messages.add(message.getBody());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, filter);
|
}, filter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent event) {
|
public boolean onCreateOptionsMenu(Menu menu) {
|
||||||
|
// Inflate the menu; this adds items to the action bar if it is present.
|
||||||
if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){
|
getMenuInflater().inflate(R.menu.menu_main, menu);
|
||||||
|
return true;
|
||||||
// assign directions
|
|
||||||
float x=event.values[0];
|
|
||||||
float y=event.values[1];
|
|
||||||
|
|
||||||
if (expertmode.isChecked() && onOff.isChecked()) {
|
|
||||||
if(x > 8){
|
|
||||||
if (speed > 0) {
|
|
||||||
speed = speed - 1;
|
|
||||||
senMessage("v-" + speed);
|
|
||||||
tv.setText(speed + "/100");
|
|
||||||
}
|
|
||||||
} else if(x < 2) {
|
|
||||||
if (speed < 100) {
|
|
||||||
speed = speed + 1;
|
|
||||||
senMessage("v-" + speed);
|
|
||||||
tv.setText(speed+"/100");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
public boolean onOptionsItemSelected(MenuItem item) {
|
||||||
|
// Handle action bar item clicks here. The action bar will
|
||||||
|
// automatically handle clicks on the Home/Up button, so long
|
||||||
|
// as you specify a parent activity in AndroidManifest.xml.
|
||||||
|
int id = item.getItemId();
|
||||||
|
|
||||||
|
//noinspection SimplifiableIfStatement
|
||||||
|
if (id == R.id.action_settings) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,14 @@
|
|||||||
package pt.isep.mei.simov.droneappcontroller;
|
package pt.isep.mei.simov.droneappcontroller;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkInfo;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
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;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import org.jivesoftware.smack.XMPPConnection;
|
import org.jivesoftware.smack.XMPPConnection;
|
||||||
|
|
||||||
@ -39,43 +36,28 @@ public class ListOfDrones extends Activity {
|
|||||||
String user = b.getString("id");
|
String user = b.getString("id");
|
||||||
String passwd = b.getString("passwd");
|
String passwd = b.getString("passwd");
|
||||||
|
|
||||||
try {
|
Connection c = new Connection(user,passwd);
|
||||||
Connection c = new Connection(user, passwd);
|
users = c.getUsers();
|
||||||
users = c.getUsers();
|
connection = c.getConnection();
|
||||||
connection = c.getConnection();
|
|
||||||
|
|
||||||
|
|
||||||
listView = (ListView) findViewById(R.id.listOfDrones);
|
listView = (ListView) findViewById( R.id.listOfDrones );
|
||||||
listAdapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.simplerow);
|
listAdapter = new ArrayAdapter<String>(getApplicationContext(), R.layout.simplerow);
|
||||||
listView.setAdapter(listAdapter);
|
listView.setAdapter( listAdapter );
|
||||||
|
|
||||||
for (int i = 0; i < users.size(); i++) {
|
for (int i = 0; i < users.size(); i++){
|
||||||
listAdapter.add(users.get(i).toString());
|
listAdapter.add(users.get(i).toString());
|
||||||
}
|
|
||||||
|
|
||||||
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
||||||
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
|
||||||
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
|
|
||||||
|
|
||||||
if (connection != null) {
|
|
||||||
if (!(networkInfo != null && networkInfo.isConnected())) {
|
|
||||||
Toast.makeText(getApplicationContext(), R.string.internetConnection, Toast.LENGTH_SHORT).show();
|
|
||||||
finish();
|
|
||||||
}else{
|
|
||||||
Intent i = new Intent(getApplicationContext(), ControllerActivity.class);
|
|
||||||
i.putExtra("to", listAdapter.getItem(position));
|
|
||||||
startActivity(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}catch (Exception e){
|
|
||||||
Log.e("Authentication Problem", "Some problem with your account", e);
|
|
||||||
finish();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
Intent i = new Intent(getApplicationContext(), ControllerActivity.class);
|
||||||
|
i.putExtra("to", listAdapter.getItem(position));
|
||||||
|
startActivity(i);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,13 @@
|
|||||||
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;
|
||||||
@ -35,7 +37,7 @@ public class LoginActivity extends Activity {
|
|||||||
Log.i("XMPP", "Credencials: " + email + " and " + passwd);
|
Log.i("XMPP", "Credencials: " + email + " and " + passwd);
|
||||||
|
|
||||||
if (email.equals("") || passwd.equals("")) {
|
if (email.equals("") || passwd.equals("")) {
|
||||||
Toast.makeText(this, R.string.autField,
|
Toast.makeText(this, "Por favor preencha os campos de autenticação",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
} else {
|
} else {
|
||||||
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
@ -43,9 +45,10 @@ public class LoginActivity extends Activity {
|
|||||||
|
|
||||||
if (!(networkInfo != null && networkInfo.isConnected()))
|
if (!(networkInfo != null && networkInfo.isConnected()))
|
||||||
{
|
{
|
||||||
Toast.makeText(getApplicationContext(), R.string.internetConnection, Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "Não existe conexão à internet. Por favor, ligue o acesso à internet", Toast.LENGTH_SHORT).show();
|
||||||
} else{
|
} else{
|
||||||
Intent i = new Intent(this, ListOfDrones.class);
|
|
||||||
|
Intent i=new Intent(this,ListOfDrones.class);
|
||||||
i.putExtra("id", email);
|
i.putExtra("id", email);
|
||||||
i.putExtra("passwd", passwd);
|
i.putExtra("passwd", passwd);
|
||||||
this.startActivity(i);
|
this.startActivity(i);
|
||||||
@ -53,8 +56,8 @@ public class LoginActivity extends Activity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void registerData (View vw) {
|
public void registerData (View vw) {
|
||||||
Intent i = new Intent(this, RegisterActivity.class);
|
Intent i = new Intent(this, RegisterActivity.class);
|
||||||
startActivity(i);
|
startActivity(i);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
@ -1,12 +1,17 @@
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
@ -25,7 +30,7 @@ public class RegisterActivity extends Activity {
|
|||||||
buttonReg.setOnClickListener(new View.OnClickListener() {
|
buttonReg.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Connection c = new Connection("user","passwd");
|
Connection c = new Connection("admin","adminpassword"); //este user não existe, o registo não está a funcionar com esta conta.
|
||||||
if (c.createAccount(username.getText().toString(), passwd.getText().toString())){
|
if (c.createAccount(username.getText().toString(), passwd.getText().toString())){
|
||||||
Toast.makeText(getApplicationContext(), "Registration completed!",
|
Toast.makeText(getApplicationContext(), "Registration completed!",
|
||||||
Toast.LENGTH_LONG).show();
|
Toast.LENGTH_LONG).show();
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 9.2 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 11 KiB |
@ -0,0 +1,12 @@
|
|||||||
|
<RelativeLayout 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"
|
||||||
|
tools:context="simov.dei.isep.pt.droneappcontrol.CallibrationActivity">
|
||||||
|
|
||||||
|
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@ -9,7 +9,23 @@
|
|||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="<"
|
android:text="On / Off"
|
||||||
|
android:id="@+id/buttonOnOff"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_centerHorizontal="true" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Expert Mode"
|
||||||
|
android:id="@+id/buttonCallibration"
|
||||||
|
android:layout_below="@+id/buttonOnOff"
|
||||||
|
android:layout_centerHorizontal="true" />
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Left"
|
||||||
android:id="@+id/buttonLeft"
|
android:id="@+id/buttonLeft"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
@ -18,7 +34,7 @@
|
|||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="∧"
|
android:text="Acelerate"
|
||||||
android:id="@+id/buttonAcelerate"
|
android:id="@+id/buttonAcelerate"
|
||||||
android:layout_above="@+id/buttonBreak"
|
android:layout_above="@+id/buttonBreak"
|
||||||
android:layout_toRightOf="@+id/buttonLeft"
|
android:layout_toRightOf="@+id/buttonLeft"
|
||||||
@ -27,7 +43,7 @@
|
|||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="V"
|
android:text="Break"
|
||||||
android:id="@+id/buttonBreak"
|
android:id="@+id/buttonBreak"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toRightOf="@+id/buttonLeft"
|
android:layout_toRightOf="@+id/buttonLeft"
|
||||||
@ -38,7 +54,7 @@
|
|||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text=">"
|
android:text="Right"
|
||||||
android:id="@+id/buttonRight"
|
android:id="@+id/buttonRight"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:layout_toRightOf="@+id/buttonBreak"
|
android:layout_toRightOf="@+id/buttonBreak"
|
||||||
@ -62,34 +78,4 @@
|
|||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentEnd="true" />
|
android:layout_alignParentEnd="true" />
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceSmall"
|
|
||||||
android:text="30/100"
|
|
||||||
android:id="@+id/tv"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:layout_alignLeft="@+id/buttonAcelerate"
|
|
||||||
android:layout_alignStart="@+id/buttonAcelerate"
|
|
||||||
android:layout_alignRight="@+id/buttonAcelerate"
|
|
||||||
android:layout_alignEnd="@+id/buttonAcelerate" />
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/onOff"
|
|
||||||
android:id="@+id/onOff"
|
|
||||||
android:layout_alignParentTop="true"
|
|
||||||
android:layout_centerHorizontal="true" />
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:text="@string/expert"
|
|
||||||
android:id="@+id/expertmode"
|
|
||||||
android:layout_below="@+id/onOff"
|
|
||||||
android:layout_alignRight="@+id/onOff"
|
|
||||||
android:layout_alignEnd="@+id/onOff"
|
|
||||||
android:layout_marginTop="26dp" />
|
|
||||||
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@ -2,7 +2,6 @@
|
|||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:background="@drawable/back"
|
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
|
|
||||||
<ListView android:layout_width="fill_parent"
|
<ListView android:layout_width="fill_parent"
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
<?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"
|
||||||
android:layout_width="match_parent"
|
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||||
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"
|
||||||
@ -41,7 +40,7 @@
|
|||||||
<TextView
|
<TextView
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Drone ID"
|
android:text="JabberID"
|
||||||
android:textColor="#372c24" />
|
android:textColor="#372c24" />
|
||||||
|
|
||||||
<EditText
|
<EditText
|
||||||
@ -82,7 +81,7 @@
|
|||||||
android:layout_marginTop="34dp"
|
android:layout_marginTop="34dp"
|
||||||
android:onClick="postData"
|
android:onClick="postData"
|
||||||
android:text="Login" />
|
android:text="Login" />
|
||||||
<!--
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/btnRegister"
|
android:id="@+id/btnRegister"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
@ -92,5 +91,4 @@
|
|||||||
android:layout_below="@+id/btnLogin"
|
android:layout_below="@+id/btnLogin"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentStart="true" />
|
android:layout_alignParentStart="true" />
|
||||||
-->
|
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
@ -1,44 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/rowTextView"
|
android:id="@+id/rowTextView"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="#336633"
|
|
||||||
android:padding="10dp"
|
android:padding="10dp"
|
||||||
android:textSize="20sp" >
|
android:textSize="20sp" >
|
||||||
</TextView>
|
</TextView>
|
||||||
|
|
||||||
<!--
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="fill_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:padding="5dip" >
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/thumbnail"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentLeft="true"
|
|
||||||
android:layout_marginRight="5dip"
|
|
||||||
android:padding="3dip" >
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/list_image"
|
|
||||||
android:contentDescription="@string/app_name"
|
|
||||||
android:layout_width="60dip"
|
|
||||||
android:layout_height="60dip"
|
|
||||||
android:src="@drawable/ic_launcher" />
|
|
||||||
</LinearLayout>
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/rowTextView"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="75dip"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:paddingBottom ="10dip"
|
|
||||||
android:textColor="#040404"
|
|
||||||
android:textSize="25dip"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:typeface="sans" />
|
|
||||||
</RelativeLayout> -->
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
tools:context="pt.isep.mei.simov.droneappcontroller.ExpertMode">
|
tools:context="pt.isep.mei.simov.droneappcontroller.CalibrationActivity">
|
||||||
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
<item android:id="@+id/action_settings" android:title="@string/action_settings"
|
||||||
android:orderInCategory="100" app:showAsAction="never" />
|
android:orderInCategory="100" app:showAsAction="never" />
|
||||||
</menu>
|
</menu>
|
||||||
|
|||||||
@ -8,15 +8,5 @@
|
|||||||
<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="expertMode">Atenção: Activar o modo avançado?</string>
|
|
||||||
<string name="expert">Modo avançado</string>
|
|
||||||
<string name="autField">Por favor preencha os campos de autenticação</string>
|
|
||||||
<string name="internetConnection">Não existe conexão à internet. Por favor, ligue o acesso à internet</string>
|
|
||||||
<string name="droneConnection">Não existe conexão ao drone.</string>
|
|
||||||
<string name="autFailed">Início de sessão falhou. Por favor, tente novamente</string>
|
|
||||||
<string name="turnOn">Por favor, ligue o drone</string>
|
|
||||||
<string name="onOff">Ligar/Desligar</string>
|
|
||||||
<string name="yes">Sim</string>
|
|
||||||
<string name="no">Não</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
@ -5,17 +5,8 @@
|
|||||||
<string name="hello_world">Hello world!</string>
|
<string name="hello_world">Hello world!</string>
|
||||||
<string name="action_settings">Settings</string>
|
<string name="action_settings">Settings</string>
|
||||||
<string name="title_activity_register">Register</string>
|
<string name="title_activity_register">Register</string>
|
||||||
<string name="title_activity_main">Control</string>
|
<string name="title_activity_main">Controlo</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="expertMode">Attention: You wanto to enable the Expert Mode?</string>
|
|
||||||
<string name="expert">Expert Mode</string>
|
|
||||||
<string name="autField">Please, use your login credentials</string>
|
|
||||||
<string name="internetConnection">Network problem. Please, turn on your access to the Internet</string>
|
|
||||||
<string name="droneConnection">Drone connection network problem.</string>
|
|
||||||
<string name="autFailed">Autentication failed. Please, try again</string>
|
|
||||||
<string name="turnOn">Please, turn on the drone!</string>
|
|
||||||
<string name="onOff">On/Off</string>
|
|
||||||
<string name="yes">Yes</string>
|
|
||||||
<string name="no">No</string>
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
21
LICENSE.md
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2019, André Almeida dev@andrealmeida.net
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
48
README.md
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
# Drone controller app android
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
Drone contoller via app android and XMPP server.
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
You need have an XMPP Server to communicate the messages for the drone, a Raspberry Pi to construct your middleware (maybe in python) and eletronic skills.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
* [Android Studio](https://developer.android.com/studio/);
|
||||||
|
* [XMPP Server](https://xmpp.org/software/servers.html);
|
||||||
|
* [Python](https://www.python.org);
|
||||||
|
|
||||||
|
### Installing
|
||||||
|
|
||||||
|
Install android studio and XMPP Server.
|
||||||
|
|
||||||
|
After that, compile your app and set the address for your server:
|
||||||
|
|
||||||
|
### Final Result
|
||||||
|
|
||||||
|
[](https://vimeo.com/116756682)
|
||||||
|
|
||||||
|
## Built With
|
||||||
|
|
||||||
|
* [Android Studio](https://developer.android.com/studio/);
|
||||||
|
* [XMPP Server](https://xmpp.org/software/servers.html);
|
||||||
|
* [Python](https://www.python.org);
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
Please read [CONTRIBUTING.md](CONTRIBUTING.md) for details on my code of conduct, and the process for submitting pull requests to me.
|
||||||
|
|
||||||
|
## Versioning
|
||||||
|
|
||||||
|
I use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://gitlab.andrealmeida.net/public_projects/DroneController/tags).
|
||||||
|
|
||||||
|
## Authors
|
||||||
|
|
||||||
|
[](https://andrealmeida.net)
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
|
||||||
|
|
||||||