1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-15 07:29:15 +01:00

Adding PipX modem settings/status UAVObjects

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2217 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
pip 2010-12-11 10:56:07 +00:00 committed by pip
parent 5f6024c06e
commit 5a0d9fb36c
8 changed files with 981 additions and 2 deletions

View File

@ -0,0 +1,205 @@
/**
******************************************************************************
*
* @file pipxtrememodemsettings.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: pipxtrememodemsettings.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 "pipxtrememodemsettings.h"
#include "uavobjectfield.h"
const QString PipXtremeModemSettings::NAME = QString("PipXtremeModemSettings");
/**
* Constructor
*/
PipXtremeModemSettings::PipXtremeModemSettings(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
QStringList FrequencyElemNames;
FrequencyElemNames.append("0");
fields.append( new UAVObjectField(QString("Frequency"), QString("Hz"), UAVObjectField::UINT32, FrequencyElemNames, QStringList()) );
QStringList RFBandwidthElemNames;
RFBandwidthElemNames.append("0");
QStringList RFBandwidthEnumOptions;
RFBandwidthEnumOptions.append("500");
RFBandwidthEnumOptions.append("1000");
RFBandwidthEnumOptions.append("2000");
RFBandwidthEnumOptions.append("4000");
RFBandwidthEnumOptions.append("8000");
RFBandwidthEnumOptions.append("9600");
RFBandwidthEnumOptions.append("16000");
RFBandwidthEnumOptions.append("19200");
RFBandwidthEnumOptions.append("24000");
RFBandwidthEnumOptions.append("32000");
RFBandwidthEnumOptions.append("64000");
RFBandwidthEnumOptions.append("128000");
RFBandwidthEnumOptions.append("192000");
fields.append( new UAVObjectField(QString("RFBandwidth"), QString("Hz"), UAVObjectField::ENUM, RFBandwidthElemNames, RFBandwidthEnumOptions) );
QStringList MaxTxPowerElemNames;
MaxTxPowerElemNames.append("0");
QStringList MaxTxPowerEnumOptions;
MaxTxPowerEnumOptions.append("1");
MaxTxPowerEnumOptions.append("2");
MaxTxPowerEnumOptions.append("5");
MaxTxPowerEnumOptions.append("8");
MaxTxPowerEnumOptions.append("11");
MaxTxPowerEnumOptions.append("14");
MaxTxPowerEnumOptions.append("17");
MaxTxPowerEnumOptions.append("20");
fields.append( new UAVObjectField(QString("MaxTxPower"), QString("dBm"), UAVObjectField::ENUM, MaxTxPowerElemNames, MaxTxPowerEnumOptions) );
QStringList AESEncryptionElemNames;
AESEncryptionElemNames.append("0");
QStringList AESEncryptionEnumOptions;
AESEncryptionEnumOptions.append("False");
AESEncryptionEnumOptions.append("True");
fields.append( new UAVObjectField(QString("AESEncryption"), QString(""), UAVObjectField::ENUM, AESEncryptionElemNames, AESEncryptionEnumOptions) );
QStringList AESEncryptionKeyElemNames;
AESEncryptionKeyElemNames.append("0");
AESEncryptionKeyElemNames.append("1");
AESEncryptionKeyElemNames.append("2");
AESEncryptionKeyElemNames.append("3");
AESEncryptionKeyElemNames.append("4");
AESEncryptionKeyElemNames.append("5");
AESEncryptionKeyElemNames.append("6");
AESEncryptionKeyElemNames.append("7");
AESEncryptionKeyElemNames.append("8");
AESEncryptionKeyElemNames.append("9");
AESEncryptionKeyElemNames.append("10");
AESEncryptionKeyElemNames.append("11");
AESEncryptionKeyElemNames.append("12");
AESEncryptionKeyElemNames.append("13");
AESEncryptionKeyElemNames.append("14");
AESEncryptionKeyElemNames.append("15");
fields.append( new UAVObjectField(QString("AESEncryptionKey"), QString(""), UAVObjectField::UINT8, AESEncryptionKeyElemNames, QStringList()) );
QStringList PairedSerialNumberCRCElemNames;
PairedSerialNumberCRCElemNames.append("0");
fields.append( new UAVObjectField(QString("PairedSerialNumberCRC"), QString(""), UAVObjectField::UINT32, PairedSerialNumberCRCElemNames, QStringList()) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
// Set the default field values
setDefaultFieldValues();
}
/**
* Get the default metadata for this object
*/
UAVObject::Metadata PipXtremeModemSettings::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 PipXtremeModemSettings::setDefaultFieldValues()
{
data.Frequency = 433920000;
data.RFBandwidth = 11;
data.MaxTxPower = 4;
data.AESEncryption = 0;
data.AESEncryptionKey[0] = 0;
data.AESEncryptionKey[1] = 0;
data.AESEncryptionKey[2] = 0;
data.AESEncryptionKey[3] = 0;
data.AESEncryptionKey[4] = 0;
data.AESEncryptionKey[5] = 0;
data.AESEncryptionKey[6] = 0;
data.AESEncryptionKey[7] = 0;
data.AESEncryptionKey[8] = 0;
data.AESEncryptionKey[9] = 0;
data.AESEncryptionKey[10] = 0;
data.AESEncryptionKey[11] = 0;
data.AESEncryptionKey[12] = 0;
data.AESEncryptionKey[13] = 0;
data.AESEncryptionKey[14] = 0;
data.AESEncryptionKey[15] = 0;
data.PairedSerialNumberCRC = 0;
}
/**
* Get the object data fields
*/
PipXtremeModemSettings::DataFields PipXtremeModemSettings::getData()
{
QMutexLocker locker(mutex);
return data;
}
/**
* Set the object data fields
*/
void PipXtremeModemSettings::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* PipXtremeModemSettings::clone(quint32 instID)
{
PipXtremeModemSettings* obj = new PipXtremeModemSettings();
obj->initialize(instID, this->getMetaObject());
return obj;
}
/**
* Static function to retrieve an instance of the object.
*/
PipXtremeModemSettings* PipXtremeModemSettings::GetInstance(UAVObjectManager* objMngr, quint32 instID)
{
return dynamic_cast<PipXtremeModemSettings*>(objMngr->getObject(PipXtremeModemSettings::OBJID, instID));
}

View File

@ -0,0 +1,96 @@
/**
******************************************************************************
*
* @file pipxtrememodemsettings.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: pipxtrememodemsettings.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 PIPXTREMEMODEMSETTINGS_H
#define PIPXTREMEMODEMSETTINGS_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT PipXtremeModemSettings: public UAVDataObject
{
Q_OBJECT
public:
// Field structure
typedef struct {
quint32 Frequency;
quint8 RFBandwidth;
quint8 MaxTxPower;
quint8 AESEncryption;
quint8 AESEncryptionKey[16];
quint32 PairedSerialNumberCRC;
} __attribute__((packed)) DataFields;
// Field information
// Field Frequency information
// Field RFBandwidth information
/* Enumeration options for field RFBandwidth */
typedef enum { RFBANDWIDTH_500=0, RFBANDWIDTH_1000=1, RFBANDWIDTH_2000=2, RFBANDWIDTH_4000=3, RFBANDWIDTH_8000=4, RFBANDWIDTH_9600=5, RFBANDWIDTH_16000=6, RFBANDWIDTH_19200=7, RFBANDWIDTH_24000=8, RFBANDWIDTH_32000=9, RFBANDWIDTH_64000=10, RFBANDWIDTH_128000=11, RFBANDWIDTH_192000=12 } RFBandwidthOptions;
// Field MaxTxPower information
/* Enumeration options for field MaxTxPower */
typedef enum { MAXTXPOWER_1=0, MAXTXPOWER_2=1, MAXTXPOWER_5=2, MAXTXPOWER_8=3, MAXTXPOWER_11=4, MAXTXPOWER_14=5, MAXTXPOWER_17=6, MAXTXPOWER_20=7 } MaxTxPowerOptions;
// Field AESEncryption information
/* Enumeration options for field AESEncryption */
typedef enum { AESENCRYPTION_FALSE=0, AESENCRYPTION_TRUE=1 } AESEncryptionOptions;
// Field AESEncryptionKey information
/* Number of elements for field AESEncryptionKey */
static const quint32 AESENCRYPTIONKEY_NUMELEM = 16;
// Field PairedSerialNumberCRC information
// Constants
static const quint32 OBJID = 1441129524U;
static const QString NAME;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 1;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
PipXtremeModemSettings();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static PipXtremeModemSettings* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
void setDefaultFieldValues();
};
#endif // PIPXTREMEMODEMSETTINGS_H

View File

@ -0,0 +1,174 @@
##
##############################################################################
#
# @file pipxtrememodemsettings.py
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
# @brief Implementation of the PipXtremeModemSettings object. This file has been
# automatically generated by the UAVObjectGenerator.
#
# @note Object definition file: pipxtrememodemsettings.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(
'Frequency',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'RFBandwidth',
'b',
1,
[
'0',
],
{
'0' : '500',
'1' : '1000',
'2' : '2000',
'3' : '4000',
'4' : '8000',
'5' : '9600',
'6' : '16000',
'7' : '19200',
'8' : '24000',
'9' : '32000',
'10' : '64000',
'11' : '128000',
'12' : '192000',
}
),
uavobject.UAVObjectField(
'MaxTxPower',
'b',
1,
[
'0',
],
{
'0' : '1',
'1' : '2',
'2' : '5',
'3' : '8',
'4' : '11',
'5' : '14',
'6' : '17',
'7' : '20',
}
),
uavobject.UAVObjectField(
'AESEncryption',
'b',
1,
[
'0',
],
{
'0' : 'False',
'1' : 'True',
}
),
uavobject.UAVObjectField(
'AESEncryptionKey',
'B',
16,
[
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
],
{
}
),
uavobject.UAVObjectField(
'PairedSerialNumberCRC',
'I',
1,
[
'0',
],
{
}
),
]
class PipXtremeModemSettings(uavobject.UAVObject):
## Object constants
OBJID = 1441129524
NAME = "PipXtremeModemSettings"
METANAME = "PipXtremeModemSettingsMeta"
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 = PipXtremeModemSettings()
print (x)
if __name__ == "__main__":
#import pdb ; pdb.run('main()')
main()

View File

@ -0,0 +1,205 @@
/**
******************************************************************************
*
* @file pipxtrememodemstatus.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: pipxtrememodemstatus.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 "pipxtrememodemstatus.h"
#include "uavobjectfield.h"
const QString PipXtremeModemStatus::NAME = QString("PipXtremeModemStatus");
/**
* Constructor
*/
PipXtremeModemStatus::PipXtremeModemStatus(): UAVDataObject(OBJID, ISSINGLEINST, ISSETTINGS, NAME)
{
// Create fields
QList<UAVObjectField*> fields;
QStringList SerialNumberElemNames;
SerialNumberElemNames.append("0");
SerialNumberElemNames.append("1");
SerialNumberElemNames.append("2");
SerialNumberElemNames.append("3");
SerialNumberElemNames.append("4");
SerialNumberElemNames.append("5");
SerialNumberElemNames.append("6");
SerialNumberElemNames.append("7");
SerialNumberElemNames.append("8");
SerialNumberElemNames.append("9");
SerialNumberElemNames.append("10");
SerialNumberElemNames.append("11");
SerialNumberElemNames.append("12");
SerialNumberElemNames.append("13");
SerialNumberElemNames.append("14");
SerialNumberElemNames.append("15");
SerialNumberElemNames.append("16");
SerialNumberElemNames.append("17");
SerialNumberElemNames.append("18");
SerialNumberElemNames.append("19");
SerialNumberElemNames.append("20");
SerialNumberElemNames.append("21");
SerialNumberElemNames.append("22");
SerialNumberElemNames.append("23");
fields.append( new UAVObjectField(QString("SerialNumber"), QString(""), UAVObjectField::UINT8, SerialNumberElemNames, QStringList()) );
QStringList SerialNumberCRCElemNames;
SerialNumberCRCElemNames.append("0");
fields.append( new UAVObjectField(QString("SerialNumberCRC"), QString(""), UAVObjectField::UINT32, SerialNumberCRCElemNames, QStringList()) );
QStringList UpTimeElemNames;
UpTimeElemNames.append("0");
fields.append( new UAVObjectField(QString("UpTime"), QString("ms"), UAVObjectField::UINT32, UpTimeElemNames, QStringList()) );
QStringList FrequencyElemNames;
FrequencyElemNames.append("0");
fields.append( new UAVObjectField(QString("Frequency"), QString("Hz"), UAVObjectField::UINT32, FrequencyElemNames, QStringList()) );
QStringList RFBandwidthElemNames;
RFBandwidthElemNames.append("0");
fields.append( new UAVObjectField(QString("RFBandwidth"), QString("Hz"), UAVObjectField::UINT32, RFBandwidthElemNames, QStringList()) );
QStringList TxPowerElemNames;
TxPowerElemNames.append("0");
fields.append( new UAVObjectField(QString("TxPower"), QString("dBm"), UAVObjectField::INT8, TxPowerElemNames, QStringList()) );
QStringList StateElemNames;
StateElemNames.append("0");
QStringList StateEnumOptions;
StateEnumOptions.append("Disconnected");
StateEnumOptions.append("Connecting");
StateEnumOptions.append("Connected");
StateEnumOptions.append("NotReady");
fields.append( new UAVObjectField(QString("State"), QString(""), UAVObjectField::ENUM, StateElemNames, StateEnumOptions) );
QStringList TxDataRateElemNames;
TxDataRateElemNames.append("0");
fields.append( new UAVObjectField(QString("TxDataRate"), QString("bytes/sec"), UAVObjectField::UINT32, TxDataRateElemNames, QStringList()) );
QStringList RxDataRateElemNames;
RxDataRateElemNames.append("0");
fields.append( new UAVObjectField(QString("RxDataRate"), QString("bytes/sec"), UAVObjectField::UINT32, RxDataRateElemNames, QStringList()) );
// Initialize object
initializeFields(fields, (quint8*)&data, NUMBYTES);
// Set the default field values
setDefaultFieldValues();
}
/**
* Get the default metadata for this object
*/
UAVObject::Metadata PipXtremeModemStatus::getDefaultMetadata()
{
UAVObject::Metadata metadata;
metadata.flightAccess = ACCESS_READWRITE;
metadata.gcsAccess = ACCESS_READWRITE;
metadata.gcsTelemetryAcked = 0;
metadata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_MANUAL;
metadata.gcsTelemetryUpdatePeriod = 0;
metadata.flightTelemetryAcked = 0;
metadata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
metadata.flightTelemetryUpdatePeriod = 2000;
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 PipXtremeModemStatus::setDefaultFieldValues()
{
data.SerialNumber[0] = 0;
data.SerialNumber[1] = 0;
data.SerialNumber[2] = 0;
data.SerialNumber[3] = 0;
data.SerialNumber[4] = 0;
data.SerialNumber[5] = 0;
data.SerialNumber[6] = 0;
data.SerialNumber[7] = 0;
data.SerialNumber[8] = 0;
data.SerialNumber[9] = 0;
data.SerialNumber[10] = 0;
data.SerialNumber[11] = 0;
data.SerialNumber[12] = 0;
data.SerialNumber[13] = 0;
data.SerialNumber[14] = 0;
data.SerialNumber[15] = 0;
data.SerialNumber[16] = 0;
data.SerialNumber[17] = 0;
data.SerialNumber[18] = 0;
data.SerialNumber[19] = 0;
data.SerialNumber[20] = 0;
data.SerialNumber[21] = 0;
data.SerialNumber[22] = 0;
data.SerialNumber[23] = 0;
data.SerialNumberCRC = 0;
}
/**
* Get the object data fields
*/
PipXtremeModemStatus::DataFields PipXtremeModemStatus::getData()
{
QMutexLocker locker(mutex);
return data;
}
/**
* Set the object data fields
*/
void PipXtremeModemStatus::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* PipXtremeModemStatus::clone(quint32 instID)
{
PipXtremeModemStatus* obj = new PipXtremeModemStatus();
obj->initialize(instID, this->getMetaObject());
return obj;
}
/**
* Static function to retrieve an instance of the object.
*/
PipXtremeModemStatus* PipXtremeModemStatus::GetInstance(UAVObjectManager* objMngr, quint32 instID)
{
return dynamic_cast<PipXtremeModemStatus*>(objMngr->getObject(PipXtremeModemStatus::OBJID, instID));
}

View File

@ -0,0 +1,98 @@
/**
******************************************************************************
*
* @file pipxtrememodemstatus.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: pipxtrememodemstatus.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 PIPXTREMEMODEMSTATUS_H
#define PIPXTREMEMODEMSTATUS_H
#include "uavdataobject.h"
#include "uavobjectmanager.h"
class UAVOBJECTS_EXPORT PipXtremeModemStatus: public UAVDataObject
{
Q_OBJECT
public:
// Field structure
typedef struct {
quint8 SerialNumber[24];
quint32 SerialNumberCRC;
quint32 UpTime;
quint32 Frequency;
quint32 RFBandwidth;
qint8 TxPower;
quint8 State;
quint32 TxDataRate;
quint32 RxDataRate;
} __attribute__((packed)) DataFields;
// Field information
// Field SerialNumber information
/* Number of elements for field SerialNumber */
static const quint32 SERIALNUMBER_NUMELEM = 24;
// Field SerialNumberCRC information
// Field UpTime information
// Field Frequency information
// Field RFBandwidth information
// Field TxPower information
// Field State information
/* Enumeration options for field State */
typedef enum { STATE_DISCONNECTED=0, STATE_CONNECTING=1, STATE_CONNECTED=2, STATE_NOTREADY=3 } StateOptions;
// Field TxDataRate information
// Field RxDataRate information
// Constants
static const quint32 OBJID = 1854119896U;
static const QString NAME;
static const bool ISSINGLEINST = 1;
static const bool ISSETTINGS = 0;
static const quint32 NUMBYTES = sizeof(DataFields);
// Functions
PipXtremeModemStatus();
DataFields getData();
void setData(const DataFields& data);
Metadata getDefaultMetadata();
UAVDataObject* clone(quint32 instID);
static PipXtremeModemStatus* GetInstance(UAVObjectManager* objMngr, quint32 instID = 0);
private:
DataFields data;
void setDefaultFieldValues();
};
#endif // PIPXTREMEMODEMSTATUS_H

View File

@ -0,0 +1,193 @@
##
##############################################################################
#
# @file pipxtrememodemstatus.py
# @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
# @brief Implementation of the PipXtremeModemStatus object. This file has been
# automatically generated by the UAVObjectGenerator.
#
# @note Object definition file: pipxtrememodemstatus.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(
'SerialNumber',
'B',
24,
[
'0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'10',
'11',
'12',
'13',
'14',
'15',
'16',
'17',
'18',
'19',
'20',
'21',
'22',
'23',
],
{
}
),
uavobject.UAVObjectField(
'SerialNumberCRC',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'UpTime',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'Frequency',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'RFBandwidth',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'TxPower',
'b',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'State',
'b',
1,
[
'0',
],
{
'0' : 'Disconnected',
'1' : 'Connecting',
'2' : 'Connected',
'3' : 'NotReady',
}
),
uavobject.UAVObjectField(
'TxDataRate',
'I',
1,
[
'0',
],
{
}
),
uavobject.UAVObjectField(
'RxDataRate',
'I',
1,
[
'0',
],
{
}
),
]
class PipXtremeModemStatus(uavobject.UAVObject):
## Object constants
OBJID = 1854119896
NAME = "PipXtremeModemStatus"
METANAME = "PipXtremeModemStatusMeta"
ISSINGLEINST = 1
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 = PipXtremeModemStatus()
print (x)
if __name__ == "__main__":
#import pdb ; pdb.run('main()')
main()

View File

@ -44,7 +44,9 @@ HEADERS += uavobjects_global.h \
guidancesettings.h \
positiondesired.h \
ratedesired.h \
firmwareiapobj.h
firmwareiapobj.h \
pipxtrememodemsettings.h \
pipxtrememodemstatus.h
SOURCES += uavobject.cpp \
uavmetaobject.cpp \
@ -86,5 +88,7 @@ SOURCES += uavobject.cpp \
guidancesettings.cpp \
positiondesired.cpp \
ratedesired.cpp \
firmwareiapobj.cpp
firmwareiapobj.cpp \
pipxtrememodemsettings.cpp \
pipxtrememodemstatus.cpp
OTHER_FILES += UAVObjects.pluginspec

View File

@ -54,6 +54,8 @@
#include "mixersettings.h"
#include "mixerstatus.h"
#include "objectpersistence.h"
#include "pipxtrememodemsettings.h"
#include "pipxtrememodemstatus.h"
#include "positionactual.h"
#include "positiondesired.h"
#include "ratedesired.h"
@ -96,6 +98,8 @@ void UAVObjectsInitialize(UAVObjectManager* objMngr)
objMngr->registerObject( new MixerSettings() );
objMngr->registerObject( new MixerStatus() );
objMngr->registerObject( new ObjectPersistence() );
objMngr->registerObject( new PipXtremeModemSettings() );
objMngr->registerObject( new PipXtremeModemStatus() );
objMngr->registerObject( new PositionActual() );
objMngr->registerObject( new PositionDesired() );
objMngr->registerObject( new RateDesired() );