当前位置: 首页>>代码示例>>C++>>正文


C++ UAVObject::getMetadata方法代码示例

本文整理汇总了C++中UAVObject::getMetadata方法的典型用法代码示例。如果您正苦于以下问题:C++ UAVObject::getMetadata方法的具体用法?C++ UAVObject::getMetadata怎么用?C++ UAVObject::getMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UAVObject的用法示例。


在下文中一共展示了UAVObject::getMetadata方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: startRetrievingObjects

/**
 * Initiate object retrieval, initialize queue with objects to be retrieved.
 */
void TelemetryMonitor::startRetrievingObjects()
{
    // Clear object queue
    queue.clear();
    // Get all objects, add metaobjects, settings and data objects with OnChange update mode to the queue
    QList< QList<UAVObject *> > objs = objMngr->getObjects();
    for (int n = 0; n < objs.length(); ++n) {
        UAVObject *obj = objs[n][0];
        UAVMetaObject *mobj = dynamic_cast<UAVMetaObject *>(obj);
        UAVDataObject *dobj = dynamic_cast<UAVDataObject *>(obj);
        UAVObject::Metadata mdata = obj->getMetadata();
        if (mobj != NULL) {
            queue.enqueue(obj);
        } else if (dobj != NULL) {
            if (dobj->isSettings()) {
                queue.enqueue(obj);
            } else {
                if (UAVObject::GetFlightTelemetryUpdateMode(mdata) == UAVObject::UPDATEMODE_ONCHANGE) {
                    queue.enqueue(obj);
                }
            }
        }
    }
    // Start retrieving
    qDebug() << tr("Starting to retrieve meta and settings objects from the autopilot (%1 objects)")
        .arg(queue.length());
    retrieveNextObject();
}
开发者ID:Alex-Rongzhen-Huang,项目名称:OpenPilot,代码行数:31,代码来源:telemetrymonitor.cpp

示例2: onTreeItemExpanded

void UAVObjectBrowserWidget::onTreeItemExpanded(QModelIndex currentProxyIndex)
{
    QModelIndex currentIndex = proxyModel->mapToSource(currentProxyIndex);
    TreeItem *item = static_cast<TreeItem*>(currentIndex.internalPointer());
    TopTreeItem *top = dynamic_cast<TopTreeItem*>(item->parent());

    //Check if current tree index is the child of the top tree item
    if (top)
    {
        ObjectTreeItem *objItem = dynamic_cast<ObjectTreeItem*>(item);
        //If the cast succeeds, then this is a UAVO
        if (objItem)
        {
            UAVObject *obj = objItem->object();
            // Check for multiple instance UAVO
            if(!obj){
                objItem = dynamic_cast<ObjectTreeItem*>(item->getChild(0));
                obj = objItem->object();
            }
            Q_ASSERT(obj);
            UAVObject::Metadata mdata = obj->getMetadata();

            // Determine fastest update
            quint16 tmpUpdatePeriod = MAXIMUM_UPDATE_PERIOD;
            int accessType = UAVObject::GetGcsTelemetryUpdateMode(mdata);
            if (accessType != UAVObject::UPDATEMODE_MANUAL){
                switch(accessType){
                case UAVObject::UPDATEMODE_ONCHANGE:
                    tmpUpdatePeriod = 0;
                    break;
                case UAVObject::UPDATEMODE_PERIODIC:
                case UAVObject::UPDATEMODE_THROTTLED:
                    tmpUpdatePeriod = std::min(mdata.gcsTelemetryUpdatePeriod, tmpUpdatePeriod);
                    break;
                }
            }

            accessType = UAVObject::GetFlightTelemetryUpdateMode(mdata);
            if (accessType != UAVObject::UPDATEMODE_MANUAL){
                switch(accessType){
                case UAVObject::UPDATEMODE_ONCHANGE:
                    tmpUpdatePeriod = 0;
                    break;
                case UAVObject::UPDATEMODE_PERIODIC:
                case UAVObject::UPDATEMODE_THROTTLED:
                    tmpUpdatePeriod = std::min(mdata.flightTelemetryUpdatePeriod, tmpUpdatePeriod);
                    break;
                }
            }

            expandedUavoItems.insert(obj->getName(), tmpUpdatePeriod);

            if (tmpUpdatePeriod < updatePeriod){
                updatePeriod = tmpUpdatePeriod;
                treeView->updateTimerPeriod(updatePeriod);
            }
        }
    }
}
开发者ID:Trex4Git,项目名称:dRonin,代码行数:59,代码来源:uavobjectbrowserwidget.cpp

示例3: ConfigTaskWidget

ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent),wasItMe(false)
{
    m_config = new Ui_OutputWidget();
    m_config->setupUi(this);
    
    ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
    Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>();
    if(!settings->useExpertMode())
        m_config->saveRCOutputToRAM->setVisible(false);

    UAVSettingsImportExportFactory * importexportplugin =  pm->getObject<UAVSettingsImportExportFactory>();
    connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests()));

    // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10.
    // Register for ActuatorSettings changes:
    for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++)
    {
        OutputChannelForm *outputForm = new OutputChannelForm(i, this, i==0);
        m_config->channelLayout->addWidget(outputForm);

        connect(m_config->channelOutTest, SIGNAL(toggled(bool)), outputForm, SLOT(enableChannelTest(bool)));
        connect(outputForm, SIGNAL(channelChanged(int,int)), this, SLOT(sendChannelTest(int,int)));

        connect(outputForm, SIGNAL(formChanged()), this, SLOT(do_SetDirty()));
    }

    connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool)));

    // Configure the task widget
    // Connect the help button
    connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));

    addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD);

    // Track the ActuatorSettings object
    addUAVObject("ActuatorSettings");

    // Associate the buttons with their UAVO fields
    addWidget(m_config->cb_outputRate4);
    addWidget(m_config->cb_outputRate3);
    addWidget(m_config->cb_outputRate2);
    addWidget(m_config->cb_outputRate1);
    addWidget(m_config->spinningArmed);

    disconnect(this, SLOT(refreshWidgetsValues(UAVObject*)));

    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    UAVObject* obj = objManager->getObject(QString("ActuatorCommand"));
    if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE)
        this->setEnabled(false);
    connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(disableIfNotMe(UAVObject*)));
    connect(SystemSettings::GetInstance(objManager), SIGNAL(objectUpdated(UAVObject*)),this,SLOT(assignOutputChannels(UAVObject*)));


    refreshWidgetsValues();
}
开发者ID:1heinz,项目名称:TauLabs,代码行数:56,代码来源:configoutputwidget.cpp

示例4: ConfigTaskWidget

ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
    m_config = new Ui_OutputWidget();
    m_config->setupUi(this);
    
    ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
    Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>();
    if(!settings->useExpertMode())
        m_config->saveRCOutputToRAM->setVisible(false);

    /* There's lots of situations where it's unsafe to run tests.
     * Import/export:
     */
    UAVSettingsImportExportFactory * importexportplugin =  pm->getObject<UAVSettingsImportExportFactory>();
    connect(importexportplugin,SIGNAL(importAboutToBegin()),this,SLOT(stopTests()));

    /* Board connection/disconnection: */
    TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
    connect(telMngr, SIGNAL(connected()), this, SLOT(stopTests()));
    connect(telMngr, SIGNAL(disconnected()), this, SLOT(stopTests()));

    /* When we go into wizards, etc.. time to stop this too. */
    Core::ModeManager *modeMngr = Core::ModeManager::instance();
    connect(modeMngr, SIGNAL(currentModeAboutToChange(Core::IMode *)), this,
		SLOT(stopTests()));
    connect(modeMngr, SIGNAL(currentModeChanged(Core::IMode *)), this,
		SLOT(stopTests()));

    // NOTE: we have channel indices from 0 to 9, but the convention for OP is Channel 1 to Channel 10.
    // Register for ActuatorSettings changes:
    for (unsigned int i = 0; i < ActuatorCommand::CHANNEL_NUMELEM; i++)
    {
        OutputChannelForm *outputForm = new OutputChannelForm(i, this, i==0);
        m_config->channelLayout->addWidget(outputForm);

        connect(m_config->channelOutTest, SIGNAL(toggled(bool)), outputForm, SLOT(enableChannelTest(bool)));
        connect(outputForm, SIGNAL(channelChanged(int,int)), this, SLOT(sendChannelTest(int,int)));

        connect(outputForm, SIGNAL(formChanged()), this, SLOT(do_SetDirty()));
    }

    connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool)));
    connect(m_config->calibrateESC, SIGNAL(clicked()), this, SLOT(startESCCalibration()));

    // Configure the task widget
    // Connect the help button
    connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));

    addApplySaveButtons(m_config->saveRCOutputToRAM,m_config->saveRCOutputToSD);

    // Track the ActuatorSettings object
    addUAVObject("ActuatorSettings");

    // Associate the buttons with their UAVO fields
    addWidget(m_config->cb_outputRate6);
    addWidget(m_config->cb_outputRate5);
    addWidget(m_config->cb_outputRate4);
    addWidget(m_config->cb_outputRate3);
    addWidget(m_config->cb_outputRate2);
    addWidget(m_config->cb_outputRate1);
    addWidget(m_config->spinningArmed);

    // Cache all the combo boxes and labels
    lblList.clear();
    lblList << m_config->chBank1 << m_config->chBank2 << m_config->chBank3 << m_config->chBank4
               << m_config->chBank5 << m_config->chBank6;
    rateList.clear();
    rateList << m_config->cb_outputRate1 << m_config->cb_outputRate2 << m_config->cb_outputRate3
               << m_config->cb_outputRate4 << m_config->cb_outputRate5 << m_config->cb_outputRate6;
    resList.clear();
    resList << m_config->cb_outputResolution1 << m_config->cb_outputResolution2 << m_config->cb_outputResolution3
               << m_config->cb_outputResolution4 << m_config->cb_outputResolution5 << m_config->cb_outputResolution6;

    // Get the list of output resolutions and assign to the resolution dropdowns
    ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager());
    Q_ASSERT(actuatorSettings);
    UAVObjectField *resolutions = actuatorSettings->getField("TimerPwmResolution");
    Q_ASSERT(resolutions);

    QList<QComboBox*>::iterator resIter;
    for (resIter = resList.begin(); resIter != resList.end(); resIter++) {
        QComboBox *res = *resIter;
        res->clear();
        res->addItems(resolutions->getOptions());
        addWidget(res);
        connect(res, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshWidgetRanges()));
    }

    QList<QComboBox*>::iterator rateIter;
    for (rateIter = rateList.begin(); rateIter != rateList.end(); rateIter++) {
        QComboBox *rate = *rateIter;

        connect(rate, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshWidgetRanges()));
    }

    disconnect(this, SLOT(refreshWidgetsValues(UAVObject*)));

    UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
    UAVObject* obj = objManager->getObject(QString("ActuatorCommand"));
    if(UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE)
//.........这里部分代码省略.........
开发者ID:Trex4Git,项目名称:dRonin,代码行数:101,代码来源:configoutputwidget.cpp


注:本文中的UAVObject::getMetadata方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。