1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

AndroidGCS: Make the tablet load the appropriate UAVO file based on the description

from the assets.

Rename the uavobjects.jar to match the uavo hash.

Conflicts:

	androidgcs/assets/875bbaadee717b2f.jar
This commit is contained in:
James Cotton 2012-10-08 09:22:57 -05:00
parent 76785cad57
commit df6d7eb11d

View File

@ -9,6 +9,7 @@ import java.util.Observer;
import org.openpilot.uavtalk.Telemetry;
import org.openpilot.uavtalk.TelemetryMonitor;
import org.openpilot.uavtalk.UAVObject;
import org.openpilot.uavtalk.UAVObjectField;
import org.openpilot.uavtalk.UAVObjectManager;
import org.openpilot.uavtalk.UAVTalk;
import org.openpilot.uavtalk.uavobjects.TelemObjectsInitialize;
@ -96,9 +97,21 @@ public abstract class TelemetryTask implements Runnable {
@Override
public void update(Observable observable, Object data) {
Log.d(TAG, "Received firmware IAP Updated message");
telemService.loadUavobjects("uavobjects.jar", objMngr);
UAVObject obj = objMngr.getObject("FirmwareIAPObj");
UAVObjectField description = obj.getField("Description");
if(description == null || description.getNumElements() < 100) {
telemService.toastMessage("Failed to determine UAVO set");
} else {
final int HASH_SIZE_USED = 8;
String jarName = new String();
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);
}
obj.removeUpdatedObserver(this);
}
};