1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-29 14:52:12 +01:00

OP-515 Uploader Gadget UI improvements. Not implemented Firmware pre-check yet.

This commit is contained in:
elafargue 2011-06-01 14:49:22 +02:00
parent b46c5dbff9
commit cacf03ae7b
5 changed files with 49 additions and 3 deletions

View File

@ -172,6 +172,36 @@ QByteArray UAVObjectUtilManager::getBoardCPUSerial()
return cpuSerial;
}
/**
* Get the UAV Board Description, for anyone interested.
*/
QString UAVObjectUtilManager::getBoardDescription()
{
QString description;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
if (!pm)
return 0;
UAVObjectManager *om = pm->getObject<UAVObjectManager>();
if (!om)
return 0;
UAVDataObject *obj = dynamic_cast<UAVDataObject *>(om->getObject(QString("FirmwareIAPObj")));
// The code below will ask for the object update and wait for the updated to be received,
// or the timeout of the timer, set to 1 second.
QEventLoop loop;
connect(obj, SIGNAL(objectUpdated(UAVObject*)), &loop, SLOT(quit()));
QTimer::singleShot(1000, &loop, SLOT(quit())); // Create a timeout
obj->requestUpdate();
loop.exec();
UAVObjectField* descriptionField = obj->getField("Description");
// Description starts with an offset of
for (int i = 14; i < descriptionField->getNumElements(); ++i) {
description.append(descriptionField->getValue(i).toChar());
}
return description;
}
// ******************************

View File

@ -62,6 +62,7 @@ public:
int getBoardModel();
QByteArray getBoardCPUSerial();
QString getBoardDescription();
private:
QMutex *mutex;

View File

@ -17,7 +17,11 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0" colspan="3">
<widget class="QLineEdit" name="description"/>
<widget class="QLineEdit" name="description">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="deviceID">

View File

@ -102,6 +102,9 @@ void runningDeviceWidget::populate()
QString serial = utilMngr->getBoardCPUSerial().toHex();
myDevice->cpuSerial->setText(serial);
QString description = utilMngr->getBoardDescription();
myDevice->description->setText(description);
status("Ready...", STATUSICON_INFO);
}

View File

@ -77,10 +77,18 @@
</widget>
</item>
<item row="2" column="0" colspan="3">
<widget class="QLineEdit" name="description"/>
<widget class="QLineEdit" name="description">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLineEdit" name="cpuSerial"/>
<widget class="QLineEdit" name="cpuSerial">
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>