From 2426606a8bafea9c66a7f17a5a84e11e632859a0 Mon Sep 17 00:00:00 2001 From: edouard Date: Wed, 6 Oct 2010 21:51:58 +0000 Subject: [PATCH] Remove example objects from GCS code and XML definitions, those are not useful anymore, the system is mature enough by now! git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1906 ebee16cc-31ac-478f-84a7-5cbb03baadba --- .../src/plugins/uavobjects/exampleobject1.cpp | 155 ----------------- .../src/plugins/uavobjects/exampleobject1.h | 96 ----------- .../src/plugins/uavobjects/exampleobject1.py | 161 ------------------ .../src/plugins/uavobjects/exampleobject2.cpp | 140 --------------- .../src/plugins/uavobjects/exampleobject2.h | 86 ---------- .../src/plugins/uavobjects/exampleobject2.py | 119 ------------- .../plugins/uavobjects/examplesettings.cpp | 140 --------------- .../src/plugins/uavobjects/examplesettings.h | 84 --------- .../src/plugins/uavobjects/examplesettings.py | 108 ------------ .../uavobjectdefinition/exampleobject1.xml | 17 -- .../uavobjectdefinition/exampleobject2.xml | 13 -- .../uavobjectdefinition/examplesettings.xml | 12 -- 12 files changed, 1131 deletions(-) delete mode 100644 ground/src/plugins/uavobjects/exampleobject1.cpp delete mode 100644 ground/src/plugins/uavobjects/exampleobject1.h delete mode 100644 ground/src/plugins/uavobjects/exampleobject1.py delete mode 100644 ground/src/plugins/uavobjects/exampleobject2.cpp delete mode 100644 ground/src/plugins/uavobjects/exampleobject2.h delete mode 100644 ground/src/plugins/uavobjects/exampleobject2.py delete mode 100644 ground/src/plugins/uavobjects/examplesettings.cpp delete mode 100644 ground/src/plugins/uavobjects/examplesettings.h delete mode 100644 ground/src/plugins/uavobjects/examplesettings.py delete mode 100644 ground/src/shared/uavobjectdefinition/exampleobject1.xml delete mode 100644 ground/src/shared/uavobjectdefinition/exampleobject2.xml delete mode 100644 ground/src/shared/uavobjectdefinition/examplesettings.xml diff --git a/ground/src/plugins/uavobjects/exampleobject1.cpp b/ground/src/plugins/uavobjects/exampleobject1.cpp deleted file mode 100644 index 16458ccd0..000000000 --- a/ground/src/plugins/uavobjects/exampleobject1.cpp +++ /dev/null @@ -1,155 +0,0 @@ -/** - ****************************************************************************** - * - * @file exampleobject1.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup UAVObjectsPlugin UAVObjects Plugin - * @{ - * - * @note Object definition file: exampleobject1.xml. - * This is an automatically generated file. - * DO NOT modify manually. - * - * @brief The UAVUObjects GCS 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 "exampleobject1.h" -#include "uavobjectfield.h" - -const QString ExampleObject1::NAME = QString("ExampleObject1"); - -/** - * Constructor - */ -ExampleObject1::ExampleObject1(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList Field1ElemNames; - Field1ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field1"), QString("unit1"), UAVObjectField::INT8, Field1ElemNames, QStringList()) ); - QStringList Field2ElemNames; - Field2ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field2"), QString("unit2"), UAVObjectField::INT16, Field2ElemNames, QStringList()) ); - QStringList Field3ElemNames; - Field3ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field3"), QString("unit3"), UAVObjectField::INT32, Field3ElemNames, QStringList()) ); - QStringList Field4ElemNames; - Field4ElemNames.append("0"); - Field4ElemNames.append("1"); - Field4ElemNames.append("2"); - Field4ElemNames.append("3"); - fields.append( new UAVObjectField(QString("Field4"), QString("unit4"), UAVObjectField::FLOAT32, Field4ElemNames, QStringList()) ); - QStringList Field5ElemNames; - Field5ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field5"), QString("unit5"), UAVObjectField::UINT8, Field5ElemNames, QStringList()) ); - QStringList Field6ElemNames; - Field6ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field6"), QString("unit6"), UAVObjectField::UINT16, Field6ElemNames, QStringList()) ); - QStringList Field7ElemNames; - Field7ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field7"), QString("unit7"), UAVObjectField::UINT32, Field7ElemNames, QStringList()) ); - QStringList Field8ElemNames; - Field8ElemNames.append("0"); - QStringList Field8EnumOptions; - Field8EnumOptions.append("Option1"); - Field8EnumOptions.append("Option2"); - fields.append( new UAVObjectField(QString("Field8"), QString("unit8"), UAVObjectField::ENUM, Field8ElemNames, Field8EnumOptions) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata ExampleObject1::getDefaultMetadata() -{ - UAVObject::Metadata metadata; - metadata.flightAccess = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.gcsTelemetryAcked = 1; - metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; - metadata.gcsTelemetryUpdatePeriod = 500; - metadata.flightTelemetryAcked = 1; - metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - metadata.flightTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER; - 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. - */ -void ExampleObject1::setDefaultFieldValues() -{ - -} - -/** - * Get the object data fields - */ -ExampleObject1::DataFields ExampleObject1::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void ExampleObject1::setData(const DataFields& data) -{ - QMutexLocker locker(mutex); - // Get metadata - Metadata mdata = getMetadata(); - // Update object if the access mode permits - if ( mdata.gcsAccess == ACCESS_READWRITE ) - { - this->data = data; - emit objectUpdatedAuto(this); // trigger object updated event - emit objectUpdated(this); - } -} - -/** - * 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. - */ -UAVDataObject* ExampleObject1::clone(quint32 instID) -{ - ExampleObject1* obj = new ExampleObject1(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -ExampleObject1* ExampleObject1::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(ExampleObject1::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/exampleobject1.h b/ground/src/plugins/uavobjects/exampleobject1.h deleted file mode 100644 index 7daea8857..000000000 --- a/ground/src/plugins/uavobjects/exampleobject1.h +++ /dev/null @@ -1,96 +0,0 @@ -/** - ****************************************************************************** - * - * @file exampleobject1.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup UAVObjectsPlugin UAVObjects Plugin - * @{ - * - * @note Object definition file: exampleobject1.xml. - * This is an automatically generated file. - * DO NOT modify manually. - * - * @brief The UAVUObjects GCS 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 EXAMPLEOBJECT1_H -#define EXAMPLEOBJECT1_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT ExampleObject1: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - qint8 Field1; - qint16 Field2; - qint32 Field3; - float Field4[4]; - quint8 Field5; - quint16 Field6; - quint32 Field7; - quint8 Field8; - - } __attribute__((packed)) DataFields; - - // Field information - // Field Field1 information - // Field Field2 information - // Field Field3 information - // Field Field4 information - /* Number of elements for field Field4 */ - static const quint32 FIELD4_NUMELEM = 4; - // Field Field5 information - // Field Field6 information - // Field Field7 information - // Field Field8 information - /* Enumeration options for field Field8 */ - typedef enum { FIELD8_OPTION1=0, FIELD8_OPTION2=1 } Field8Options; - - - // Constants - static const quint32 OBJID = 3852936276U; - static const QString NAME; - static const bool ISSINGLEINST = 0; - static const bool ISSETTINGS = 0; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - ExampleObject1(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static ExampleObject1* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // EXAMPLEOBJECT1_H diff --git a/ground/src/plugins/uavobjects/exampleobject1.py b/ground/src/plugins/uavobjects/exampleobject1.py deleted file mode 100644 index e1ea81b34..000000000 --- a/ground/src/plugins/uavobjects/exampleobject1.py +++ /dev/null @@ -1,161 +0,0 @@ -## -############################################################################## -# -# @file exampleobject1.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the ExampleObject1 object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: exampleobject1.xml. -# This is an automatically generated file. -# DO NOT modify manually. -# -# @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 -# - - -import uavobject - -import struct -from collections import namedtuple - -# This is a list of instances of the data fields contained in this object -_fields = [ \ - uavobject.UAVObjectField( - 'Field1', - 'b', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field2', - 'h', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field3', - 'i', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field4', - 'f', - 4, - [ - '0', - '1', - '2', - '3', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field5', - 'B', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field6', - 'H', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field7', - 'I', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field8', - 'b', - 1, - [ - '0', - ], - { - '0' : 'Option1', - '1' : 'Option2', - } - ), -] - - -class ExampleObject1(uavobject.UAVObject): - ## Object constants - OBJID = 3852936276 - NAME = "ExampleObject1" - METANAME = "ExampleObject1Meta" - ISSINGLEINST = 0 - ISSETTINGS = 0 - - def __init__(self): - uavobject.UAVObject.__init__(self, - self.OBJID, - self.NAME, - self.METANAME, - 0, - self.ISSINGLEINST) - - for f in _fields: - self.add_field(f) - - def __str__(self): - s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n" - % (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format)) - for f in self.get_tuple()._fields: - s += ("\t%s\n" % f) - return (s) - -def main(): - # Instantiate the object and dump out some interesting info - x = ExampleObject1() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/exampleobject2.cpp b/ground/src/plugins/uavobjects/exampleobject2.cpp deleted file mode 100644 index ab6b76cfe..000000000 --- a/ground/src/plugins/uavobjects/exampleobject2.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/** - ****************************************************************************** - * - * @file exampleobject2.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup UAVObjectsPlugin UAVObjects Plugin - * @{ - * - * @note Object definition file: exampleobject2.xml. - * This is an automatically generated file. - * DO NOT modify manually. - * - * @brief The UAVUObjects GCS 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 "exampleobject2.h" -#include "uavobjectfield.h" - -const QString ExampleObject2::NAME = QString("ExampleObject2"); - -/** - * Constructor - */ -ExampleObject2::ExampleObject2(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList Field1ElemNames; - Field1ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field1"), QString("unit1"), UAVObjectField::INT8, Field1ElemNames, QStringList()) ); - QStringList Field2ElemNames; - Field2ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field2"), QString("unit2"), UAVObjectField::INT16, Field2ElemNames, QStringList()) ); - QStringList Field3ElemNames; - Field3ElemNames.append("0"); - fields.append( new UAVObjectField(QString("Field3"), QString("unit3"), UAVObjectField::INT32, Field3ElemNames, QStringList()) ); - QStringList Field4ElemNames; - Field4ElemNames.append("0"); - Field4ElemNames.append("1"); - Field4ElemNames.append("2"); - Field4ElemNames.append("3"); - fields.append( new UAVObjectField(QString("Field4"), QString("unit4"), UAVObjectField::FLOAT32, Field4ElemNames, QStringList()) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata ExampleObject2::getDefaultMetadata() -{ - UAVObject::Metadata metadata; - metadata.flightAccess = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.gcsTelemetryAcked = 1; - metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.flightTelemetryAcked = 1; - metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC; - metadata.flightTelemetryUpdatePeriod = 500; - metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER; - 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. - */ -void ExampleObject2::setDefaultFieldValues() -{ - -} - -/** - * Get the object data fields - */ -ExampleObject2::DataFields ExampleObject2::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void ExampleObject2::setData(const DataFields& data) -{ - QMutexLocker locker(mutex); - // Get metadata - Metadata mdata = getMetadata(); - // Update object if the access mode permits - if ( mdata.gcsAccess == ACCESS_READWRITE ) - { - this->data = data; - emit objectUpdatedAuto(this); // trigger object updated event - emit objectUpdated(this); - } -} - -/** - * 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. - */ -UAVDataObject* ExampleObject2::clone(quint32 instID) -{ - ExampleObject2* obj = new ExampleObject2(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -ExampleObject2* ExampleObject2::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(ExampleObject2::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/exampleobject2.h b/ground/src/plugins/uavobjects/exampleobject2.h deleted file mode 100644 index 3c777a258..000000000 --- a/ground/src/plugins/uavobjects/exampleobject2.h +++ /dev/null @@ -1,86 +0,0 @@ -/** - ****************************************************************************** - * - * @file exampleobject2.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup UAVObjectsPlugin UAVObjects Plugin - * @{ - * - * @note Object definition file: exampleobject2.xml. - * This is an automatically generated file. - * DO NOT modify manually. - * - * @brief The UAVUObjects GCS 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 EXAMPLEOBJECT2_H -#define EXAMPLEOBJECT2_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT ExampleObject2: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - qint8 Field1; - qint16 Field2; - qint32 Field3; - float Field4[4]; - - } __attribute__((packed)) DataFields; - - // Field information - // Field Field1 information - // Field Field2 information - // Field Field3 information - // Field Field4 information - /* Number of elements for field Field4 */ - static const quint32 FIELD4_NUMELEM = 4; - - - // Constants - static const quint32 OBJID = 2743296914U; - static const QString NAME; - static const bool ISSINGLEINST = 0; - static const bool ISSETTINGS = 0; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - ExampleObject2(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static ExampleObject2* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // EXAMPLEOBJECT2_H diff --git a/ground/src/plugins/uavobjects/exampleobject2.py b/ground/src/plugins/uavobjects/exampleobject2.py deleted file mode 100644 index e7b6ea74f..000000000 --- a/ground/src/plugins/uavobjects/exampleobject2.py +++ /dev/null @@ -1,119 +0,0 @@ -## -############################################################################## -# -# @file exampleobject2.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the ExampleObject2 object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: exampleobject2.xml. -# This is an automatically generated file. -# DO NOT modify manually. -# -# @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 -# - - -import uavobject - -import struct -from collections import namedtuple - -# This is a list of instances of the data fields contained in this object -_fields = [ \ - uavobject.UAVObjectField( - 'Field1', - 'b', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field2', - 'h', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field3', - 'i', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'Field4', - 'f', - 4, - [ - '0', - '1', - '2', - '3', - ], - { - } - ), -] - - -class ExampleObject2(uavobject.UAVObject): - ## Object constants - OBJID = 2743296914 - NAME = "ExampleObject2" - METANAME = "ExampleObject2Meta" - ISSINGLEINST = 0 - ISSETTINGS = 0 - - def __init__(self): - uavobject.UAVObject.__init__(self, - self.OBJID, - self.NAME, - self.METANAME, - 0, - self.ISSINGLEINST) - - for f in _fields: - self.add_field(f) - - def __str__(self): - s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n" - % (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format)) - for f in self.get_tuple()._fields: - s += ("\t%s\n" % f) - return (s) - -def main(): - # Instantiate the object and dump out some interesting info - x = ExampleObject2() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/plugins/uavobjects/examplesettings.cpp b/ground/src/plugins/uavobjects/examplesettings.cpp deleted file mode 100644 index 851488a04..000000000 --- a/ground/src/plugins/uavobjects/examplesettings.cpp +++ /dev/null @@ -1,140 +0,0 @@ -/** - ****************************************************************************** - * - * @file examplesettings.cpp - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup UAVObjectsPlugin UAVObjects Plugin - * @{ - * - * @note Object definition file: examplesettings.xml. - * This is an automatically generated file. - * DO NOT modify manually. - * - * @brief The UAVUObjects GCS 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 "examplesettings.h" -#include "uavobjectfield.h" - -const QString ExampleSettings::NAME = QString("ExampleSettings"); - -/** - * Constructor - */ -ExampleSettings::ExampleSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME) -{ - // Create fields - QList fields; - QStringList UpdatePeriodElemNames; - UpdatePeriodElemNames.append("0"); - fields.append( new UAVObjectField(QString("UpdatePeriod"), QString("ms"), UAVObjectField::INT32, UpdatePeriodElemNames, QStringList()) ); - QStringList StepSizeElemNames; - StepSizeElemNames.append("0"); - fields.append( new UAVObjectField(QString("StepSize"), QString(""), UAVObjectField::INT32, StepSizeElemNames, QStringList()) ); - QStringList StepDirectionElemNames; - StepDirectionElemNames.append("0"); - QStringList StepDirectionEnumOptions; - StepDirectionEnumOptions.append("up"); - StepDirectionEnumOptions.append("down"); - fields.append( new UAVObjectField(QString("StepDirection"), QString(""), UAVObjectField::ENUM, StepDirectionElemNames, StepDirectionEnumOptions) ); - - // Initialize object - initializeFields(fields, (quint8*)&data, NUMBYTES); - // Set the default field values - setDefaultFieldValues(); -} - -/** - * Get the default metadata for this object - */ -UAVObject::Metadata ExampleSettings::getDefaultMetadata() -{ - UAVObject::Metadata metadata; - metadata.flightAccess = ACCESS_READWRITE; - metadata.gcsAccess = ACCESS_READWRITE; - metadata.gcsTelemetryAcked = 1; - metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - metadata.gcsTelemetryUpdatePeriod = 0; - metadata.flightTelemetryAcked = 1; - metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE; - metadata.flightTelemetryUpdatePeriod = 0; - metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER; - 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. - */ -void ExampleSettings::setDefaultFieldValues() -{ - data.UpdatePeriod = 10; - data.StepSize = 1; - data.StepDirection = 0; - -} - -/** - * Get the object data fields - */ -ExampleSettings::DataFields ExampleSettings::getData() -{ - QMutexLocker locker(mutex); - return data; -} - -/** - * Set the object data fields - */ -void ExampleSettings::setData(const DataFields& data) -{ - QMutexLocker locker(mutex); - // Get metadata - Metadata mdata = getMetadata(); - // Update object if the access mode permits - if ( mdata.gcsAccess == ACCESS_READWRITE ) - { - this->data = data; - emit objectUpdatedAuto(this); // trigger object updated event - emit objectUpdated(this); - } -} - -/** - * 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. - */ -UAVDataObject* ExampleSettings::clone(quint32 instID) -{ - ExampleSettings* obj = new ExampleSettings(); - obj->initialize(instID, this->getMetaObject()); - return obj; -} - -/** - * Static function to retrieve an instance of the object. - */ -ExampleSettings* ExampleSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID) -{ - return dynamic_cast(objMngr->getObject(ExampleSettings::OBJID, instID)); -} diff --git a/ground/src/plugins/uavobjects/examplesettings.h b/ground/src/plugins/uavobjects/examplesettings.h deleted file mode 100644 index 638e82d69..000000000 --- a/ground/src/plugins/uavobjects/examplesettings.h +++ /dev/null @@ -1,84 +0,0 @@ -/** - ****************************************************************************** - * - * @file examplesettings.h - * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. - * @see The GNU Public License (GPL) Version 3 - * @addtogroup GCSPlugins GCS Plugins - * @{ - * @addtogroup UAVObjectsPlugin UAVObjects Plugin - * @{ - * - * @note Object definition file: examplesettings.xml. - * This is an automatically generated file. - * DO NOT modify manually. - * - * @brief The UAVUObjects GCS 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 EXAMPLESETTINGS_H -#define EXAMPLESETTINGS_H - -#include "uavdataobject.h" -#include "uavobjectmanager.h" - -class UAVOBJECTS_EXPORT ExampleSettings: public UAVDataObject -{ - Q_OBJECT - -public: - // Field structure - typedef struct { - qint32 UpdatePeriod; - qint32 StepSize; - quint8 StepDirection; - - } __attribute__((packed)) DataFields; - - // Field information - // Field UpdatePeriod information - // Field StepSize information - // Field StepDirection information - /* Enumeration options for field StepDirection */ - typedef enum { STEPDIRECTION_UP=0, STEPDIRECTION_DOWN=1 } StepDirectionOptions; - - - // Constants - static const quint32 OBJID = 1640607828U; - static const QString NAME; - static const bool ISSINGLEINST = 1; - static const bool ISSETTINGS = 1; - static const quint32 NUMBYTES = sizeof(DataFields); - - // Functions - ExampleSettings(); - - DataFields getData(); - void setData(const DataFields& data); - Metadata getDefaultMetadata(); - UAVDataObject* clone(quint32 instID); - - static ExampleSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0); - -private: - DataFields data; - - void setDefaultFieldValues(); - -}; - -#endif // EXAMPLESETTINGS_H diff --git a/ground/src/plugins/uavobjects/examplesettings.py b/ground/src/plugins/uavobjects/examplesettings.py deleted file mode 100644 index 5d661c6da..000000000 --- a/ground/src/plugins/uavobjects/examplesettings.py +++ /dev/null @@ -1,108 +0,0 @@ -## -############################################################################## -# -# @file examplesettings.py -# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. -# @brief Implementation of the ExampleSettings object. This file has been -# automatically generated by the UAVObjectGenerator. -# -# @note Object definition file: examplesettings.xml. -# This is an automatically generated file. -# DO NOT modify manually. -# -# @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 -# - - -import uavobject - -import struct -from collections import namedtuple - -# This is a list of instances of the data fields contained in this object -_fields = [ \ - uavobject.UAVObjectField( - 'UpdatePeriod', - 'i', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'StepSize', - 'i', - 1, - [ - '0', - ], - { - } - ), - uavobject.UAVObjectField( - 'StepDirection', - 'b', - 1, - [ - '0', - ], - { - '0' : 'up', - '1' : 'down', - } - ), -] - - -class ExampleSettings(uavobject.UAVObject): - ## Object constants - OBJID = 1640607828 - NAME = "ExampleSettings" - METANAME = "ExampleSettingsMeta" - ISSINGLEINST = 1 - ISSETTINGS = 1 - - def __init__(self): - uavobject.UAVObject.__init__(self, - self.OBJID, - self.NAME, - self.METANAME, - 0, - self.ISSINGLEINST) - - for f in _fields: - self.add_field(f) - - def __str__(self): - s = ("0x%08X (%10u) %-30s %3u bytes format '%s'\n" - % (self.OBJID, self.OBJID, self.NAME, self.get_struct().size, self.get_struct().format)) - for f in self.get_tuple()._fields: - s += ("\t%s\n" % f) - return (s) - -def main(): - # Instantiate the object and dump out some interesting info - x = ExampleSettings() - print (x) - -if __name__ == "__main__": - #import pdb ; pdb.run('main()') - main() diff --git a/ground/src/shared/uavobjectdefinition/exampleobject1.xml b/ground/src/shared/uavobjectdefinition/exampleobject1.xml deleted file mode 100644 index 5d97d8824..000000000 --- a/ground/src/shared/uavobjectdefinition/exampleobject1.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - Example object - - - - - - - - - - - - - - diff --git a/ground/src/shared/uavobjectdefinition/exampleobject2.xml b/ground/src/shared/uavobjectdefinition/exampleobject2.xml deleted file mode 100644 index 08236bbfb..000000000 --- a/ground/src/shared/uavobjectdefinition/exampleobject2.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Example object - - - - - - - - - - diff --git a/ground/src/shared/uavobjectdefinition/examplesettings.xml b/ground/src/shared/uavobjectdefinition/examplesettings.xml deleted file mode 100644 index 2fec671c7..000000000 --- a/ground/src/shared/uavobjectdefinition/examplesettings.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - Example settings object - - - - - - - - -