Commit e4dcf8fe authored by dogmaphobic's avatar dogmaphobic

Argh... Forgot to test release after adding Mock Link.

parent 0a313314
......@@ -30,7 +30,10 @@ This file is part of the QGROUNDCONTROL project
#include "LinkConfiguration.h"
#include "SerialLink.h"
#include "UDPLink.h"
#ifdef UNITTEST_BUILD
#include "MockLink.h"
#endif
#define LINK_SETTING_ROOT "LinkConfigurations"
......@@ -81,9 +84,11 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na
case LinkConfiguration::TypeUdp:
config = new UDPConfiguration(name);
break;
#ifdef UNITTEST_BUILD
case LinkConfiguration::TypeMock:
config = new MockConfiguration(name);
break;
#endif
}
return config;
}
......@@ -102,9 +107,11 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc
case TypeUdp:
dupe = new UDPConfiguration(dynamic_cast<UDPConfiguration*>(source));
break;
#ifdef UNITTEST_BUILD
case TypeMock:
dupe = new MockConfiguration(dynamic_cast<MockConfiguration*>(source));
break;
#endif
}
return dupe;
}
......@@ -41,7 +41,6 @@ public:
enum {
TypeSerial, ///< Serial Link
TypeUdp, ///< UDP Link
TypeMock, ///< Mock Link for Unitesting
// TODO Below is not yet implemented
#if 0
TypeTcp, ///< TCP Link
......@@ -49,6 +48,9 @@ public:
TypeForwarding, ///< Forwarding Link
TypeXbee, ///< XBee Proprietary Link
TypeOpal, ///< Opal-RT Link
#endif
#ifdef UNITTEST_BUILD
TypeMock, ///< Mock Link for Unitesting
#endif
TypeLast // Last type value (type >= TypeLast == invalid)
};
......
......@@ -79,9 +79,11 @@ LinkInterface* LinkManager::createLink(LinkConfiguration* config)
case LinkConfiguration::TypeUdp:
pLink = new UDPLink(dynamic_cast<UDPConfiguration*>(config));
break;
#ifdef UNITTEST_BUILD
case LinkConfiguration::TypeMock:
pLink = new MockLink(dynamic_cast<MockConfiguration*>(config));
break;
#endif
}
if(pLink) {
addLink(pLink);
......@@ -373,10 +375,12 @@ void LinkManager::loadLinkConfigurationList()
pLink = (LinkConfiguration*)new UDPConfiguration(name);
pLink->setPreferred(preferred);
break;
#ifdef UNITTEST_BUILD
case LinkConfiguration::TypeMock:
pLink = (LinkConfiguration*)new MockConfiguration(name);
pLink->setPreferred(false);
break;
#endif
}
if(pLink) {
// Have the instance load its own values
......
......@@ -37,7 +37,10 @@ This file is part of the PIXHAWK project
// Links
#include "SerialLink.h"
#include "UDPLink.h"
#ifdef UNITTEST_BUILD
#include "MockLink.h"
#endif
#include "ProtocolInterface.h"
#include "QGCSingleton.h"
......
......@@ -96,12 +96,14 @@ void QGCCommConfiguration::_loadTypeConfigWidget(int type)
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeUdp));
}
break;
#ifdef UNITTEST_BUILD
case LinkConfiguration::TypeMock: {
_ui->linkScrollArea->setWidget(NULL);
_ui->linkGroupBox->setTitle(tr("Mock Link"));
_ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeMock));
}
break;
#endif
// Cannot be the case, but in case it gets here, we cannot continue.
default:
reject();
......
......@@ -142,10 +142,12 @@ void QGCLinkConfiguration::on_addLinkButton_clicked()
config->setName(
QString("UDP Link on Port %1").arg(dynamic_cast<UDPConfiguration*>(config)->localPort()));
break;
#ifdef UNITTEST_BUILD
case LinkConfiguration::TypeMock:
config->setName(
QString("Mock Link"));
break;
#endif
}
}
_viewModel->beginChange();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment