mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
AndroidGCS: Add a message when the UAVOs are loaded
This commit is contained in:
parent
fcaced59b5
commit
0d42df9a02
@ -80,8 +80,6 @@ public class OPTelemetryService extends Service {
|
|||||||
static final int MSG_DISCONNECT = 3;
|
static final int MSG_DISCONNECT = 3;
|
||||||
static final int MSG_TOAST = 100;
|
static final int MSG_TOAST = 100;
|
||||||
|
|
||||||
private boolean terminate = false;
|
|
||||||
|
|
||||||
private Thread activeTelem;
|
private Thread activeTelem;
|
||||||
private TelemetryTask telemTask;
|
private TelemetryTask telemTask;
|
||||||
|
|
||||||
@ -111,7 +109,6 @@ public class OPTelemetryService extends Service {
|
|||||||
stopSelf(msg.arg2);
|
stopSelf(msg.arg2);
|
||||||
break;
|
break;
|
||||||
case MSG_CONNECT:
|
case MSG_CONNECT:
|
||||||
terminate = false;
|
|
||||||
int connection_type;
|
int connection_type;
|
||||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(OPTelemetryService.this);
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(OPTelemetryService.this);
|
||||||
try {
|
try {
|
||||||
@ -146,7 +143,6 @@ public class OPTelemetryService extends Service {
|
|||||||
case MSG_DISCONNECT:
|
case MSG_DISCONNECT:
|
||||||
Toast.makeText(getApplicationContext(), "Disconnect requested", Toast.LENGTH_SHORT).show();
|
Toast.makeText(getApplicationContext(), "Disconnect requested", Toast.LENGTH_SHORT).show();
|
||||||
if (DEBUG) Log.d(TAG, "Calling disconnect");
|
if (DEBUG) Log.d(TAG, "Calling disconnect");
|
||||||
terminate = true;
|
|
||||||
if (telemTask != null) {
|
if (telemTask != null) {
|
||||||
telemTask.disconnect();
|
telemTask.disconnect();
|
||||||
telemTask = null;
|
telemTask = null;
|
||||||
@ -371,26 +367,28 @@ public class OPTelemetryService extends Service {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Class<?> initClass = loader.loadClass("org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize");
|
Class<?> initClass = loader.loadClass("org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize");
|
||||||
Log.d(TAG, "Got the initClass: " + initClass);
|
|
||||||
Method initMethod = initClass.getMethod("register", UAVObjectManager.class);
|
Method initMethod = initClass.getMethod("register", UAVObjectManager.class);
|
||||||
Log.d(TAG, "Got the method: " + initMethod);
|
|
||||||
initMethod.invoke(null, objMngr);
|
initMethod.invoke(null, objMngr);
|
||||||
Log.d(TAG, "Invoked");
|
|
||||||
} catch (ClassNotFoundException e1) {
|
} catch (ClassNotFoundException e1) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
|
return false;
|
||||||
} catch (IllegalAccessException e1) {
|
} catch (IllegalAccessException e1) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
|
return false;
|
||||||
} catch (NoSuchMethodException e1) {
|
} catch (NoSuchMethodException e1) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e1.printStackTrace();
|
e1.printStackTrace();
|
||||||
|
return false;
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
} catch (InvocationTargetException e) {
|
} catch (InvocationTargetException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -96,7 +96,7 @@ public abstract class TelemetryTask implements Runnable {
|
|||||||
private final Observer firmwareIapUpdated = new Observer() {
|
private final Observer firmwareIapUpdated = new Observer() {
|
||||||
@Override
|
@Override
|
||||||
public void update(Observable observable, Object data) {
|
public void update(Observable observable, Object data) {
|
||||||
Log.d(TAG, "Received firmware IAP Updated message");
|
if (DEBUG) Log.d(TAG, "Received firmware IAP Updated message");
|
||||||
|
|
||||||
UAVObject obj = objMngr.getObject("FirmwareIAPObj");
|
UAVObject obj = objMngr.getObject("FirmwareIAPObj");
|
||||||
UAVObjectField description = obj.getField("Description");
|
UAVObjectField description = obj.getField("Description");
|
||||||
@ -108,8 +108,11 @@ public abstract class TelemetryTask implements Runnable {
|
|||||||
for(int i = 0; i < HASH_SIZE_USED; i++)
|
for(int i = 0; i < HASH_SIZE_USED; i++)
|
||||||
jarName += Integer.toHexString((int) description.getDouble(i+60));
|
jarName += Integer.toHexString((int) description.getDouble(i+60));
|
||||||
jarName += ".jar";
|
jarName += ".jar";
|
||||||
Log.d(TAG, "Attempting to load: " + jarName);
|
if (DEBUG) Log.d(TAG, "Attempting to load: " + jarName);
|
||||||
telemService.loadUavobjects(jarName, objMngr);
|
if (telemService.loadUavobjects(jarName, objMngr) ) {
|
||||||
|
telemService.toastMessage("Loaded appropriate UAVO set");
|
||||||
|
} else
|
||||||
|
telemService.toastMessage("Failed to determine UAVO set");
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.removeUpdatedObserver(this);
|
obj.removeUpdatedObserver(this);
|
||||||
|
Loading…
Reference in New Issue
Block a user