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_TOAST = 100;
|
||||
|
||||
private boolean terminate = false;
|
||||
|
||||
private Thread activeTelem;
|
||||
private TelemetryTask telemTask;
|
||||
|
||||
@ -111,7 +109,6 @@ public class OPTelemetryService extends Service {
|
||||
stopSelf(msg.arg2);
|
||||
break;
|
||||
case MSG_CONNECT:
|
||||
terminate = false;
|
||||
int connection_type;
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(OPTelemetryService.this);
|
||||
try {
|
||||
@ -146,7 +143,6 @@ public class OPTelemetryService extends Service {
|
||||
case MSG_DISCONNECT:
|
||||
Toast.makeText(getApplicationContext(), "Disconnect requested", Toast.LENGTH_SHORT).show();
|
||||
if (DEBUG) Log.d(TAG, "Calling disconnect");
|
||||
terminate = true;
|
||||
if (telemTask != null) {
|
||||
telemTask.disconnect();
|
||||
telemTask = null;
|
||||
@ -371,26 +367,28 @@ public class OPTelemetryService extends Service {
|
||||
|
||||
try {
|
||||
Class<?> initClass = loader.loadClass("org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize");
|
||||
Log.d(TAG, "Got the initClass: " + initClass);
|
||||
Method initMethod = initClass.getMethod("register", UAVObjectManager.class);
|
||||
Log.d(TAG, "Got the method: " + initMethod);
|
||||
initMethod.invoke(null, objMngr);
|
||||
Log.d(TAG, "Invoked");
|
||||
} catch (ClassNotFoundException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return false;
|
||||
} catch (IllegalAccessException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return false;
|
||||
} catch (NoSuchMethodException e1) {
|
||||
// TODO Auto-generated catch block
|
||||
e1.printStackTrace();
|
||||
return false;
|
||||
} catch (IllegalArgumentException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
} catch (InvocationTargetException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -96,7 +96,7 @@ public abstract class TelemetryTask implements Runnable {
|
||||
private final Observer firmwareIapUpdated = new Observer() {
|
||||
@Override
|
||||
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");
|
||||
UAVObjectField description = obj.getField("Description");
|
||||
@ -108,8 +108,11 @@ public abstract class TelemetryTask implements Runnable {
|
||||
for(int i = 0; i < HASH_SIZE_USED; i++)
|
||||
jarName += Integer.toHexString((int) description.getDouble(i+60));
|
||||
jarName += ".jar";
|
||||
Log.d(TAG, "Attempting to load: " + jarName);
|
||||
telemService.loadUavobjects(jarName, objMngr);
|
||||
if (DEBUG) Log.d(TAG, "Attempting to load: " + jarName);
|
||||
if (telemService.loadUavobjects(jarName, objMngr) ) {
|
||||
telemService.toastMessage("Loaded appropriate UAVO set");
|
||||
} else
|
||||
telemService.toastMessage("Failed to determine UAVO set");
|
||||
}
|
||||
|
||||
obj.removeUpdatedObserver(this);
|
||||
|
Loading…
Reference in New Issue
Block a user