1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

AndroidGCS: Add copyright header of the other files

This commit is contained in:
James Cotton 2012-08-08 09:22:09 -05:00
parent dc6b3af707
commit 07074ef41e
19 changed files with 832 additions and 335 deletions

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file AttitudeView.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A view for UAV attitude.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.content.Context;
@ -28,7 +51,7 @@ public class AttitudeView extends View {
setFocusable(true);
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
circlePaint.setColor(R.color.background_color);
circlePaint.setColor(getResources().getColor(R.color.background_color));
circlePaint.setStrokeWidth(1);
circlePaint.setStyle(Paint.Style.FILL_AND_STROKE);
Resources r = this.getResources();

View File

@ -1,12 +1,38 @@
/**
******************************************************************************
* @file BluetoothDevicePreference.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A dialog in the preferences options that shows the paired BT
* devices.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.bluetooth.*;
import java.util.Set;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.preference.ListPreference;
import android.util.AttributeSet;
import java.util.Set;
public class BluetoothDevicePreference extends ListPreference {
public BluetoothDevicePreference(Context context, AttributeSet attrs) {

View File

@ -1,3 +1,27 @@
/**
******************************************************************************
* @file BluetoothUAVTalk.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Telemetry over bluetooth.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.io.IOException;

View File

@ -1,3 +1,27 @@
/**
******************************************************************************
* @file CompassView.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A view of the compass heading.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.content.Context;
@ -28,7 +52,7 @@ public class CompassView extends View {
setFocusable(true);
circlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
circlePaint.setColor(R.color.background_color);
circlePaint.setColor(getResources().getColor(R.color.background_color));
circlePaint.setStrokeWidth(1);
circlePaint.setStyle(Paint.Style.FILL_AND_STROKE);
Resources r = this.getResources();

View File

@ -1,3 +1,28 @@
/**
******************************************************************************
* @file Controller.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Allows controlling the UAV over telemetry. This activity
* pushes the appropriate settings to the remote device for it to
* listen to the GCSReceiver.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.util.Observable;
@ -9,16 +34,16 @@ import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVObjectField;
import com.MobileAnarchy.Android.Widgets.Joystick.DualJoystickView;
import com.MobileAnarchy.Android.Widgets.Joystick.JoystickMovedListener;
import com.MobileAnarchy.Android.Widgets.Joystick.JoystickView;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import com.MobileAnarchy.Android.Widgets.Joystick.DualJoystickView;
import com.MobileAnarchy.Android.Widgets.Joystick.JoystickMovedListener;
import com.MobileAnarchy.Android.Widgets.Joystick.JoystickView;
public class Controller extends ObjectManagerActivity {
private final String TAG = "Controller";
@ -89,28 +114,33 @@ public class Controller extends ObjectManagerActivity {
// Hardcode a Mode 1 listener for now
joystick.setOnJostickMovedListener(new JoystickMovedListener() {
@Override
public void OnMoved(int pan, int tilt) {
pitch = (double) tilt / MOVEMENT_RANGE;
yaw = (double) pan / MOVEMENT_RANGE;
pitch = tilt / MOVEMENT_RANGE;
yaw = pan / MOVEMENT_RANGE;
leftJoystickHeld = true;
}
@Override
public void OnReleased() { leftJoystickHeld = false; throttle = -1; updated = true; }
@Override
public void OnReturnedToCenter() { }
}, new JoystickMovedListener() {
@Override
public void OnMoved(int pan, int tilt) {
throttle = (double) (-tilt + (MOVEMENT_RANGE -5)) / (MOVEMENT_RANGE - 5);
throttle = (-tilt + (MOVEMENT_RANGE -5)) / (MOVEMENT_RANGE - 5);
throttle *= 0.5;
if (throttle < 0)
throttle = -1;
roll = (double) pan / MOVEMENT_RANGE;
roll = pan / MOVEMENT_RANGE;
rightJoystickHeld = true;
}
@Override
public void OnReleased() { rightJoystickHeld = false; throttle = -1; updated = true; }
@Override
public void OnReturnedToCenter() { }
}) ;
TimerTask controllerTask = new TimerTask() {
@Override
public void run() {
uavobjHandler.post(new Runnable() {
@Override
@ -154,12 +184,14 @@ public class Controller extends ObjectManagerActivity {
*/
final Handler uavobjHandler = new Handler();
final Runnable updateText = new Runnable() {
@Override
public void run() {
updateManualControl();
}
};
private final Observer updatedObserver = new Observer() {
@Override
public void update(Observable observable, Object data) {
uavobjHandler.post(updateText);
}

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file HomePage.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Main launch page for the Android GCS actitivies
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.content.Intent;
@ -15,6 +38,7 @@ public class HomePage extends ObjectManagerActivity {
Button objectBrowser = (Button) findViewById(R.id.launch_object_browser);
objectBrowser.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(HomePage.this, ObjectBrowser.class));
}
@ -22,6 +46,7 @@ public class HomePage extends ObjectManagerActivity {
Button pfd = (Button) findViewById(R.id.launch_pfd);
pfd.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(HomePage.this, PFD.class));
}
@ -29,6 +54,7 @@ public class HomePage extends ObjectManagerActivity {
Button location = (Button) findViewById(R.id.launch_location);
location.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(HomePage.this, UAVLocation.class));
}
@ -36,6 +62,7 @@ public class HomePage extends ObjectManagerActivity {
Button controller = (Button) findViewById(R.id.launch_controller);
controller.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(HomePage.this, Controller.class));
}
@ -43,6 +70,7 @@ public class HomePage extends ObjectManagerActivity {
Button logger = (Button) findViewById(R.id.launch_logger);
logger.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(HomePage.this, Logger.class));
}
@ -50,6 +78,7 @@ public class HomePage extends ObjectManagerActivity {
Button alarms = (Button) findViewById(R.id.launch_alarms);
alarms.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
startActivity(new Intent(HomePage.this, SystemAlarmActivity.class));
}

View File

@ -1,3 +1,27 @@
/**
******************************************************************************
* @file Logger.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Controller for logging data as well as interface for getting that
* data on and off the tablet.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.io.File;

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
* @file OPTelemetryService.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Provides UAVTalk telemetry over multiple physical links. The
* details of each of these are in their respective connection
* classes. This mostly creates those threads based on the selected
* preferences.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.io.IOException;
@ -208,7 +234,8 @@ public class OPTelemetryService extends Service {
// Fake class for testing, simply emits periodic updates on
private class FakeTelemetryThread extends Thread implements TelemTask {
private UAVObjectManager objMngr;
private final UAVObjectManager objMngr;
@Override
public UAVObjectManager getObjectManager() { return objMngr; };
FakeTelemetryThread() {
@ -216,6 +243,7 @@ public class OPTelemetryService extends Service {
UAVObjectsInitialize.register(objMngr);
}
@Override
public void run() {
System.out.println("Running fake thread");
@ -271,11 +299,12 @@ public class OPTelemetryService extends Service {
}
private class BTTelemetryThread extends Thread implements TelemTask {
private UAVObjectManager objMngr;
private final UAVObjectManager objMngr;
private UAVTalk uavTalk;
private Telemetry tel;
private TelemetryMonitor mon;
@Override
public UAVObjectManager getObjectManager() { return objMngr; };
BTTelemetryThread() {
@ -283,6 +312,7 @@ public class OPTelemetryService extends Service {
UAVObjectsInitialize.register(objMngr);
}
@Override
public void run() {
if (DEBUG) Log.d(TAG, "Telemetry Thread started");
@ -318,6 +348,7 @@ public class OPTelemetryService extends Service {
tel = new Telemetry(uavTalk, objMngr);
mon = new TelemetryMonitor(objMngr,tel);
mon.addObserver(new Observer() {
@Override
public void update(Observable arg0, Object arg1) {
System.out.println("Mon updated. Connected: " + mon.getConnected() + " objects updated: " + mon.getObjectsUpdated());
if(mon.getConnected() /*&& mon.getObjectsUpdated()*/) {
@ -347,11 +378,12 @@ public class OPTelemetryService extends Service {
private class TcpTelemetryThread extends Thread implements TelemTask {
private UAVObjectManager objMngr;
private final UAVObjectManager objMngr;
private UAVTalk uavTalk;
private Telemetry tel;
private TelemetryMonitor mon;
@Override
public UAVObjectManager getObjectManager() { return objMngr; };
TcpTelemetryThread() {
@ -359,6 +391,7 @@ public class OPTelemetryService extends Service {
UAVObjectsInitialize.register(objMngr);
}
@Override
public void run() {
if (DEBUG) Log.d(TAG, "Telemetry Thread started");
@ -394,6 +427,7 @@ public class OPTelemetryService extends Service {
tel = new Telemetry(uavTalk, objMngr);
mon = new TelemetryMonitor(objMngr,tel);
mon.addObserver(new Observer() {
@Override
public void update(Observable arg0, Object arg1) {
System.out.println("Mon updated. Connected: " + mon.getConnected() + " objects updated: " + mon.getObjectsUpdated());
if(mon.getConnected() /*&& mon.getObjectsUpdated()*/) {

View File

@ -1,3 +1,27 @@
/**
******************************************************************************
* @file ObjectBrowser.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A simple object browser for UAVOs that allows viewing, editing,
* loading and saving.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.util.ArrayList;
@ -6,6 +30,9 @@ import java.util.ListIterator;
import java.util.Observable;
import java.util.Observer;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObject;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
@ -16,6 +43,7 @@ import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
@ -23,10 +51,6 @@ import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;
import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObject;
public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPreferenceChangeListener {
@ -39,12 +63,14 @@ public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPref
final Handler uavobjHandler = new Handler();
final Runnable updateText = new Runnable() {
@Override
public void run() {
updateObject();
}
};
private final Observer updatedObserver = new Observer() {
@Override
public void update(Observable observable, Object data) {
uavobjHandler.post(updateText);
}
@ -137,6 +163,7 @@ public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPref
objects.setAdapter(adapter);
objects.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
@ -161,6 +188,7 @@ public class ObjectBrowser extends ObjectManagerActivity implements OnSharedPref
Log.d(TAG,"Update called but invalid index: " + selected_index);
}
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
String key) {
// TODO Auto-generated method stub

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file ObjectEditor.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A popup dialog for editing the contents of a UAVO.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.util.List;
@ -58,6 +81,7 @@ public class ObjectEditor extends ObjectManagerActivity {
});
}
@Override
public void onOPConnected() {
UAVObject obj = objMngr.getObject(objectID, instID);
if (obj == null) {
@ -87,7 +111,7 @@ public class ObjectEditor extends ObjectManagerActivity {
return;
}
long thisId = objectID < 0 ? ((Long) 0x100000000l) + objectID : objectID;
long thisId = objectID < 0 ? 0x100000000l + objectID : objectID;
objPer.getField("Operation").setValue("Save");
objPer.getField("Selection").setValue("SingleObject");
Log.d(TAG,"Saving with object id: " + objectID + " swapped to " + thisId);

View File

@ -1,3 +1,32 @@
/**
******************************************************************************
* @file ObjectManagerActivity.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Base object for all activies that use the UAVObjectManager.
* This class takes care of binding to the service and getting the
* object manager as well as setting up callbacks to the objects of
* interest that run on the UI thread.
* Implements a new Android lifecycle: onOPConnected() / onOPDisconnected()
* which indicates when a valid telemetry is established as well as a
* valid object manager handle.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.util.List;

View File

@ -1,3 +1,29 @@
/**
******************************************************************************
* @file ObjectManagerFragment.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Base class for all fragments that use the UAVObjectManager. This
* supports all the extensions the ObjectManagerActivity does, namely
* access to the UAVObjectManager and callbacks in the UI thread for
* object updates.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import org.openpilot.uavtalk.UAVObject;
@ -30,6 +56,7 @@ public class ObjectManagerFragment extends Fragment {
* Attach to the parent activity so it can notify us when the connection
* changed
*/
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
if (DEBUG) Log.d(TAG,"onAttach");

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file PFD.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Shows the PFD activity.
* @see The GNU Public License (GPL) Version 3
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import org.openpilot.uavtalk.UAVObject;
@ -15,6 +38,7 @@ public class PFD extends ObjectManagerActivity {
/**
* Update the UI whenever the attitude is updated
*/
@Override
protected void objectUpdated(UAVObject obj) {
// Throttle the UI redraws. Eventually this should maybe come from a periodic task
if ((System.currentTimeMillis() - lastUpdateMs) < MIN_UPDATE_PERIOD)

View File

@ -1,3 +1,27 @@
/**
******************************************************************************
* @file Preferences.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Displays the preferences dialog.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.os.Bundle;

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file SystemAlarmActivity.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief An activity that displays the SystemAlarmsFragment.
* @see The GNU Public License (GPL) Version 3
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.os.Bundle;

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file SystemAlarmsFragment.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A fragment that will connect to the SystemAlarms and visualize them.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.util.List;
@ -18,12 +41,14 @@ public class SystemAlarmsFragment extends ObjectManagerFragment {
private static final String TAG = SystemAlarmsFragment.class.getSimpleName();
//@Override
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
return inflater.inflate(R.layout.system_alarms_fragment, container, false);
}
@Override
public void onOPConnected(UAVObjectManager objMngr) {
super.onOPConnected(objMngr);
Log.d(TAG,"On connected");

View File

@ -1,9 +1,33 @@
/**
******************************************************************************
* @file TcpUAVTalk.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief UAVTalk over TCP.
* @see The GNU Public License (GPL) Version 3
*
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.io.IOException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;
import org.openpilot.uavtalk.UAVObjectManager;
import org.openpilot.uavtalk.UAVTalk;

View File

@ -1,3 +1,25 @@
/**
******************************************************************************
* @file TelemetryWidget.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief A widget that shows the status of telemetry.
* @see The GNU Public License (GPL) Version 3
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import android.appwidget.AppWidgetManager;
@ -30,6 +52,7 @@ public class TelemetryWidget extends AppWidgetProvider {
}
@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
final int N = appWidgetIds.length;

View File

@ -1,3 +1,26 @@
/**
******************************************************************************
* @file UAVLocation.java
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
* @brief Display the UAV location on google maps
* @see The GNU Public License (GPL) Version 3
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.openpilot.androidgcs;
import java.util.List;
@ -10,14 +33,6 @@ import org.openpilot.uavtalk.UAVDataObject;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVObjectManager;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;
import com.google.android.maps.MyLocationOverlay;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.Context;
@ -36,6 +51,14 @@ import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MyLocationOverlay;
import com.google.android.maps.Overlay;
import com.google.android.maps.Projection;
public class UAVLocation extends MapActivity
{
private final String TAG = "UAVLocation";
@ -112,6 +135,7 @@ public class UAVLocation extends MapActivity
}
//@Override
@Override
protected boolean isRouteDisplayed() {
// IMPORTANT: This method must return true if your Activity // is displaying driving directions. Otherwise return false.
return false;
@ -169,12 +193,14 @@ public class UAVLocation extends MapActivity
UAVObject obj = objMngr.getObject("HomeLocation");
if(obj != null)
obj.addUpdatedObserver(new Observer() {
@Override
public void update(Observable observable, Object data) {
UAVDataObject obj = (UAVDataObject) data;
Double lat = obj.getField("Latitude").getDouble() / 10;
Double lon = obj.getField("Longitude").getDouble() / 10;
homeLocation = new GeoPoint(lat.intValue(), lon.intValue());
runOnUiThread(new Runnable() {
@Override
public void run() {
mapController.setCenter(homeLocation);
}
@ -187,9 +213,11 @@ public class UAVLocation extends MapActivity
obj = objMngr.getObject("PositionActual");
if(obj != null)
obj.addUpdatedObserver(new Observer() {
@Override
public void update(Observable observable, Object data) {
uavLocation = getUavLocation();
runOnUiThread(new Runnable() {
@Override
public void run() {
mapView.invalidate();
}
@ -200,11 +228,11 @@ public class UAVLocation extends MapActivity
}
private GeoPoint getUavLocation() {
UAVObject pos = (UAVObject) objMngr.getObject("PositionActual");
UAVObject pos = objMngr.getObject("PositionActual");
if (pos == null)
return new GeoPoint(0,0);
UAVObject home = (UAVObject) objMngr.getObject("HomeLocation");
UAVObject home = objMngr.getObject("HomeLocation");
if (home == null)
return new GeoPoint(0,0);
@ -271,7 +299,8 @@ public class UAVLocation extends MapActivity
}
/** Defines callbacks for service binding, passed to bindService() */
private ServiceConnection mConnection = new ServiceConnection() {
private final ServiceConnection mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName arg0, IBinder service) {
// We've bound to LocalService, cast the IBinder and attempt to open a connection
if (DEBUG) Log.d(TAG,"Service bound");
@ -289,6 +318,7 @@ public class UAVLocation extends MapActivity
}
}
@Override
public void onServiceDisconnected(ComponentName name) {
mBound = false;
binder = null;