1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

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
This commit is contained in:
edouard 2010-10-06 21:51:58 +00:00 committed by edouard
parent 5c48c29612
commit 2426606a8b
12 changed files with 0 additions and 1131 deletions

View File

@ -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<UAVObjectField*> 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<ExampleObject1*>(objMngr->getObject(ExampleObject1::OBJID, instID));
}

View File

@ -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

View File

@ -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()

View File

@ -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<UAVObjectField*> 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<ExampleObject2*>(objMngr->getObject(ExampleObject2::OBJID, instID));
}

View File

@ -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

View File

@ -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()

View File

@ -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<UAVObjectField*> 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<ExampleSettings*>(objMngr->getObject(ExampleSettings::OBJID, instID));
}

View File

@ -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

View File

@ -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()

View File

@ -1,17 +0,0 @@
<xml>
<object name="ExampleObject1" singleinstance="false" settings="false">
<description>Example object</description>
<field name="Field1" units="unit1" type="int8" elements="1"/>
<field name="Field2" units="unit2" type="int16" elements="1"/>
<field name="Field3" units="unit3" type="int32" elements="1"/>
<field name="Field4" units="unit4" type="float" elements="4"/>
<field name="Field5" units="unit5" type="uint8" elements="1"/>
<field name="Field6" units="unit6" type="uint16" elements="1"/>
<field name="Field7" units="unit7" type="uint32" elements="1"/>
<field name="Field8" units="unit8" type="enum" elements="1" options="Option1, Option2"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="periodic" period="500"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>
<logging updatemode="never" period="0"/>
</object>
</xml>

View File

@ -1,13 +0,0 @@
<xml>
<object name="ExampleObject2" singleinstance="false" settings="false">
<description>Example object</description>
<field name="Field1" units="unit1" type="int8" elements="1"/>
<field name="Field2" units="unit2" type="int16" elements="1"/>
<field name="Field3" units="unit3" type="int32" elements="1"/>
<field name="Field4" units="unit4" type="float" elements="4"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="periodic" period="500"/>
<logging updatemode="never" period="0"/>
</object>
</xml>

View File

@ -1,12 +0,0 @@
<xml>
<object name="ExampleSettings" singleinstance="true" settings="true">
<description>Example settings object</description>
<field name="UpdatePeriod" units="ms" type="int32" elements="1" defaultvalue="10"/>
<field name="StepSize" units="" type="int32" elements="1" defaultvalue="1"/>
<field name="StepDirection" units="" type="enum" elements="1" options="up,down" defaultvalue="up"/>
<access gcs="readwrite" flight="readwrite"/>
<telemetrygcs acked="true" updatemode="onchange" period="0"/>
<telemetryflight acked="true" updatemode="onchange" period="0"/>
<logging updatemode="never" period="0"/>
</object>
</xml>