mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
Some cosmetic changes, also initialize the Metadata properly
This commit is contained in:
parent
6dd509ded3
commit
1f202089d1
@ -3,6 +3,7 @@ package org.openpilot.uavtalk;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
public class UAVMetaObject extends UAVObject {
|
||||
|
||||
@ -10,6 +11,8 @@ public class UAVMetaObject extends UAVObject {
|
||||
super(objID, true, name);
|
||||
this.parent = parent;
|
||||
|
||||
ownMetadata = new Metadata();
|
||||
|
||||
ownMetadata.flightAccess = UAVObject.AccessMode.ACCESS_READWRITE;
|
||||
ownMetadata.gcsAccess = UAVObject.AccessMode.ACCESS_READWRITE;
|
||||
ownMetadata.flightTelemetryAcked = UAVObject.Acked.TRUE;
|
||||
@ -48,9 +51,17 @@ public class UAVMetaObject extends UAVObject {
|
||||
fields.add( new UAVObjectField("Logging Update Mode", "", UAVObjectField.FieldType.ENUM, 1, updateModeEnum) );
|
||||
fields.add( new UAVObjectField("Logging Update Period", "", UAVObjectField.FieldType.UINT32, 1, null ) );
|
||||
|
||||
int numBytes = 0;
|
||||
ListIterator<UAVObjectField> li = fields.listIterator();
|
||||
while(li.hasNext()) {
|
||||
numBytes += li.next().getNumBytes();
|
||||
}
|
||||
|
||||
// Initialize object
|
||||
|
||||
// Initialize parent
|
||||
super.initialize(0);
|
||||
super.initializeFields(fields, ByteBuffer.allocate(10), 10);
|
||||
initializeFields(fields, ByteBuffer.allocate(numBytes), numBytes);
|
||||
|
||||
// Setup metadata of parent
|
||||
parentMetadata = parent.getDefaultMetadata();
|
||||
|
@ -461,7 +461,7 @@ public abstract class UAVObject {
|
||||
* Return a string with the object information (only the header)
|
||||
*/
|
||||
public String toStringBrief() {
|
||||
return getName() + " ( " + Integer.toHexString(getObjID()) + " " + Integer.toHexString(getInstID()) + " " + getNumBytes() + ")\n";
|
||||
return getName() + " (" + Integer.toHexString(getObjID()) + " " + Integer.toHexString(getInstID()) + " " + getNumBytes() + ")\n";
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -440,11 +440,7 @@ public class UAVObjectField {
|
||||
|
||||
public String toString() {
|
||||
String sout = new String();
|
||||
sout += name + ": [ ";
|
||||
for (int n = 0; n < numElements; ++n)
|
||||
sout += String.valueOf(n) + "(" + getValue(n) + ") ";
|
||||
|
||||
sout += "] " + units + "\n";
|
||||
sout += name + ": " + ((List) data).toString() + " (" + units + ")\n";
|
||||
return sout;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user