mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
OP-515 Changes according to Osnwt suggestions.
This commit is contained in:
parent
4d634ad304
commit
6910bbb4f1
@ -261,12 +261,39 @@ QByteArray UAVObjectUtilManager::getBoardCPUSerial()
|
||||
loop.exec();
|
||||
|
||||
UAVObjectField* cpuField = obj->getField("CPUSerial");
|
||||
for (int i = 0; i < cpuField->getNumElements(); ++i) {
|
||||
for (uint i = 0; i < cpuField->getNumElements(); ++i) {
|
||||
cpuSerial.append(cpuField->getValue(i).toUInt());
|
||||
}
|
||||
return cpuSerial;
|
||||
}
|
||||
|
||||
quint32 UAVObjectUtilManager::getFirmwareCRC()
|
||||
{
|
||||
quint32 fwCRC;
|
||||
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")));
|
||||
obj->getField("crc")->setValue(0);
|
||||
obj->updated();
|
||||
// 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* fwCRCField = obj->getField("crc");
|
||||
|
||||
fwCRC=(quint32)fwCRCField->getValue().toLongLong();
|
||||
return fwCRC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the UAV Board Description, for anyone interested.
|
||||
*/
|
||||
@ -291,7 +318,7 @@ QByteArray UAVObjectUtilManager::getBoardDescription()
|
||||
|
||||
UAVObjectField* descriptionField = obj->getField("Description");
|
||||
// Description starts with an offset of
|
||||
for (int i = 0; i < descriptionField->getNumElements(); ++i) {
|
||||
for (uint i = 0; i < descriptionField->getNumElements(); ++i) {
|
||||
ret.append(descriptionField->getValue(i).toInt());
|
||||
}
|
||||
return ret;
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
|
||||
int getBoardModel();
|
||||
QByteArray getBoardCPUSerial();
|
||||
quint32 getFirmwareCRC();
|
||||
QByteArray getBoardDescription();
|
||||
UAVObjectManager* getObjectManager();
|
||||
void saveObjectToSD(UAVObject *obj);
|
||||
|
@ -10,6 +10,26 @@ public:
|
||||
QString description;
|
||||
int boardType;
|
||||
int boardRevision;
|
||||
static QString idToBoardName(int id)
|
||||
{
|
||||
switch (id | 0x0011) {
|
||||
case 0x0111://MB
|
||||
return QString("Board name: OpenPilot MainBoard");
|
||||
break;
|
||||
case 0x0311://PipX
|
||||
return QString("Board name: PipXtreame");
|
||||
break;
|
||||
case 0x0411://Coptercontrol
|
||||
return QString("Board name: CopterControl");
|
||||
break;
|
||||
case 0x0211://INS
|
||||
return QString("Board name: OpenPilot INS");
|
||||
break;
|
||||
default:
|
||||
return QString("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
deviceDescriptorStruct();
|
||||
};
|
||||
|
||||
|
@ -35,6 +35,7 @@ deviceWidget::deviceWidget(QWidget *parent) :
|
||||
|
||||
// Initialization of the Device icon display
|
||||
myDevice->verticalGroupBox_loaded->setVisible(false);
|
||||
myDevice->groupCustom->setVisible(false);
|
||||
myDevice->youdont->setVisible(false);
|
||||
myDevice->gVDevice->setScene(new QGraphicsScene(this));
|
||||
connect(myDevice->retrieveButton, SIGNAL(clicked()), this, SLOT(downloadFirmware()));
|
||||
@ -81,16 +82,16 @@ QString deviceWidget::idToBoardName(int id)
|
||||
{
|
||||
switch (id | 0x0011) {
|
||||
case 0x0111://MB
|
||||
return QString("Board Name: OpenPilot MainBoard");
|
||||
return QString("Board name: OpenPilot MainBoard");
|
||||
break;
|
||||
case 0x0311://PipX
|
||||
return QString("Board Name: PipXtreame");
|
||||
return QString("Board name: PipXtreame");
|
||||
break;
|
||||
case 0x0411://Coptercontrol
|
||||
return QString("Board Name: CopterControl");
|
||||
return QString("Board name: CopterControl");
|
||||
break;
|
||||
case 0x0211://INS
|
||||
return QString("Board Name: OpenPilot INS");
|
||||
return QString("Board name: OpenPilot INS");
|
||||
break;
|
||||
default:
|
||||
return QString("");
|
||||
@ -109,14 +110,11 @@ void deviceWidget::populate()
|
||||
// DeviceID tells us what sort of HW we have detected:
|
||||
// display a nice icon:
|
||||
myDevice->gVDevice->scene()->clear();
|
||||
if (devicePic)
|
||||
delete devicePic;
|
||||
myDevice->lblDevName->setText(deviceDescriptorStruct::idToBoardName(id));
|
||||
myDevice->lblHWRev->setText(QString(tr("HW Revision: "))+QString::number(id & 0x0011, 16));
|
||||
|
||||
devicePic = new QGraphicsSvgItem();
|
||||
devicePic->setSharedRenderer(new QSvgRenderer());
|
||||
|
||||
myDevice->lblDevName->setText(idToBoardName(id));
|
||||
|
||||
myDevice->lblHWRev->setText(QString(tr("HW Revision:"))+QString::number(id & 0x0011, 16));
|
||||
switch (id) {
|
||||
case 0x0101:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0101.svg"));
|
||||
@ -134,10 +132,6 @@ void deviceWidget::populate()
|
||||
break;
|
||||
}
|
||||
devicePic->setElementId("device");
|
||||
//myDevice->devicePicture->scene()->addItem(devicePic);
|
||||
//myDevice->devicePicture->setSceneRect(devicePic->boundingRect());
|
||||
//myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
|
||||
myDevice->gVDevice->scene()->addItem(devicePic);
|
||||
myDevice->gVDevice->setSceneRect(devicePic->boundingRect());
|
||||
myDevice->gVDevice->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
@ -145,11 +139,14 @@ void deviceWidget::populate()
|
||||
bool r = m_dfu->devices[deviceID].Readable;
|
||||
bool w = m_dfu->devices[deviceID].Writable;
|
||||
|
||||
myDevice->lblAccess->setText(QString("Access: ") + QString(r ? "R" : "-") + QString(w ? "W" : "-"));
|
||||
myDevice->lblAccess->setText(QString("Flash access: ") + QString(r ? "R" : "-") + QString(w ? "W" : "-"));
|
||||
myDevice->lblMaxCode->setText(QString("Max code size: ") +QString::number(m_dfu->devices[deviceID].SizeOfCode));
|
||||
myDevice->lblCRC->setText(QString("FW CRC: ") + QString::number(m_dfu->devices[deviceID].FW_CRC));
|
||||
myDevice->lblBLVer->setText(QString("BL Version: ") + QString::number(m_dfu->devices[deviceID].BL_Version));
|
||||
|
||||
myDevice->lblCRC->setText(QString("Firmware CRC: ") + QString::number(m_dfu->devices[deviceID].FW_CRC));
|
||||
myDevice->lblBLVer->setText(QString("BL version: ") + QString::number(m_dfu->devices[deviceID].BL_Version));
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||
QString serial = utilMngr->getBoardCPUSerial().toHex();
|
||||
myDevice->lblCPU->setText(QString("CPU serial number: "+serial));
|
||||
int size=((OP_DFU::device)m_dfu->devices[deviceID]).SizeOfDesc;
|
||||
m_dfu->enterDFU(deviceID);
|
||||
QByteArray desc = m_dfu->DownloadDescriptionAsBA(size);
|
||||
@ -158,18 +155,16 @@ void deviceWidget::populate()
|
||||
//TODO
|
||||
// desc was not a structured description
|
||||
QString str = m_dfu->DownloadDescription(size);
|
||||
//myDevice->lblDescription->setMaxLength(size);
|
||||
myDevice->lblDescription->setText(QString("FW Description")+str.left(str.indexOf(QChar(255))));
|
||||
myDevice->lblDescription->setText(QString("Firmware custom description: ")+str.left(str.indexOf(QChar(255))));
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Custom Firmware Build"));
|
||||
myDevice->lblBuildDate->setText("Warning: development firmware");
|
||||
myDevice->lblGitTag->setText("");
|
||||
myDevice->lblBrdName->setText("");
|
||||
}
|
||||
|
||||
|
||||
status("Ready...", STATUSICON_INFO);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -191,11 +186,11 @@ bool deviceWidget::populateBoardStructuredDescription(QByteArray desc)
|
||||
{
|
||||
if(UploaderGadgetWidget::descriptionToStructure(desc,&onBoardDescrition))
|
||||
{
|
||||
myDevice->lblGitTag->setText("GIT tag "+onBoardDescrition.gitTag);
|
||||
myDevice->lblBuildDate->setText(QString("Build time: ") + onBoardDescrition.buildDate);
|
||||
myDevice->lblGitTag->setText("Git commit tag: "+onBoardDescrition.gitTag);
|
||||
myDevice->lblBuildDate->setText(QString("Firmware date: ") + onBoardDescrition.buildDate);
|
||||
if(onBoardDescrition.description.startsWith("release",Qt::CaseInsensitive))
|
||||
{
|
||||
myDevice->lblDescription->setText(QString("FW Release:")+onBoardDescrition.description);
|
||||
myDevice->lblDescription->setText(QString("Firmware tag: ")+onBoardDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Official Firmware Build"));
|
||||
@ -203,7 +198,7 @@ bool deviceWidget::populateBoardStructuredDescription(QByteArray desc)
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->lblDescription->setText(QString("Beta or Custom Firmware:")+onBoardDescrition.description);
|
||||
myDevice->lblDescription->setText(QString("Firmware tag: ")+onBoardDescrition.description+QString(" (beta or custom build)"));
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Custom Firmware Build"));
|
||||
@ -221,27 +216,25 @@ bool deviceWidget::populateLoadedStructuredDescription(QByteArray desc)
|
||||
{
|
||||
if(UploaderGadgetWidget::descriptionToStructure(desc,&LoadedDescrition))
|
||||
{
|
||||
myDevice->lblGitTagL->setText("GIT tag "+LoadedDescrition.gitTag);
|
||||
myDevice->lblBuildDateL->setText(QString("Build time: ") + LoadedDescrition.buildDate);
|
||||
myDevice->lblGitTagL->setText("Git commit tag: "+LoadedDescrition.gitTag);
|
||||
myDevice->lblBuildDateL->setText(QString("Firmware date: ") + LoadedDescrition.buildDate);
|
||||
if(LoadedDescrition.description.startsWith("release",Qt::CaseInsensitive))
|
||||
{
|
||||
myDevice->lblDescriptionL->setText(tr("FW Release:"));
|
||||
myDevice->lblDescritpionL->setText(QString("Firmware tag: ")+LoadedDescrition.description);
|
||||
myDevice->description->setText(LoadedDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg"));
|
||||
myDevice->lblCertifiedL->setPixmap(pix);
|
||||
myDevice->lblCertifiedL->setToolTip(tr("Official Firmware Build"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->lblDescriptionL->setText(tr("Beta or Custom Firmware:"));
|
||||
myDevice->lblDescritpionL->setText(QString("Firmware tag: ")+LoadedDescrition.description+QString(" (beta or custom build)"));
|
||||
myDevice->description->setText(LoadedDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertifiedL->setPixmap(pix);
|
||||
myDevice->lblCertifiedL->setToolTip(tr("Custom Firmware Build"));
|
||||
}
|
||||
|
||||
myDevice->lblBrdNameL->setText(idToBoardName(LoadedDescrition.boardType<<8));
|
||||
myDevice->lblBrdNameL->setText(deviceDescriptorStruct::idToBoardName(LoadedDescrition.boardType<<8));
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -293,6 +286,9 @@ void deviceWidget::status(QString str, StatusIcon ic)
|
||||
|
||||
void deviceWidget::loadFirmware()
|
||||
{
|
||||
myDevice->verticalGroupBox_loaded->setVisible(false);
|
||||
myDevice->groupCustom->setVisible(false);
|
||||
|
||||
filename = setOpenFileName();
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
@ -312,16 +308,18 @@ void deviceWidget::loadFirmware()
|
||||
QByteArray desc = loadedFW.right(100);
|
||||
QPixmap px;
|
||||
myDevice->lblCRCL->setText(QString("FW CRC: ") + QString::number(DFUObject::CRCFromQBArray(loadedFW,m_dfu->devices[deviceID].SizeOfCode)));
|
||||
myDevice->lblFirmwareSizeL->setText(QString("Firmware size: ")+QVariant(loadedFW.length()).toString()+ QString(" bytes"));
|
||||
if (populateLoadedStructuredDescription(desc))
|
||||
{
|
||||
myDevice->youdont->setChecked(true);
|
||||
myDevice->verticalGroupBox_loaded->setVisible(true);
|
||||
myDevice->groupCustom->setVisible(false);
|
||||
if(myDevice->lblCRC->text()==myDevice->lblCRCL->text())
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware maches the firmware on the board. You shouldn't upload it"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
}
|
||||
else if(onBoardDescrition.boardType!=LoadedDescrition.boardType)
|
||||
else if(myDevice->lblDevName->text()!=myDevice->lblBrdNameL->text())
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware is not suited for the HW connected. You shouldn't upload it"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
@ -349,6 +347,7 @@ void deviceWidget::loadFirmware()
|
||||
myDevice->youdont->setChecked(false);
|
||||
myDevice->youdont->setVisible(true);
|
||||
myDevice->verticalGroupBox_loaded->setVisible(false);
|
||||
myDevice->groupCustom->setVisible(true);
|
||||
}
|
||||
myDevice->statusIcon->setPixmap(px);
|
||||
//myDevice->updateButton->setEnabled(true);
|
||||
@ -494,7 +493,7 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
populate();
|
||||
status("Upload successful", STATUSICON_OK);
|
||||
|
||||
}
|
||||
|
@ -44,6 +44,13 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbldevID">
|
||||
<property name="text">
|
||||
<string>DeviceID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHWRev">
|
||||
<property name="text">
|
||||
@ -52,9 +59,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbldevID">
|
||||
<widget class="QLabel" name="lblCPU">
|
||||
<property name="text">
|
||||
<string>DeviceID</string>
|
||||
<string>lblCPU</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -89,7 +96,7 @@
|
||||
<string>Loads the firmware</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -102,7 +109,7 @@
|
||||
<string>Update the firmware on this board.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Update...</string>
|
||||
<string>Flash</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -184,16 +191,23 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBuildDate">
|
||||
<widget class="QLabel" name="lblBrdName">
|
||||
<property name="text">
|
||||
<string>lblBuildDate</string>
|
||||
<string>lblBrdName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCRC">
|
||||
<widget class="QLabel" name="lblDescription">
|
||||
<property name="text">
|
||||
<string>lblCRC</string>
|
||||
<string>lblDescription</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBuildDate">
|
||||
<property name="text">
|
||||
<string>lblBuildDate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -205,9 +219,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBrdName">
|
||||
<widget class="QLabel" name="lblCRC">
|
||||
<property name="text">
|
||||
<string>lblBrdName</string>
|
||||
<string>lblCRC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -225,13 +239,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDescription">
|
||||
<property name="text">
|
||||
<string>lblDescription</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -249,16 +256,23 @@
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBuildDateL">
|
||||
<widget class="QLabel" name="lblBrdNameL">
|
||||
<property name="text">
|
||||
<string>lblBuildDate</string>
|
||||
<string>lblBrdName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCRCL">
|
||||
<widget class="QLabel" name="lblDescritpionL">
|
||||
<property name="text">
|
||||
<string>lblCRC</string>
|
||||
<string>lblDescritpionL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBuildDateL">
|
||||
<property name="text">
|
||||
<string>lblBuildDate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -270,9 +284,16 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBrdNameL">
|
||||
<widget class="QLabel" name="lblCRCL">
|
||||
<property name="text">
|
||||
<string>lblBrdName</string>
|
||||
<string>lblCRC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblFirmwareSizeL">
|
||||
<property name="text">
|
||||
<string>lblFirmwareSizeL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -287,19 +308,21 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupCustom">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDescriptionL">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="description"/>
|
||||
</item>
|
||||
</layout>
|
||||
<widget class="QLabel" name="lblX">
|
||||
<property name="text">
|
||||
<string>Custom description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="description"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
@ -69,8 +69,11 @@ void runningDeviceWidget::populate()
|
||||
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
|
||||
int id = utilMngr->getBoardModel();
|
||||
|
||||
myDevice->deviceID->setText(QString("Device ID: ") + QString::number(id, 16));
|
||||
|
||||
myDevice->lblDeviceID->setText(QString("Device ID: ") + QString::number(id, 16));
|
||||
myDevice->lblBoardName->setText(deviceDescriptorStruct::idToBoardName(id));
|
||||
myDevice->lblHWRev->setText(QString(tr("HW Revision: "))+QString::number(id & 0x0011, 16));
|
||||
qDebug()<<"CRC"<<utilMngr->getFirmwareCRC();
|
||||
myDevice->lblCRC->setText(QString(tr("Firmware CRC: "))+QVariant(utilMngr->getFirmwareCRC()).toString());
|
||||
// DeviceID tells us what sort of HW we have detected:
|
||||
// display a nice icon:
|
||||
myDevice->devicePicture->scene()->clear();
|
||||
@ -101,16 +104,41 @@ void runningDeviceWidget::populate()
|
||||
myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
|
||||
QString serial = utilMngr->getBoardCPUSerial().toHex();
|
||||
myDevice->cpuSerial->setText(serial);
|
||||
myDevice->lblCPU->setText(QString("CPU serial number: "+serial));
|
||||
|
||||
QByteArray description = utilMngr->getBoardDescription();
|
||||
deviceDescriptorStruct devDesc;
|
||||
UploaderGadgetWidget::descriptionToStructure(description,&devDesc);
|
||||
myDevice->description->setText(devDesc.description);
|
||||
myDevice->lblGitTag->setText(QString("Git Tag:")+devDesc.gitTag);
|
||||
myDevice->lblFwDate->setText(QString("FW Build Date:")+devDesc.buildDate);
|
||||
status("Ready...", STATUSICON_INFO);
|
||||
if(UploaderGadgetWidget::descriptionToStructure(description,&devDesc))
|
||||
{
|
||||
if(devDesc.description.startsWith("release",Qt::CaseInsensitive))
|
||||
{
|
||||
myDevice->lblFWTag->setText(QString("Firmware tag: ")+devDesc.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Official Firmware Build"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->lblFWTag->setText(QString("Firmware tag: ")+devDesc.description+QString(" (beta or custom build)"));
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Custom Firmware Build"));
|
||||
}
|
||||
myDevice->lblGitCommitTag->setText("Git commit tag: "+devDesc.gitTag);
|
||||
myDevice->lblFWDate->setText(QString("Firmware date: ") + devDesc.buildDate);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
myDevice->lblFWTag->setText(QString("Firmware tag: ")+QString(description).left(QString(description).indexOf(QChar(255))));
|
||||
myDevice->lblGitCommitTag->setText("Git commit tag: Unknown");
|
||||
myDevice->lblFWDate->setText(QString("Firmware date: Unknown"));
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Custom Firmware Build"));
|
||||
}
|
||||
status("Ready...", STATUSICON_INFO);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,9 +14,114 @@
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
||||
<property name="title">
|
||||
<string>Device Information</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="devicePicture">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: transparent</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBoardName">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDeviceID">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHWRev">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCPU">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="horizontalGroupBox">
|
||||
<property name="title">
|
||||
<string>Firmware Information</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblFWTag">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblFWDate">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblGitCommitTag">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCRC">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCertified">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<item row="3" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="statusIcon">
|
||||
@ -46,64 +151,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="deviceID">
|
||||
<property name="text">
|
||||
<string>DeviceID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="cpuSerialLabel">
|
||||
<property name="text">
|
||||
<string>CPU Serial:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="2" rowspan="2">
|
||||
<widget class="QGraphicsView" name="devicePicture">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>160</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: transparent</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="description">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="cpuSerial">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblGitTag">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblFwDate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -48,13 +48,13 @@ bool UploaderGadgetWidget::descriptionToStructure(QByteArray desc,deviceDescript
|
||||
gitCommitTag = gitCommitTag<<8;
|
||||
gitCommitTag += desc.at(7-i) & 0xFF;
|
||||
}
|
||||
struc->gitTag="0x" + QString::number(gitCommitTag,16);
|
||||
struc->gitTag=QString::number(gitCommitTag,16);
|
||||
quint32 buildDate = desc.at(11)&0xFF;
|
||||
for (int i=1;i<4;i++) {
|
||||
buildDate = buildDate<<8;
|
||||
buildDate += desc.at(11-i) & 0xFF;
|
||||
}
|
||||
struc->buildDate= QDateTime::fromTime_t(buildDate).toString();
|
||||
struc->buildDate= QDateTime::fromTime_t(buildDate).toLocalTime().toString("yyyy MMMM dd HH:mm:ss");
|
||||
QByteArray targetPlatform = desc.mid(12,2);
|
||||
// TODO: check platform compatibility
|
||||
QString dscText = QString(desc.mid(14,26));
|
||||
|
Loading…
x
Reference in New Issue
Block a user