Commit 041c840b authored by oberion's avatar oberion

Working Xbeelink + DebugConsole ComboBox bugfix

parent 4a851400
......@@ -18,7 +18,7 @@
# -------------------------------------------------
message(Qt version $$[QT_VERSION])
message(Using Qt from $(QTDIR))
message(Using Qt from $$(QTDIR))
......
......@@ -360,6 +360,7 @@ SOURCES += src/main.cc \
src/uas/UASManager.cc \
src/uas/UAS.cc \
src/comm/LinkManager.cc \
src/comm/LinkInterface.cpp \
src/comm/SerialLink.cc \
src/comm/SerialSimulationLink.cc \
src/comm/MAVLinkProtocol.cc \
......
#include "LinkInterface.h"
LinkInterface::~LinkInterface()
{
emit this->deleteLink(this);
}
\ No newline at end of file
......@@ -44,7 +44,7 @@ class LinkInterface : public QThread
Q_OBJECT
public:
LinkInterface(QObject* parent = 0) : QThread(parent) {}
//virtual ~LinkInterface() = 0;
virtual ~LinkInterface()=0;
/* Connection management */
......@@ -232,6 +232,9 @@ signals:
/** @brief Communication error occured */
void communicationError(const QString& linkname, const QString& error);
/** @brief destroying element */
void deleteLink(LinkInterface* const link);
protected:
static int getNextLinkId() {
static int nextId = 0;
......
......@@ -209,7 +209,6 @@ QAction* CommConfigurationWindow::getAction()
void CommConfigurationWindow::setLinkType(int linktype)
{
#ifdef XBEELINK
if(link->isConnected())
{
// close old configuration window
......@@ -224,6 +223,7 @@ void CommConfigurationWindow::setLinkType(int linktype)
LinkInterface *tmpLink(NULL);
switch(linktype)
{
#ifdef XBEELINK
case 4:
{
XbeeLink *xbee = new XbeeLink();
......@@ -231,6 +231,7 @@ void CommConfigurationWindow::setLinkType(int linktype)
MainWindow::instance()->addLink(tmpLink);
break;
}
#endif // XBEELINK
case 0:
{
SerialLink *serial = new SerialLink();
......@@ -238,6 +239,23 @@ void CommConfigurationWindow::setLinkType(int linktype)
MainWindow::instance()->addLink(tmpLink);
break;
}
/* case 1:
{
UDPLink *udp = new UDPLink();
tmpLink = udp;
MainWindow::instance()->addLink(tmpLink);
break;
}
*/
#ifdef OPAL_RT
case 3:
{
OpalLink* opal = new OpalLink();
tmpLink = opal;
MainWindow::instance()->addLink(tmpLink);
break;
}
#endif // OPAL_RT
default:
{
MainWindow::instance()->addLink();
......@@ -254,7 +272,6 @@ void CommConfigurationWindow::setLinkType(int linktype)
break;
}
}
#endif // XBEELINK
}
void CommConfigurationWindow::setProtocol(int protocol)
......
......@@ -180,12 +180,12 @@ void DebugConsole::addLink(LinkInterface* link)
// Register for name changes
connect(link, SIGNAL(nameChanged(QString)), this, SLOT(updateLinkName(QString)));
connect(link, SIGNAL(destroyed(QObject*)), this, SLOT(removeLink(QObject*)));
connect(link, SIGNAL(deleteLink(LinkInterface* const)), this, SLOT(removeLink(LinkInterface* const)));
}
void DebugConsole::removeLink(QObject* link)
void DebugConsole::removeLink(LinkInterface* const linkInterface)
{
LinkInterface* linkInterface = dynamic_cast<LinkInterface*>(link);
//LinkInterface* linkInterface = dynamic_cast<LinkInterface*>(link);
// Add link to link list
if (links.contains(linkInterface)) {
int linkIndex = links.indexOf(linkInterface);
......@@ -194,7 +194,7 @@ void DebugConsole::removeLink(QObject* link)
m_ui->linkComboBox->removeItem(linkIndex);
}
if (link == currLink) currLink = NULL;
if (linkInterface == currLink) currLink = NULL;
}
void DebugConsole::linkSelected(int linkId)
......
......@@ -62,7 +62,7 @@ public slots:
/** @brief Add a link to the list of monitored links */
void addLink(LinkInterface* link);
/** @brief Remove a link from the list */
void removeLink(QObject* link);
void removeLink(LinkInterface* const link);
/** @brief Update a link name */
void updateLinkName(QString name);
/** @brief Select a link for the active view */
......
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