mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
AndroidGCS: Restore stripped down UAVObjectsInitialize which only registers
FlightTelementryStats GCSTelemetryStats and FirmwareIAPObj
This commit is contained in:
parent
51868437c6
commit
11079a6dd7
@ -28,9 +28,7 @@ package org.openpilot.androidgcs.telemetry;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import org.openpilot.uavtalk.UAVDataObject;
|
||||
import org.openpilot.uavtalk.UAVObjectManager;
|
||||
import org.openpilot.uavtalk.uavobjects.UAVObjectsInitialize;
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Intent;
|
||||
|
@ -0,0 +1,272 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjecttemplate.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Template for an uavobject in java
|
||||
* This is a autogenerated file!! Do not modify and expect a result.
|
||||
* Queries board for SN, model, revision, and sends reset command
|
||||
*
|
||||
* @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.uavtalk.uavobjects;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.openpilot.uavtalk.UAVObjectManager;
|
||||
import org.openpilot.uavtalk.UAVObject;
|
||||
import org.openpilot.uavtalk.UAVDataObject;
|
||||
import org.openpilot.uavtalk.UAVObjectField;
|
||||
|
||||
/**
|
||||
Queries board for SN, model, revision, and sends reset command
|
||||
|
||||
generated from firmwareiapobj.xml
|
||||
**/
|
||||
public class FirmwareIAPObj extends UAVDataObject {
|
||||
|
||||
public FirmwareIAPObj() {
|
||||
super(OBJID, ISSINGLEINST, ISSETTINGS, NAME);
|
||||
|
||||
List<UAVObjectField> fields = new ArrayList<UAVObjectField>();
|
||||
|
||||
|
||||
List<String> crcElemNames = new ArrayList<String>();
|
||||
crcElemNames.add("0");
|
||||
fields.add( new UAVObjectField("crc", "", UAVObjectField.FieldType.UINT32, crcElemNames, null) );
|
||||
|
||||
List<String> CommandElemNames = new ArrayList<String>();
|
||||
CommandElemNames.add("0");
|
||||
fields.add( new UAVObjectField("Command", "", UAVObjectField.FieldType.UINT16, CommandElemNames, null) );
|
||||
|
||||
List<String> BoardRevisionElemNames = new ArrayList<String>();
|
||||
BoardRevisionElemNames.add("0");
|
||||
fields.add( new UAVObjectField("BoardRevision", "", UAVObjectField.FieldType.UINT16, BoardRevisionElemNames, null) );
|
||||
|
||||
List<String> DescriptionElemNames = new ArrayList<String>();
|
||||
DescriptionElemNames.add("0");
|
||||
DescriptionElemNames.add("1");
|
||||
DescriptionElemNames.add("2");
|
||||
DescriptionElemNames.add("3");
|
||||
DescriptionElemNames.add("4");
|
||||
DescriptionElemNames.add("5");
|
||||
DescriptionElemNames.add("6");
|
||||
DescriptionElemNames.add("7");
|
||||
DescriptionElemNames.add("8");
|
||||
DescriptionElemNames.add("9");
|
||||
DescriptionElemNames.add("10");
|
||||
DescriptionElemNames.add("11");
|
||||
DescriptionElemNames.add("12");
|
||||
DescriptionElemNames.add("13");
|
||||
DescriptionElemNames.add("14");
|
||||
DescriptionElemNames.add("15");
|
||||
DescriptionElemNames.add("16");
|
||||
DescriptionElemNames.add("17");
|
||||
DescriptionElemNames.add("18");
|
||||
DescriptionElemNames.add("19");
|
||||
DescriptionElemNames.add("20");
|
||||
DescriptionElemNames.add("21");
|
||||
DescriptionElemNames.add("22");
|
||||
DescriptionElemNames.add("23");
|
||||
DescriptionElemNames.add("24");
|
||||
DescriptionElemNames.add("25");
|
||||
DescriptionElemNames.add("26");
|
||||
DescriptionElemNames.add("27");
|
||||
DescriptionElemNames.add("28");
|
||||
DescriptionElemNames.add("29");
|
||||
DescriptionElemNames.add("30");
|
||||
DescriptionElemNames.add("31");
|
||||
DescriptionElemNames.add("32");
|
||||
DescriptionElemNames.add("33");
|
||||
DescriptionElemNames.add("34");
|
||||
DescriptionElemNames.add("35");
|
||||
DescriptionElemNames.add("36");
|
||||
DescriptionElemNames.add("37");
|
||||
DescriptionElemNames.add("38");
|
||||
DescriptionElemNames.add("39");
|
||||
DescriptionElemNames.add("40");
|
||||
DescriptionElemNames.add("41");
|
||||
DescriptionElemNames.add("42");
|
||||
DescriptionElemNames.add("43");
|
||||
DescriptionElemNames.add("44");
|
||||
DescriptionElemNames.add("45");
|
||||
DescriptionElemNames.add("46");
|
||||
DescriptionElemNames.add("47");
|
||||
DescriptionElemNames.add("48");
|
||||
DescriptionElemNames.add("49");
|
||||
DescriptionElemNames.add("50");
|
||||
DescriptionElemNames.add("51");
|
||||
DescriptionElemNames.add("52");
|
||||
DescriptionElemNames.add("53");
|
||||
DescriptionElemNames.add("54");
|
||||
DescriptionElemNames.add("55");
|
||||
DescriptionElemNames.add("56");
|
||||
DescriptionElemNames.add("57");
|
||||
DescriptionElemNames.add("58");
|
||||
DescriptionElemNames.add("59");
|
||||
DescriptionElemNames.add("60");
|
||||
DescriptionElemNames.add("61");
|
||||
DescriptionElemNames.add("62");
|
||||
DescriptionElemNames.add("63");
|
||||
DescriptionElemNames.add("64");
|
||||
DescriptionElemNames.add("65");
|
||||
DescriptionElemNames.add("66");
|
||||
DescriptionElemNames.add("67");
|
||||
DescriptionElemNames.add("68");
|
||||
DescriptionElemNames.add("69");
|
||||
DescriptionElemNames.add("70");
|
||||
DescriptionElemNames.add("71");
|
||||
DescriptionElemNames.add("72");
|
||||
DescriptionElemNames.add("73");
|
||||
DescriptionElemNames.add("74");
|
||||
DescriptionElemNames.add("75");
|
||||
DescriptionElemNames.add("76");
|
||||
DescriptionElemNames.add("77");
|
||||
DescriptionElemNames.add("78");
|
||||
DescriptionElemNames.add("79");
|
||||
DescriptionElemNames.add("80");
|
||||
DescriptionElemNames.add("81");
|
||||
DescriptionElemNames.add("82");
|
||||
DescriptionElemNames.add("83");
|
||||
DescriptionElemNames.add("84");
|
||||
DescriptionElemNames.add("85");
|
||||
DescriptionElemNames.add("86");
|
||||
DescriptionElemNames.add("87");
|
||||
DescriptionElemNames.add("88");
|
||||
DescriptionElemNames.add("89");
|
||||
DescriptionElemNames.add("90");
|
||||
DescriptionElemNames.add("91");
|
||||
DescriptionElemNames.add("92");
|
||||
DescriptionElemNames.add("93");
|
||||
DescriptionElemNames.add("94");
|
||||
DescriptionElemNames.add("95");
|
||||
DescriptionElemNames.add("96");
|
||||
DescriptionElemNames.add("97");
|
||||
DescriptionElemNames.add("98");
|
||||
DescriptionElemNames.add("99");
|
||||
fields.add( new UAVObjectField("Description", "", UAVObjectField.FieldType.UINT8, DescriptionElemNames, null) );
|
||||
|
||||
List<String> CPUSerialElemNames = new ArrayList<String>();
|
||||
CPUSerialElemNames.add("0");
|
||||
CPUSerialElemNames.add("1");
|
||||
CPUSerialElemNames.add("2");
|
||||
CPUSerialElemNames.add("3");
|
||||
CPUSerialElemNames.add("4");
|
||||
CPUSerialElemNames.add("5");
|
||||
CPUSerialElemNames.add("6");
|
||||
CPUSerialElemNames.add("7");
|
||||
CPUSerialElemNames.add("8");
|
||||
CPUSerialElemNames.add("9");
|
||||
CPUSerialElemNames.add("10");
|
||||
CPUSerialElemNames.add("11");
|
||||
fields.add( new UAVObjectField("CPUSerial", "", UAVObjectField.FieldType.UINT8, CPUSerialElemNames, null) );
|
||||
|
||||
List<String> BoardTypeElemNames = new ArrayList<String>();
|
||||
BoardTypeElemNames.add("0");
|
||||
fields.add( new UAVObjectField("BoardType", "", UAVObjectField.FieldType.UINT8, BoardTypeElemNames, null) );
|
||||
|
||||
List<String> ArmResetElemNames = new ArrayList<String>();
|
||||
ArmResetElemNames.add("0");
|
||||
fields.add( new UAVObjectField("ArmReset", "", UAVObjectField.FieldType.UINT8, ArmResetElemNames, null) );
|
||||
|
||||
|
||||
// Compute the number of bytes for this object
|
||||
int numBytes = 0;
|
||||
ListIterator<UAVObjectField> li = fields.listIterator();
|
||||
while(li.hasNext()) {
|
||||
numBytes += li.next().getNumBytes();
|
||||
}
|
||||
NUMBYTES = numBytes;
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, ByteBuffer.allocate(NUMBYTES), NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
// Set the object description
|
||||
setDescription(DESCRIPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Metadata object filled with default values for this object
|
||||
* @return Metadata object with default values
|
||||
*/
|
||||
public Metadata getDefaultMetadata() {
|
||||
UAVObject.Metadata metadata = new UAVObject.Metadata();
|
||||
metadata.flags =
|
||||
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT |
|
||||
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT |
|
||||
1 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
|
||||
1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
|
||||
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_ONCHANGE) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
|
||||
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
|
||||
metadata.flightTelemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
public void setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of this object, a new instance ID must be specified.
|
||||
* Do not use this function directly to create new instances, the
|
||||
* UAVObjectManager should be used instead.
|
||||
*/
|
||||
public UAVDataObject clone(long instID) {
|
||||
// TODO: Need to get specific instance to clone
|
||||
try {
|
||||
FirmwareIAPObj obj = new FirmwareIAPObj();
|
||||
obj.initialize(instID, this.getMetaObject());
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
public FirmwareIAPObj GetInstance(UAVObjectManager objMngr, long instID)
|
||||
{
|
||||
return (FirmwareIAPObj)(objMngr.getObject(FirmwareIAPObj.OBJID, instID));
|
||||
}
|
||||
|
||||
// Constants
|
||||
protected static final long OBJID = 0x5E6E8FDCl;
|
||||
protected static final String NAME = "FirmwareIAPObj";
|
||||
protected static String DESCRIPTION = "Queries board for SN, model, revision, and sends reset command";
|
||||
protected static final boolean ISSINGLEINST = 1 > 0;
|
||||
protected static final boolean ISSETTINGS = 0 > 0;
|
||||
protected static int NUMBYTES = 0;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjecttemplate.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Template for an uavobject in java
|
||||
* This is a autogenerated file!! Do not modify and expect a result.
|
||||
* Maintains the telemetry statistics from the OpenPilot flight computer.
|
||||
*
|
||||
* @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.uavtalk.uavobjects;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.openpilot.uavtalk.UAVObjectManager;
|
||||
import org.openpilot.uavtalk.UAVObject;
|
||||
import org.openpilot.uavtalk.UAVDataObject;
|
||||
import org.openpilot.uavtalk.UAVObjectField;
|
||||
|
||||
/**
|
||||
Maintains the telemetry statistics from the OpenPilot flight computer.
|
||||
|
||||
generated from flighttelemetrystats.xml
|
||||
**/
|
||||
public class FlightTelemetryStats extends UAVDataObject {
|
||||
|
||||
public FlightTelemetryStats() {
|
||||
super(OBJID, ISSINGLEINST, ISSETTINGS, NAME);
|
||||
|
||||
List<UAVObjectField> fields = new ArrayList<UAVObjectField>();
|
||||
|
||||
|
||||
List<String> TxDataRateElemNames = new ArrayList<String>();
|
||||
TxDataRateElemNames.add("0");
|
||||
fields.add( new UAVObjectField("TxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, TxDataRateElemNames, null) );
|
||||
|
||||
List<String> RxDataRateElemNames = new ArrayList<String>();
|
||||
RxDataRateElemNames.add("0");
|
||||
fields.add( new UAVObjectField("RxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, RxDataRateElemNames, null) );
|
||||
|
||||
List<String> TxFailuresElemNames = new ArrayList<String>();
|
||||
TxFailuresElemNames.add("0");
|
||||
fields.add( new UAVObjectField("TxFailures", "count", UAVObjectField.FieldType.UINT32, TxFailuresElemNames, null) );
|
||||
|
||||
List<String> RxFailuresElemNames = new ArrayList<String>();
|
||||
RxFailuresElemNames.add("0");
|
||||
fields.add( new UAVObjectField("RxFailures", "count", UAVObjectField.FieldType.UINT32, RxFailuresElemNames, null) );
|
||||
|
||||
List<String> TxRetriesElemNames = new ArrayList<String>();
|
||||
TxRetriesElemNames.add("0");
|
||||
fields.add( new UAVObjectField("TxRetries", "count", UAVObjectField.FieldType.UINT32, TxRetriesElemNames, null) );
|
||||
|
||||
List<String> StatusElemNames = new ArrayList<String>();
|
||||
StatusElemNames.add("0");
|
||||
List<String> StatusEnumOptions = new ArrayList<String>();
|
||||
StatusEnumOptions.add("Disconnected");
|
||||
StatusEnumOptions.add("HandshakeReq");
|
||||
StatusEnumOptions.add("HandshakeAck");
|
||||
StatusEnumOptions.add("Connected");
|
||||
fields.add( new UAVObjectField("Status", "", UAVObjectField.FieldType.ENUM, StatusElemNames, StatusEnumOptions) );
|
||||
|
||||
|
||||
// Compute the number of bytes for this object
|
||||
int numBytes = 0;
|
||||
ListIterator<UAVObjectField> li = fields.listIterator();
|
||||
while(li.hasNext()) {
|
||||
numBytes += li.next().getNumBytes();
|
||||
}
|
||||
NUMBYTES = numBytes;
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, ByteBuffer.allocate(NUMBYTES), NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
// Set the object description
|
||||
setDescription(DESCRIPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Metadata object filled with default values for this object
|
||||
* @return Metadata object with default values
|
||||
*/
|
||||
public Metadata getDefaultMetadata() {
|
||||
UAVObject.Metadata metadata = new UAVObject.Metadata();
|
||||
metadata.flags =
|
||||
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT |
|
||||
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT |
|
||||
1 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
|
||||
1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
|
||||
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
|
||||
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
|
||||
metadata.flightTelemetryUpdatePeriod = 5000;
|
||||
metadata.gcsTelemetryUpdatePeriod = 0;
|
||||
metadata.loggingUpdatePeriod = 5000;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
public void setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of this object, a new instance ID must be specified.
|
||||
* Do not use this function directly to create new instances, the
|
||||
* UAVObjectManager should be used instead.
|
||||
*/
|
||||
public UAVDataObject clone(long instID) {
|
||||
// TODO: Need to get specific instance to clone
|
||||
try {
|
||||
FlightTelemetryStats obj = new FlightTelemetryStats();
|
||||
obj.initialize(instID, this.getMetaObject());
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
public FlightTelemetryStats GetInstance(UAVObjectManager objMngr, long instID)
|
||||
{
|
||||
return (FlightTelemetryStats)(objMngr.getObject(FlightTelemetryStats.OBJID, instID));
|
||||
}
|
||||
|
||||
// Constants
|
||||
protected static final long OBJID = 0x2F7E2902l;
|
||||
protected static final String NAME = "FlightTelemetryStats";
|
||||
protected static String DESCRIPTION = "Maintains the telemetry statistics from the OpenPilot flight computer.";
|
||||
protected static final boolean ISSINGLEINST = 1 > 0;
|
||||
protected static final boolean ISSETTINGS = 0 > 0;
|
||||
protected static int NUMBYTES = 0;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjecttemplate.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief Template for an uavobject in java
|
||||
* This is a autogenerated file!! Do not modify and expect a result.
|
||||
* The telemetry statistics from the ground computer
|
||||
*
|
||||
* @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.uavtalk.uavobjects;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.openpilot.uavtalk.UAVObjectManager;
|
||||
import org.openpilot.uavtalk.UAVObject;
|
||||
import org.openpilot.uavtalk.UAVDataObject;
|
||||
import org.openpilot.uavtalk.UAVObjectField;
|
||||
|
||||
/**
|
||||
The telemetry statistics from the ground computer
|
||||
|
||||
generated from gcstelemetrystats.xml
|
||||
**/
|
||||
public class GCSTelemetryStats extends UAVDataObject {
|
||||
|
||||
public GCSTelemetryStats() {
|
||||
super(OBJID, ISSINGLEINST, ISSETTINGS, NAME);
|
||||
|
||||
List<UAVObjectField> fields = new ArrayList<UAVObjectField>();
|
||||
|
||||
|
||||
List<String> TxDataRateElemNames = new ArrayList<String>();
|
||||
TxDataRateElemNames.add("0");
|
||||
fields.add( new UAVObjectField("TxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, TxDataRateElemNames, null) );
|
||||
|
||||
List<String> RxDataRateElemNames = new ArrayList<String>();
|
||||
RxDataRateElemNames.add("0");
|
||||
fields.add( new UAVObjectField("RxDataRate", "bytes/sec", UAVObjectField.FieldType.FLOAT32, RxDataRateElemNames, null) );
|
||||
|
||||
List<String> TxFailuresElemNames = new ArrayList<String>();
|
||||
TxFailuresElemNames.add("0");
|
||||
fields.add( new UAVObjectField("TxFailures", "count", UAVObjectField.FieldType.UINT32, TxFailuresElemNames, null) );
|
||||
|
||||
List<String> RxFailuresElemNames = new ArrayList<String>();
|
||||
RxFailuresElemNames.add("0");
|
||||
fields.add( new UAVObjectField("RxFailures", "count", UAVObjectField.FieldType.UINT32, RxFailuresElemNames, null) );
|
||||
|
||||
List<String> TxRetriesElemNames = new ArrayList<String>();
|
||||
TxRetriesElemNames.add("0");
|
||||
fields.add( new UAVObjectField("TxRetries", "count", UAVObjectField.FieldType.UINT32, TxRetriesElemNames, null) );
|
||||
|
||||
List<String> StatusElemNames = new ArrayList<String>();
|
||||
StatusElemNames.add("0");
|
||||
List<String> StatusEnumOptions = new ArrayList<String>();
|
||||
StatusEnumOptions.add("Disconnected");
|
||||
StatusEnumOptions.add("HandshakeReq");
|
||||
StatusEnumOptions.add("HandshakeAck");
|
||||
StatusEnumOptions.add("Connected");
|
||||
fields.add( new UAVObjectField("Status", "", UAVObjectField.FieldType.ENUM, StatusElemNames, StatusEnumOptions) );
|
||||
|
||||
|
||||
// Compute the number of bytes for this object
|
||||
int numBytes = 0;
|
||||
ListIterator<UAVObjectField> li = fields.listIterator();
|
||||
while(li.hasNext()) {
|
||||
numBytes += li.next().getNumBytes();
|
||||
}
|
||||
NUMBYTES = numBytes;
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, ByteBuffer.allocate(NUMBYTES), NUMBYTES);
|
||||
// Set the default field values
|
||||
setDefaultFieldValues();
|
||||
// Set the object description
|
||||
setDescription(DESCRIPTION);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a Metadata object filled with default values for this object
|
||||
* @return Metadata object with default values
|
||||
*/
|
||||
public Metadata getDefaultMetadata() {
|
||||
UAVObject.Metadata metadata = new UAVObject.Metadata();
|
||||
metadata.flags =
|
||||
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_ACCESS_SHIFT |
|
||||
UAVObject.Metadata.AccessModeNum(UAVObject.AccessMode.ACCESS_READWRITE) << UAVOBJ_GCS_ACCESS_SHIFT |
|
||||
1 << UAVOBJ_TELEMETRY_ACKED_SHIFT |
|
||||
1 << UAVOBJ_GCS_TELEMETRY_ACKED_SHIFT |
|
||||
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_MANUAL) << UAVOBJ_TELEMETRY_UPDATE_MODE_SHIFT |
|
||||
UAVObject.Metadata.UpdateModeNum(UAVObject.UpdateMode.UPDATEMODE_PERIODIC) << UAVOBJ_GCS_TELEMETRY_UPDATE_MODE_SHIFT;
|
||||
metadata.flightTelemetryUpdatePeriod = 0;
|
||||
metadata.gcsTelemetryUpdatePeriod = 5000;
|
||||
metadata.loggingUpdatePeriod = 0;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize object fields with the default values.
|
||||
* If a default value is not specified the object fields
|
||||
* will be initialized to zero.
|
||||
*/
|
||||
public void setDefaultFieldValues()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a clone of this object, a new instance ID must be specified.
|
||||
* Do not use this function directly to create new instances, the
|
||||
* UAVObjectManager should be used instead.
|
||||
*/
|
||||
public UAVDataObject clone(long instID) {
|
||||
// TODO: Need to get specific instance to clone
|
||||
try {
|
||||
GCSTelemetryStats obj = new GCSTelemetryStats();
|
||||
obj.initialize(instID, this.getMetaObject());
|
||||
return obj;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Static function to retrieve an instance of the object.
|
||||
*/
|
||||
public GCSTelemetryStats GetInstance(UAVObjectManager objMngr, long instID)
|
||||
{
|
||||
return (GCSTelemetryStats)(objMngr.getObject(GCSTelemetryStats.OBJID, instID));
|
||||
}
|
||||
|
||||
// Constants
|
||||
protected static final long OBJID = 0xABC72744l;
|
||||
protected static final String NAME = "GCSTelemetryStats";
|
||||
protected static String DESCRIPTION = "The telemetry statistics from the ground computer";
|
||||
protected static final boolean ISSINGLEINST = 1 > 0;
|
||||
protected static final boolean ISSETTINGS = 0 > 0;
|
||||
protected static int NUMBYTES = 0;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
*
|
||||
* @file uavobjectsinittemplate.java
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* @brief the template for the uavobjects init part
|
||||
* $(GENERATEDWARNING)
|
||||
*
|
||||
* @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.uavtalk.uavobjects;
|
||||
|
||||
import org.openpilot.uavtalk.UAVObjectManager;
|
||||
|
||||
public class UAVObjectsInitialize {
|
||||
|
||||
public static void register(UAVObjectManager objMngr) {
|
||||
try {
|
||||
objMngr.registerObject( new FirmwareIAPObj() );
|
||||
objMngr.registerObject( new FlightTelemetryStats() );
|
||||
objMngr.registerObject( new GCSTelemetryStats() );
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user