Compare commits

..

8 Commits

Author SHA1 Message Date
55ffe42de1 Update README.md 2019-05-09 08:19:56 -07:00
5757be23dd Update README.md 2019-05-07 03:26:13 -07:00
e6ac8d3a59 Update LICENSE 2019-05-07 03:24:43 -07:00
7bf1ab9e73 Update README.md 2019-05-07 03:24:01 -07:00
8bd38d2b6d Add new file 2019-05-07 03:22:29 -07:00
7c5439eb92 Add CONTRIBUTING 2019-05-07 03:22:03 -07:00
286b2a6fc9 Add CHANGELOG 2019-05-07 03:21:46 -07:00
3d88987730 Add README.md 2019-05-07 03:19:08 -07:00
26 changed files with 412 additions and 333 deletions

6
CHANGELOG Normal file
View 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
View 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/

Binary file not shown.

View File

@ -1,5 +1,5 @@
<?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">
<facet type="android-gradle" name="Android-Gradle">
<configuration>

View File

@ -25,9 +25,12 @@
</activity>
<activity
android:name=".ControllerActivity"
android:screenOrientation="landscape"
android:label="@string/title_activity_main" >
</activity>
<activity
android:name=".CalibrationActivity"
android:label="@string/title_activity_calibration" >
</activity>
<activity
android:name=".ListOfDrones"
android:label="@string/title_activity_list_of_drones" >

View File

@ -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);
}
}

View File

@ -1,6 +1,7 @@
package pt.isep.mei.simov.droneappcontroller;
import android.util.Log;
import android.widget.Toast;
import org.jivesoftware.smack.AccountManager;
import org.jivesoftware.smack.ConnectionConfiguration;
@ -9,7 +10,11 @@ import org.jivesoftware.smack.RosterEntry;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
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.Collection;
import java.util.concurrent.CountDownLatch;
@ -21,11 +26,6 @@ public class Connection {
String HOST = "aalmeid.ddns.net";
int PORT = 5222;
String SERVICE = "xmppserver";
/*String HOST = "sibacsimovisep2014.noip.me";
int PORT = 5222;
String SERVICE = "sibacsimovisep2014";*/
String USERNAME = "";
String PASSWORD = "";
@ -104,11 +104,6 @@ public class Connection {
}
}
private boolean closeConnection(){
connection.disconnect();
return true;
}
public boolean createAccount (String username, String password){
try {
AccountManager accountManager = connection.getAccountManager();

View File

@ -2,22 +2,15 @@ package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.MotionEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
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.util.StringUtils;
import java.util.ArrayList;
/**
* Created by almeida on 18-12-2014.
*/
public class ControllerActivity extends Activity implements SensorEventListener {
private SensorManager sensorManager;
public class ControllerActivity extends Activity {
private String to;
private XMPPConnection connection = Connection.getConnection();
private int speed;
private TextView tv;
private Switch onOff;
private Switch expertmode;
private ArrayList<String> messages = new ArrayList<String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_controller);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
Button left = (Button) findViewById(R.id.buttonLeft);
Button right = (Button) findViewById(R.id.buttonRight);
Button up = (Button) findViewById(R.id.buttonUp);
Button down = (Button) findViewById(R.id.buttonDown);
Button acelerate = (Button) findViewById(R.id.buttonAcelerate);
Button desacelarate = (Button) findViewById(R.id.buttonBreak);
sensorManager=(SensorManager)getSystemService(SENSOR_SERVICE);
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();
}
}
});
Button breake = (Button) findViewById(R.id.buttonBreak);
Button on_off = (Button) findViewById(R.id.buttonOnOff);
Button calibration = (Button) findViewById(R.id.buttonCallibration);
Bundle b = getIntent().getExtras();
to = b.getString("to");
@ -99,136 +55,128 @@ public class ControllerActivity extends Activity implements SensorEventListener
left.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(onOff.isChecked()) {
senMessage("e");
}else{
Toast.makeText(getApplicationContext(), R.string.turnOn,
Toast.makeText(getApplicationContext(), "left pressed!",
Toast.LENGTH_LONG).show();
}
senMessage("left");
}
});
right.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onOff.isChecked()) {
senMessage("d");
} else {
Toast.makeText(getApplicationContext(), R.string.turnOn,
Toast.makeText(getApplicationContext(), "right pressed!",
Toast.LENGTH_LONG).show();
}
}
});
/*acelerate.setOnClickListener(new View.OnClickListener() {
@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;
senMessage("rigth");
}
});
up.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onOff.isChecked()) {
senMessage("up");
} else {
Toast.makeText(getApplicationContext(), R.string.turnOn,
Toast.makeText(getApplicationContext(), "up pressed!",
Toast.LENGTH_LONG).show();
}
senMessage("up");
}
});
down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (onOff.isChecked()) {
senMessage("down");
} else {
Toast.makeText(getApplicationContext(), R.string.turnOn,
Toast.makeText(getApplicationContext(), "down pressed!",
Toast.LENGTH_LONG).show();
senMessage("down");
}
});
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) {
Message msg = new Message(to, Message.Type.chat);
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo networkInfo = connMgr.getActiveNetworkInfo();
msg.setBody(message);
if (connection != null) {
if (!(networkInfo != null && networkInfo.isConnected())) {
Toast.makeText(getApplicationContext(), R.string.droneConnection, Toast.LENGTH_SHORT).show();
finish();
}else{
connection.sendPacket(msg);
}
messages.add(connection.getUser() + ":");
messages.add(message);
}
}
public void setConnection(XMPPConnection connection) {
this.connection = connection;
System.out.println ("connection"+connection);
if (connection != null) {
// Add a packet listener to get messages sent to us
PacketFilter filter = new MessageTypeFilter(Message.Type.chat);
connection.addPacketListener(new PacketListener() {
@Override
@ -237,41 +185,34 @@ public class ControllerActivity extends Activity implements SensorEventListener
if (message.getBody() != null) {
String fromName = StringUtils.parseBareAddress(message.getFrom());
Log.i("XMPPChatDemoActivity ", " Text Recieved " + message.getBody() + " from " + fromName);
messages.add(fromName + ":");
messages.add(message.getBody());
}
}
}, filter);
}
}
@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 (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");
}
}
}
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@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);
}
}

View File

@ -1,17 +1,14 @@
package pt.isep.mei.simov.droneappcontroller;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.Toast;
import org.jivesoftware.smack.XMPPConnection;
@ -39,7 +36,6 @@ public class ListOfDrones extends Activity {
String user = b.getString("id");
String passwd = b.getString("passwd");
try {
Connection c = new Connection(user,passwd);
users = c.getUsers();
connection = c.getConnection();
@ -57,25 +53,11 @@ public class ListOfDrones extends Activity {
@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();
}
}
}

View File

@ -1,11 +1,13 @@
package pt.isep.mei.simov.droneappcontroller;
import android.os.Bundle;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.EditText;
@ -35,7 +37,7 @@ public class LoginActivity extends Activity {
Log.i("XMPP", "Credencials: " + email + " and " + passwd);
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();
} else {
ConnectivityManager connMgr = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
@ -43,8 +45,9 @@ public class LoginActivity extends Activity {
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{
Intent i=new Intent(this,ListOfDrones.class);
i.putExtra("id", email);
i.putExtra("passwd", passwd);
@ -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);
startActivity(i);
}*/
}
}

View File

@ -1,12 +1,17 @@
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;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import org.jivesoftware.smack.ConnectionConfiguration;
/**
* Created by almeida on 18-12-2014.
*/
@ -25,7 +30,7 @@ public class RegisterActivity extends Activity {
buttonReg.setOnClickListener(new View.OnClickListener() {
@Override
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())){
Toast.makeText(getApplicationContext(), "Registration completed!",
Toast.LENGTH_LONG).show();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -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>

View File

@ -9,7 +9,23 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="&lt;"
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:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
@ -18,7 +34,7 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=""
android:text="Acelerate"
android:id="@+id/buttonAcelerate"
android:layout_above="@+id/buttonBreak"
android:layout_toRightOf="@+id/buttonLeft"
@ -27,7 +43,7 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="V"
android:text="Break"
android:id="@+id/buttonBreak"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/buttonLeft"
@ -38,7 +54,7 @@
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text=">"
android:text="Right"
android:id="@+id/buttonRight"
android:layout_alignParentBottom="true"
android:layout_toRightOf="@+id/buttonBreak"
@ -62,34 +78,4 @@
android:layout_alignParentRight="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>

View File

@ -2,7 +2,6 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:background="@drawable/back"
android:layout_height="fill_parent">
<ListView android:layout_width="fill_parent"

View File

@ -1,8 +1,7 @@
<?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"
android:paddingLeft="@dimen/activity_horizontal_margin"
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:background="@drawable/back"
@ -41,7 +40,7 @@
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="Drone ID"
android:text="JabberID"
android:textColor="#372c24" />
<EditText
@ -82,7 +81,7 @@
android:layout_marginTop="34dp"
android:onClick="postData"
android:text="Login" />
<!--
<Button
android:id="@+id/btnRegister"
android:layout_width="fill_parent"
@ -92,5 +91,4 @@
android:layout_below="@+id/btnLogin"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
-->
</RelativeLayout>

View File

@ -1,44 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rowTextView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textColor="#336633"
android:padding="10dp"
android:textSize="20sp" >
</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> -->

View File

@ -1,7 +1,7 @@
<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="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"
android:orderInCategory="100" app:showAsAction="never" />
</menu>

View File

@ -8,15 +8,5 @@
<string name="title_activity_main">Controlo</string>
<string name="title_activity_calibration">Calibração</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>

View File

@ -5,17 +5,8 @@
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</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="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>

21
LICENSE.md Normal file
View 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
View File

@ -0,0 +1,48 @@
# Drone controller app android
![Version](https://img.shields.io/badge/version-0.0.1-success.svg)
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
[![Watch the video](https://i.imgur.com/vKb2F1B.png)](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
[![Author](https://img.shields.io/badge/Author-André%20Almeida-blue.svg)](https://andrealmeida.net)
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details