1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-09 20:46:07 +01:00
LibrePilot/ground/src/plugins/uavobjects/exampleobject1.cpp
vassilis 56f88a6a79 GCS\ObjectGenerator Minor change on the way named arrays are implemented
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@536 ebee16cc-31ac-478f-84a7-5cbb03baadba
2010-04-22 00:44:14 +00:00

109 lines
4.2 KiB
C++

/**
******************************************************************************
*
* @file exampleobject1.cpp
* @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
*/
#include "exampleobject1.h"
#include "uavobjectfields.h"
const QString ExampleObject1::NAME = QString("ExampleObject1");
ExampleObject1::ExampleObject1(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
QStringList Field1ElemNames;
Field1ElemNames.append("0");
fields.append(new UAVObjectFieldInt8(QString("Field1"), QString("unit1"), Field1ElemNames));
QStringList Field2ElemNames;
Field2ElemNames.append("0");
fields.append(new UAVObjectFieldInt16(QString("Field2"), QString("unit2"), Field2ElemNames));
QStringList Field3ElemNames;
Field3ElemNames.append("0");
fields.append(new UAVObjectFieldInt32(QString("Field3"), QString("unit3"), Field3ElemNames));
QStringList Field4ElemNames;
Field4ElemNames.append("0");
Field4ElemNames.append("1");
Field4ElemNames.append("2");
Field4ElemNames.append("3");
fields.append(new UAVObjectFieldFloat(QString("Field4"), QString("unit4"), Field4ElemNames));
QStringList Field5ElemNames;
Field5ElemNames.append("0");
fields.append(new UAVObjectFieldUInt8(QString("Field5"), QString("unit5"), Field5ElemNames));
QStringList Field6ElemNames;
Field6ElemNames.append("0");
fields.append(new UAVObjectFieldUInt16(QString("Field6"), QString("unit6"), Field6ElemNames));
QStringList Field7ElemNames;
Field7ElemNames.append("0");
fields.append(new UAVObjectFieldUInt32(QString("Field7"), QString("unit7"), Field7ElemNames));
QStringList Field8ElemNames;
Field8ElemNames.append("0");
QStringList Field8EnumOptions;
Field8EnumOptions.append("Option1");
Field8EnumOptions.append("Option2");
fields.append(new UAVObjectFieldEnum(QString("Field8"), QString("unit8"), Field8ElemNames, Field8EnumOptions));
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
}
UAVObject::Metadata ExampleObject1::getDefaultMetadata()
{
UAVObject::Metadata metadata;
metadata.gcsTelemetryAcked = 1;
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
metadata.gcsTelemetryUpdatePeriod = 200;
metadata.flightTelemetryAcked = 1;
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
metadata.flightTelemetryUpdatePeriod = 0;
metadata.loggingUpdateMode = UAVObject::UPDATEMODE_NEVER;
metadata.loggingUpdatePeriod = 0;
return metadata;
}
ExampleObject1::DataFields ExampleObject1::getData()
{
QMutexLocker locker(mutex);
return data;
}
void ExampleObject1::setData(DataFields& data)
{
QMutexLocker locker(mutex);
this->data = data;
emit objectUpdatedAuto(this); // trigger object updated event
emit objectUpdated(this);
}
UAVDataObject* ExampleObject1::clone(quint32 instID)
{
ExampleObject1* obj = new ExampleObject1();
obj->initialize(instID, this->getMetaObject());
return obj;
}