mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
GCS/UAVObjects: Removed templates from UAVObjectFieldPrimitives and implemented as regular classes
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@434 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
7b13493efd
commit
5bf7b07437
@ -41,6 +41,10 @@ UAVObjectParser::UAVObjectParser()
|
||||
QString( "quint8") << QString("quint16") << QString("quint32") <<
|
||||
QString("float") << QString("quint8");
|
||||
|
||||
fieldTypeStrCPPClass << QString("Int8") << QString("Int16") << QString("Int32") <<
|
||||
QString( "UInt8") << QString("UInt16") << QString("UInt32") <<
|
||||
QString("Float") << QString("Enum");
|
||||
|
||||
fieldTypeStrXML << QString("int8") << QString("int16") << QString("int32") <<
|
||||
QString("uint8") << QString("uint16") << QString("uint32") <<
|
||||
QString("float") << QString("enum");
|
||||
@ -640,8 +644,8 @@ bool UAVObjectParser::generateGCSObject(int objIndex, const QString& templateInc
|
||||
}
|
||||
else
|
||||
{
|
||||
finit.append( QString(" fields.append(new UAVObjectFieldPrimitives<%1>(QString(\"%2\"), QString(\"%3\"), %4));\n")
|
||||
.arg(fieldTypeStrCPP[info->fields[n]->type])
|
||||
finit.append( QString(" fields.append(new UAVObjectField%1(QString(\"%2\"), QString(\"%3\"), %4));\n")
|
||||
.arg(fieldTypeStrCPPClass[info->fields[n]->type])
|
||||
.arg(info->fields[n]->name)
|
||||
.arg(info->fields[n]->units)
|
||||
.arg(info->fields[n]->numElements) );
|
||||
|
@ -100,6 +100,7 @@ private:
|
||||
QString filename;
|
||||
QStringList fieldTypeStrC;
|
||||
QStringList fieldTypeStrCPP;
|
||||
QStringList fieldTypeStrCPPClass;
|
||||
QStringList fieldTypeStrXML;
|
||||
QStringList updateModeStr;
|
||||
QStringList updateModeStrXML;
|
||||
|
@ -29,6 +29,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "exampleobject1.h"
|
||||
#include "uavobjectfields.h"
|
||||
|
||||
const QString ExampleObject1::NAME = QString("ExampleObject1");
|
||||
|
||||
@ -36,13 +37,13 @@ ExampleObject1::ExampleObject1(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS,
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("Field1"), QString("unit1"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint16>(QString("Field2"), QString("unit2"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("Field3"), QString("unit3"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<float>(QString("Field4"), QString("unit4"), 4));
|
||||
fields.append(new UAVObjectFieldPrimitives<quint8>(QString("Field5"), QString("unit5"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<quint16>(QString("Field6"), QString("unit6"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<quint32>(QString("Field7"), QString("unit7"), 1));
|
||||
fields.append(new UAVObjectFieldInt8(QString("Field1"), QString("unit1"), 1));
|
||||
fields.append(new UAVObjectFieldInt16(QString("Field2"), QString("unit2"), 1));
|
||||
fields.append(new UAVObjectFieldInt32(QString("Field3"), QString("unit3"), 1));
|
||||
fields.append(new UAVObjectFieldFloat(QString("Field4"), QString("unit4"), 4));
|
||||
fields.append(new UAVObjectFieldUInt8(QString("Field5"), QString("unit5"), 1));
|
||||
fields.append(new UAVObjectFieldUInt16(QString("Field6"), QString("unit6"), 1));
|
||||
fields.append(new UAVObjectFieldUInt32(QString("Field7"), QString("unit7"), 1));
|
||||
QStringList Field8EnumOptions;
|
||||
Field8EnumOptions.append("Option1");
|
||||
Field8EnumOptions.append("Option2");
|
||||
|
@ -32,8 +32,6 @@
|
||||
#define EXAMPLEOBJECT1_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfieldenum.h"
|
||||
|
||||
class ExampleObject1: public UAVDataObject
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "exampleobject2.h"
|
||||
#include "uavobjectfields.h"
|
||||
|
||||
const QString ExampleObject2::NAME = QString("ExampleObject2");
|
||||
|
||||
@ -36,10 +37,10 @@ ExampleObject2::ExampleObject2(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS,
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("Field1"), QString("unit1"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint16>(QString("Field2"), QString("unit2"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("Field3"), QString("unit3"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<float>(QString("Field4"), QString("unit4"), 4));
|
||||
fields.append(new UAVObjectFieldInt8(QString("Field1"), QString("unit1"), 1));
|
||||
fields.append(new UAVObjectFieldInt16(QString("Field2"), QString("unit2"), 1));
|
||||
fields.append(new UAVObjectFieldInt32(QString("Field3"), QString("unit3"), 1));
|
||||
fields.append(new UAVObjectFieldFloat(QString("Field4"), QString("unit4"), 4));
|
||||
|
||||
// Initialize object
|
||||
initializeFields(fields, (quint8*)&data, NUMBYTES);
|
||||
|
@ -32,8 +32,6 @@
|
||||
#define EXAMPLEOBJECT2_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfieldenum.h"
|
||||
|
||||
class ExampleObject2: public UAVDataObject
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "examplesettings.h"
|
||||
#include "uavobjectfields.h"
|
||||
|
||||
const QString ExampleSettings::NAME = QString("ExampleSettings");
|
||||
|
||||
@ -36,8 +37,8 @@ ExampleSettings::ExampleSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTING
|
||||
{
|
||||
// Create fields
|
||||
QList<UAVObjectField*> fields;
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("UpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("StepSize"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldInt32(QString("UpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldInt32(QString("StepSize"), QString(""), 1));
|
||||
QStringList StepDirectionEnumOptions;
|
||||
StepDirectionEnumOptions.append("up");
|
||||
StepDirectionEnumOptions.append("down");
|
||||
|
@ -32,8 +32,6 @@
|
||||
#define EXAMPLESETTINGS_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfieldenum.h"
|
||||
|
||||
class ExampleSettings: public UAVDataObject
|
||||
{
|
||||
|
@ -125,7 +125,7 @@ void UAVObjectsTest::runTest()
|
||||
UAVObject* obj = objMngr->getObject(objname);
|
||||
QList<UAVObjectField*> fields = obj->getFields();
|
||||
// qint8
|
||||
UAVObjectFieldPrimitives<qint8>* fieldint8 = dynamic_cast< UAVObjectFieldPrimitives<qint8>* >(fields[0]);
|
||||
UAVObjectFieldInt8* fieldint8 = dynamic_cast< UAVObjectFieldInt8* >(fields[0]);
|
||||
if (fieldint8 != NULL)
|
||||
{
|
||||
fieldint8->setValue(10);
|
||||
|
@ -13,17 +13,30 @@ SOURCES += main.cpp \
|
||||
../uavmetaobject.cpp \
|
||||
../uavdataobject.cpp \
|
||||
uavobjectstest.cpp \
|
||||
../uavobjectfieldprimitives.cpp \
|
||||
../uavobjectfieldenum.cpp \
|
||||
../uavobjectfieldstring.cpp \
|
||||
../exampleobject1.cpp
|
||||
../exampleobject1.cpp \
|
||||
../uavobjectfielduint32.cpp \
|
||||
../uavobjectfielduint16.cpp \
|
||||
../uavobjectfielduint8.cpp \
|
||||
../uavobjectfieldint32.cpp \
|
||||
../uavobjectfieldint16.cpp \
|
||||
../uavobjectfieldint8.cpp \
|
||||
../uavobjectfieldfloat.cpp
|
||||
HEADERS += ../uavobjectmanager.h \
|
||||
../uavobjectfield.h \
|
||||
../uavobject.h \
|
||||
../uavmetaobject.h \
|
||||
../uavdataobject.h \
|
||||
uavobjectstest.h \
|
||||
../uavobjectfieldprimitives.h \
|
||||
../uavobjectfieldenum.h \
|
||||
../uavobjectfieldstring.h \
|
||||
../exampleobject1.h
|
||||
../exampleobject1.h \
|
||||
../uavobjectfielduint32.h \
|
||||
../uavobjectfielduint16.h \
|
||||
../uavobjectfielduint8.h \
|
||||
../uavobjectfields.h \
|
||||
../uavobjectfieldint32.h \
|
||||
../uavobjectfieldint16.h \
|
||||
../uavobjectfieldint8.h \
|
||||
../uavobjectfieldfloat.h
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobject.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include "uavobjectfields.h"
|
||||
#include "uavmetaobject.h"
|
||||
#include <QList>
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "uavmetaobject.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfields.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -46,14 +46,14 @@ UAVMetaObject::UAVMetaObject(quint32 objID, const QString& name, UAVObject* pare
|
||||
ownMetadata.loggingUpdatePeriod = 0;
|
||||
// Setup fields
|
||||
QList<UAVObjectField*> fields;
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("FlightTelemetryAcked"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("FlightTelemetryUpdateMode"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("FlightTelemetryUpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("GCSTelemetryAcked"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("GCSTelemetryUpdateMode"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("GCSTelemetryUpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint8>(QString("LoggingUpdateMode"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldPrimitives<qint32>(QString("LoggingUpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldUInt8(QString("FlightTelemetryAcked"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldUInt8(QString("FlightTelemetryUpdateMode"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldInt32(QString("FlightTelemetryUpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldUInt8(QString("GCSTelemetryAcked"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldUInt8(QString("GCSTelemetryUpdateMode"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldInt32(QString("GCSTelemetryUpdatePeriod"), QString("ms"), 1));
|
||||
fields.append(new UAVObjectFieldUInt8(QString("LoggingUpdateMode"), QString(""), 1));
|
||||
fields.append(new UAVObjectFieldUInt32(QString("LoggingUpdatePeriod"), QString("ms"), 1));
|
||||
// Initialize parent
|
||||
UAVObject::initialize(0);
|
||||
UAVObject::initializeFields(fields, (quint8*)&parentMetadata, sizeof(Metadata));
|
||||
|
@ -27,10 +27,12 @@
|
||||
*/
|
||||
|
||||
#include "uavobjectfieldenum.h"
|
||||
#include <QtEndian>
|
||||
|
||||
UAVObjectFieldEnum::UAVObjectFieldEnum(const QString& name, const QString& units, quint32 numElements, QStringList& options):
|
||||
UAVObjectFieldPrimitives<quint8>(name, units, numElements)
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(quint8);
|
||||
this->options = options;
|
||||
}
|
||||
|
||||
@ -67,3 +69,124 @@ void UAVObjectFieldEnum::setSelectedIndex(quint8 index)
|
||||
setValue(index);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldEnum::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldEnum::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldEnum::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldEnum::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldEnum::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 tmpValue;
|
||||
tmpValue = (quint8)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldEnum::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
quint8 UAVObjectFieldEnum::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldEnum::setValue(quint8 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,16 @@
|
||||
#define UAVOBJECTFIELDENUM_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QStringList>
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldEnum: public UAVObjectFieldPrimitives<quint8>
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldEnum: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldEnum(const QString& name, const QString& units, quint32 numElements, QStringList& options);
|
||||
QStringList getOptions();
|
||||
@ -41,9 +46,19 @@ public:
|
||||
void setSelected(QString& val);
|
||||
quint8 getSelectedIndex();
|
||||
void setSelectedIndex(quint8 index);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
QStringList options;
|
||||
|
||||
quint8 getValue(quint32 index = 0);
|
||||
void setValue(quint8 value, quint32 index = 0);
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDENUM_H
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfield.cpp
|
||||
* @file uavobjectfieldfloat.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
@ -25,20 +25,21 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfieldfloat.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
template <typename FType>
|
||||
UAVObjectFieldPrimitives<FType>::UAVObjectFieldPrimitives(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectFieldFloat::UAVObjectFieldFloat(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(FType);
|
||||
numBytesPerElement = sizeof(float);
|
||||
}
|
||||
|
||||
template <typename FType>
|
||||
void UAVObjectFieldPrimitives<FType>::initializeValues()
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldFloat::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
@ -49,16 +50,15 @@ void UAVObjectFieldPrimitives<FType>::initializeValues()
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
template <typename FType>
|
||||
qint32 UAVObjectFieldPrimitives<FType>::pack(quint8* dataOut)
|
||||
qint32 UAVObjectFieldFloat::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
FType value;
|
||||
quint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
qToBigEndian<FType>(value, &dataOut[numBytesPerElement*index]);
|
||||
qToBigEndian<quint32>(value, &dataOut[numBytesPerElement*index]);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
@ -67,15 +67,14 @@ qint32 UAVObjectFieldPrimitives<FType>::pack(quint8* dataOut)
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
template <typename FType>
|
||||
qint32 UAVObjectFieldPrimitives<FType>::unpack(const quint8* dataIn)
|
||||
qint32 UAVObjectFieldFloat::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
FType value;
|
||||
value = qFromBigEndian<FType>(&dataIn[numBytesPerElement*index]);
|
||||
quint32 value;
|
||||
value = qFromBigEndian<quint32>(&dataIn[numBytesPerElement*index]);
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
// Done
|
||||
@ -85,15 +84,14 @@ qint32 UAVObjectFieldPrimitives<FType>::unpack(const quint8* dataIn)
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
template <typename FType>
|
||||
double UAVObjectFieldPrimitives<FType>::getDouble(quint32 index)
|
||||
double UAVObjectFieldFloat::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
FType value;
|
||||
float value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
@ -104,15 +102,14 @@ double UAVObjectFieldPrimitives<FType>::getDouble(quint32 index)
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
template <typename FType>
|
||||
void UAVObjectFieldPrimitives<FType>::setDouble(double value, quint32 index)
|
||||
void UAVObjectFieldFloat::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
FType tmpValue;
|
||||
tmpValue = (FType)value;
|
||||
float tmpValue;
|
||||
tmpValue = (float)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
@ -123,8 +120,7 @@ void UAVObjectFieldPrimitives<FType>::setDouble(double value, quint32 index)
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
template <typename FType>
|
||||
quint32 UAVObjectFieldPrimitives<FType>::getNumBytesElement()
|
||||
quint32 UAVObjectFieldFloat::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
@ -132,14 +128,13 @@ quint32 UAVObjectFieldPrimitives<FType>::getNumBytesElement()
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
template <typename FType>
|
||||
FType UAVObjectFieldPrimitives<FType>::getValue(quint32 index)
|
||||
float UAVObjectFieldFloat::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
FType value;
|
||||
float value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
@ -152,8 +147,7 @@ FType UAVObjectFieldPrimitives<FType>::getValue(quint32 index)
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
template <typename FType>
|
||||
void UAVObjectFieldPrimitives<FType>::setValue(FType value, quint32 index)
|
||||
void UAVObjectFieldFloat::setValue(float value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
@ -166,16 +160,6 @@ void UAVObjectFieldPrimitives<FType>::setValue(FType value, quint32 index)
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre-define valid templates
|
||||
*/
|
||||
template class UAVObjectFieldPrimitives<qint8>;
|
||||
template class UAVObjectFieldPrimitives<qint16>;
|
||||
template class UAVObjectFieldPrimitives<qint32>;
|
||||
template class UAVObjectFieldPrimitives<quint8>;
|
||||
template class UAVObjectFieldPrimitives<quint16>;
|
||||
template class UAVObjectFieldPrimitives<quint32>;
|
||||
template class UAVObjectFieldPrimitives<float>;
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldprimitives.h
|
||||
* @file uavobjectfieldfloat.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
@ -25,70 +25,33 @@
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDPRIMITIVES_H
|
||||
#define UAVOBJECTFIELDPRIMITIVES_H
|
||||
#ifndef UAVOBJECTFIELDFLOAT_H
|
||||
#define UAVOBJECTFIELDFLOAT_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
template <typename FType>
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldPrimitives: public UAVObjectField
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldFloat: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldPrimitives(const QString& name, const QString& units, quint32 numElements);
|
||||
UAVObjectFieldFloat(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
FType getValue(quint32 index = 0);
|
||||
void setValue(FType value, quint32 index = 0);
|
||||
float getValue(quint32 index = 0);
|
||||
void setValue(float value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of missing QtEndian templates
|
||||
*/
|
||||
template<> inline qint8 qFromBigEndian<qint8>(const uchar *src)
|
||||
{
|
||||
return *src;
|
||||
}
|
||||
|
||||
template <> inline void qToBigEndian<qint8>(qint8 src, uchar *dest)
|
||||
{
|
||||
*dest = src;
|
||||
}
|
||||
|
||||
template<> inline quint8 qFromBigEndian<quint8>(const uchar *src)
|
||||
{
|
||||
return *src;
|
||||
}
|
||||
|
||||
template <> inline void qToBigEndian<quint8>(quint8 src, uchar *dest)
|
||||
{
|
||||
*dest = src;
|
||||
}
|
||||
|
||||
template<> inline float qFromBigEndian<float>(const uchar *src)
|
||||
{
|
||||
quint32 tmpint;
|
||||
float tmpfloat;
|
||||
tmpint = qFromBigEndian<quint32>(src);
|
||||
memcpy(&tmpfloat, &tmpint, sizeof(quint32));
|
||||
return tmpfloat;
|
||||
}
|
||||
|
||||
template <> inline void qToBigEndian<float>(float src, uchar *dest)
|
||||
{
|
||||
quint32 tmpint;
|
||||
memcpy(&tmpint, &src, sizeof(quint32));
|
||||
qToBigEndian<quint32>(tmpint, dest);
|
||||
}
|
||||
|
||||
|
||||
#endif // UAVOBJECTFIELDPRIMITIVES_H
|
||||
#endif // UAVOBJECTFIELDFLOAT_H
|
165
ground/src/plugins/uavobjects/uavobjectfieldint16.cpp
Normal file
165
ground/src/plugins/uavobjects/uavobjectfieldint16.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldint16.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "uavobjectfieldint16.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UAVObjectFieldInt16::UAVObjectFieldInt16(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(qint16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldInt16::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt16::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
qint16 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
qToBigEndian<qint16>(value, &dataOut[numBytesPerElement*index]);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt16::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
qint16 value;
|
||||
value = qFromBigEndian<qint16>(&dataIn[numBytesPerElement*index]);
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldInt16::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint16 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldInt16::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint16 tmpValue;
|
||||
tmpValue = (qint16)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldInt16::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
qint16 UAVObjectFieldInt16::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint16 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldInt16::setValue(qint16 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
ground/src/plugins/uavobjects/uavobjectfieldint16.h
Normal file
57
ground/src/plugins/uavobjects/uavobjectfieldint16.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldint16.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDINT16_H
|
||||
#define UAVOBJECTFIELDINT16_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldInt16: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldInt16(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
qint16 getValue(quint32 index = 0);
|
||||
void setValue(qint16 value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDINT16_H
|
165
ground/src/plugins/uavobjects/uavobjectfieldint32.cpp
Normal file
165
ground/src/plugins/uavobjects/uavobjectfieldint32.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldint32.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "uavobjectfieldint32.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UAVObjectFieldInt32::UAVObjectFieldInt32(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(qint32);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldInt32::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt32::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
qint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
qToBigEndian<qint32>(value, &dataOut[numBytesPerElement*index]);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt32::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
qint32 value;
|
||||
value = qFromBigEndian<qint32>(&dataIn[numBytesPerElement*index]);
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldInt32::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldInt32::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint32 tmpValue;
|
||||
tmpValue = (qint32)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldInt32::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt32::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldInt32::setValue(qint32 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
55
ground/src/plugins/uavobjects/uavobjectfieldint32.h
Normal file
55
ground/src/plugins/uavobjects/uavobjectfieldint32.h
Normal file
@ -0,0 +1,55 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldint32.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDINT32_H
|
||||
#define UAVOBJECTFIELDINT32_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldInt32: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldInt32(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
qint32 getValue(quint32 index = 0);
|
||||
void setValue(qint32 value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDINT32_H
|
161
ground/src/plugins/uavobjects/uavobjectfieldint8.cpp
Normal file
161
ground/src/plugins/uavobjects/uavobjectfieldint8.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldint8.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "uavobjectfieldint8.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UAVObjectFieldInt8::UAVObjectFieldInt8(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(qint8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldInt8::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt8::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldInt8::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldInt8::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldInt8::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint8 tmpValue;
|
||||
tmpValue = (qint8)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldInt8::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
qint8 UAVObjectFieldInt8::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
qint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldInt8::setValue(qint8 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
ground/src/plugins/uavobjects/uavobjectfieldint8.h
Normal file
57
ground/src/plugins/uavobjects/uavobjectfieldint8.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfieldint8.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDINT8_H
|
||||
#define UAVOBJECTFIELDINT8_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldInt8: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldInt8(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
qint8 getValue(quint32 index = 0);
|
||||
void setValue(qint8 value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDINT8_H
|
41
ground/src/plugins/uavobjects/uavobjectfields.h
Normal file
41
ground/src/plugins/uavobjects/uavobjectfields.h
Normal file
@ -0,0 +1,41 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfields.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDS_H
|
||||
#define UAVOBJECTFIELDS_H
|
||||
|
||||
#include "uavobjectfieldint8.h"
|
||||
#include "uavobjectfieldint16.h"
|
||||
#include "uavobjectfieldint32.h"
|
||||
#include "uavobjectfielduint8.h"
|
||||
#include "uavobjectfielduint16.h"
|
||||
#include "uavobjectfielduint32.h"
|
||||
#include "uavobjectfieldfloat.h"
|
||||
#include "uavobjectfieldenum.h"
|
||||
#include "uavobjectfieldstring.h"
|
||||
|
||||
#endif // UAVOBJECTFIELDS_H
|
@ -27,10 +27,12 @@
|
||||
*/
|
||||
|
||||
#include "uavobjectfieldstring.h"
|
||||
#include <QtEndian>
|
||||
|
||||
UAVObjectFieldString::UAVObjectFieldString(const QString& name, quint32 maxSize):
|
||||
UAVObjectFieldPrimitives<quint8>(name, QString(""), maxSize)
|
||||
UAVObjectField(name, QString(""), maxSize)
|
||||
{
|
||||
numBytesPerElement = sizeof(quint8);
|
||||
}
|
||||
|
||||
QString UAVObjectFieldString::getString()
|
||||
@ -73,3 +75,124 @@ void UAVObjectFieldString::setString(QString& str)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldString::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldString::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldString::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldString::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldString::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 tmpValue;
|
||||
tmpValue = (quint8)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldString::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
quint8 UAVObjectFieldString::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldString::setValue(quint8 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,16 +29,31 @@
|
||||
#define UAVOBJECTFIELDSTRING_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QStringList>
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldString: public UAVObjectFieldPrimitives<quint8>
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldString: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldString(const QString& name, quint32 maxSize);
|
||||
QString getString();
|
||||
void setString(QString& str);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
|
||||
quint8 getValue(quint32 index = 0);
|
||||
void setValue(quint8 value, quint32 index = 0);
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDSTRING_H
|
||||
|
165
ground/src/plugins/uavobjects/uavobjectfielduint16.cpp
Normal file
165
ground/src/plugins/uavobjects/uavobjectfielduint16.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfielduint16.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "uavobjectfielduint16.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UAVObjectFieldUInt16::UAVObjectFieldUInt16(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(quint16);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldUInt16::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldUInt16::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
quint16 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
qToBigEndian<quint16>(value, &dataOut[numBytesPerElement*index]);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldUInt16::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
quint16 value;
|
||||
value = qFromBigEndian<quint16>(&dataIn[numBytesPerElement*index]);
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldUInt16::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint16 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldUInt16::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint16 tmpValue;
|
||||
tmpValue = (quint16)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldUInt16::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
quint16 UAVObjectFieldUInt16::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint16 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldUInt16::setValue(quint16 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
ground/src/plugins/uavobjects/uavobjectfielduint16.h
Normal file
57
ground/src/plugins/uavobjects/uavobjectfielduint16.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfielduint16.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDUINT16_H
|
||||
#define UAVOBJECTFIELDUINT16_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldUInt16: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldUInt16(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
quint16 getValue(quint32 index = 0);
|
||||
void setValue(quint16 value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDUINT16_H
|
165
ground/src/plugins/uavobjects/uavobjectfielduint32.cpp
Normal file
165
ground/src/plugins/uavobjects/uavobjectfielduint32.cpp
Normal file
@ -0,0 +1,165 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfielduint32.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "uavobjectfielduint32.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UAVObjectFieldUInt32::UAVObjectFieldUInt32(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(quint32);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldUInt32::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldUInt32::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
quint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
qToBigEndian<quint32>(value, &dataOut[numBytesPerElement*index]);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldUInt32::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
quint32 value;
|
||||
value = qFromBigEndian<quint32>(&dataIn[numBytesPerElement*index]);
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldUInt32::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldUInt32::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint32 tmpValue;
|
||||
tmpValue = (quint32)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldUInt32::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
quint32 UAVObjectFieldUInt32::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint32 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldUInt32::setValue(quint32 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
ground/src/plugins/uavobjects/uavobjectfielduint32.h
Normal file
57
ground/src/plugins/uavobjects/uavobjectfielduint32.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfielduint32.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDUINT32_H
|
||||
#define UAVOBJECTFIELDUINT32_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldUInt32: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldUInt32(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
quint32 getValue(quint32 index = 0);
|
||||
void setValue(quint32 value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDUINT32_H
|
161
ground/src/plugins/uavobjects/uavobjectfielduint8.cpp
Normal file
161
ground/src/plugins/uavobjects/uavobjectfielduint8.cpp
Normal file
@ -0,0 +1,161 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfielduint8.cpp
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#include "uavobjectfielduint8.h"
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
UAVObjectFieldUInt8::UAVObjectFieldUInt8(const QString& name, const QString& units, quint32 numElements):
|
||||
UAVObjectField(name, units, numElements)
|
||||
{
|
||||
numBytesPerElement = sizeof(quint8);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize all values
|
||||
*/
|
||||
void UAVObjectFieldUInt8::initializeValues()
|
||||
{
|
||||
for (quint32 n = 0; n < numElements; ++n)
|
||||
{
|
||||
setValue(0, n);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Pack the field in to an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldUInt8::pack(quint8* dataOut)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
dataOut[numBytesPerElement*index] = data[offset + numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpack the field from an array of bytes.
|
||||
*/
|
||||
qint32 UAVObjectFieldUInt8::unpack(const quint8* dataIn)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Pack each element in output buffer
|
||||
for (quint32 index = 0; index < numElements; ++index)
|
||||
{
|
||||
data[offset + numBytesPerElement*index] = dataIn[numBytesPerElement*index];
|
||||
}
|
||||
// Done
|
||||
return getNumBytes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value as a double.
|
||||
*/
|
||||
double UAVObjectFieldUInt8::getDouble(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
double ret = 0.0;
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
ret = (double)value;
|
||||
}
|
||||
// Done
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value from a double.
|
||||
*/
|
||||
void UAVObjectFieldUInt8::setDouble(double value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 tmpValue;
|
||||
tmpValue = (quint8)value;
|
||||
memcpy(&data[offset + numBytesPerElement*index], &tmpValue, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of bytes per field element.
|
||||
*/
|
||||
quint32 UAVObjectFieldUInt8::getNumBytesElement()
|
||||
{
|
||||
return numBytesPerElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field value.
|
||||
*/
|
||||
quint8 UAVObjectFieldUInt8::getValue(quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
quint8 value;
|
||||
memcpy(&value, &data[offset + numBytesPerElement*index], numBytesPerElement);
|
||||
return value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the field value.
|
||||
*/
|
||||
void UAVObjectFieldUInt8::setValue(quint8 value, quint32 index)
|
||||
{
|
||||
QMutexLocker locker(obj->getMutex());
|
||||
// Check if index is out of bounds or no data available
|
||||
if (index < numElements && data != NULL)
|
||||
{
|
||||
memcpy(&data[offset + numBytesPerElement*index], &value, numBytesPerElement);
|
||||
}
|
||||
|
||||
// Emit updated event
|
||||
emit fieldUpdated(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
57
ground/src/plugins/uavobjects/uavobjectfielduint8.h
Normal file
57
ground/src/plugins/uavobjects/uavobjectfielduint8.h
Normal file
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file uavobjectfielduint8.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
||||
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
||||
* @brief
|
||||
* @see The GNU Public License (GPL) Version 3
|
||||
* @defgroup uavobjects_plugin
|
||||
* @{
|
||||
*
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
#ifndef UAVOBJECTFIELDUINT8_H
|
||||
#define UAVOBJECTFIELDUINT8_H
|
||||
|
||||
#include "uavobjects_global.h"
|
||||
#include "uavobjectfield.h"
|
||||
#include <QtEndian>
|
||||
|
||||
// Note: This class could be implemented as a template but due to limitations of the Qt
|
||||
// plugins it not possible.
|
||||
|
||||
class UAVOBJECTS_EXPORT UAVObjectFieldUInt8: public UAVObjectField
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
UAVObjectFieldUInt8(const QString& name, const QString& units, quint32 numElements);
|
||||
void initializeValues();
|
||||
qint32 pack(quint8* dataOut);
|
||||
qint32 unpack(const quint8* dataIn);
|
||||
double getDouble(quint32 index = 0);
|
||||
void setDouble(double value, quint32 index = 0);
|
||||
quint32 getNumBytesElement();
|
||||
quint8 getValue(quint32 index = 0);
|
||||
void setValue(quint8 value, quint32 index = 0);
|
||||
|
||||
private:
|
||||
quint32 numBytesPerElement;
|
||||
};
|
||||
|
||||
#endif // UAVOBJECTFIELDUINT8_H
|
@ -11,11 +11,18 @@ HEADERS += uavobjects_global.h \
|
||||
uavobjectsinit.h \
|
||||
uavobjectsplugin.h \
|
||||
examplesettings.h \
|
||||
uavobjectfieldprimitives.h \
|
||||
uavobjectfieldenum.h \
|
||||
uavobjectfieldstring.h \
|
||||
exampleobject2.h \
|
||||
exampleobject1.h
|
||||
exampleobject1.h \
|
||||
uavobjectfieldint8.h \
|
||||
uavobjectfieldint16.h \
|
||||
uavobjectfieldint32.h \
|
||||
uavobjectfieldfloat.h \
|
||||
uavobjectfielduint8.h \
|
||||
uavobjectfielduint16.h \
|
||||
uavobjectfielduint32.h \
|
||||
uavobjectfields.h
|
||||
SOURCES += uavobject.cpp \
|
||||
uavmetaobject.cpp \
|
||||
uavobjectmanager.cpp \
|
||||
@ -24,10 +31,16 @@ SOURCES += uavobject.cpp \
|
||||
uavobjectsinit.cpp \
|
||||
uavobjectsplugin.cpp \
|
||||
examplesettings.cpp \
|
||||
uavobjectfieldprimitives.cpp \
|
||||
uavobjectfieldenum.cpp \
|
||||
uavobjectfieldstring.cpp \
|
||||
exampleobject2.cpp \
|
||||
exampleobject1.cpp
|
||||
exampleobject1.cpp \
|
||||
uavobjectfieldint8.cpp \
|
||||
uavobjectfieldint16.cpp \
|
||||
uavobjectfieldint32.cpp \
|
||||
uavobjectfieldfloat.cpp \
|
||||
uavobjectfielduint8.cpp \
|
||||
uavobjectfielduint16.cpp \
|
||||
uavobjectfielduint32.cpp
|
||||
DEFINES += UAVOBJECTS_LIBRARY
|
||||
OTHER_FILES += UAVObjects.pluginspec
|
||||
|
@ -29,6 +29,7 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "$(NAMELC).h"
|
||||
#include "uavobjectfields.h"
|
||||
|
||||
const QString $(NAME)::NAME = QString("$(NAME)");
|
||||
|
||||
|
@ -32,8 +32,6 @@
|
||||
#define $(NAMEUC)_H
|
||||
|
||||
#include "uavdataobject.h"
|
||||
#include "uavobjectfieldprimitives.h"
|
||||
#include "uavobjectfieldenum.h"
|
||||
|
||||
class $(NAME): public UAVDataObject
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user