diff --git a/src/comm/SerialLink.cc b/src/comm/SerialLink.cc index e8bf610881b2553474c35c5b1678283b0329471e..57699d08b2a0c17a92ce1af86df332621815765a 100644 --- a/src/comm/SerialLink.cc +++ b/src/comm/SerialLink.cc @@ -26,6 +26,9 @@ SerialLink::SerialLink(QString portname, int baudRate, bool hardwareFlowControl, m_stopp(false), m_reqReset(false) { + // We use QSerialPort::SerialPortError in a signal so we must declare it as a meta type + static int idMetaType = qRegisterMetaType(); + Q_UNUSED(idMetaType); // Get the name of the current port in use. m_portName = portname.trimmed(); @@ -445,7 +448,9 @@ bool SerialLink::hardwareConnect() void SerialLink::linkError(QSerialPort::SerialPortError error) { - qDebug() << error; + if (error != QSerialPort::NoError) { + qDebug() << "SerialLink::linkError" << error; + } } diff --git a/src/comm/SerialLink.h b/src/comm/SerialLink.h index df3877907b7030f08fa74d2f3ed0e89cac3984ad..4effbfc9ba80eab65e4b0595e5365f0b86cf6649 100644 --- a/src/comm/SerialLink.h +++ b/src/comm/SerialLink.h @@ -36,10 +36,14 @@ This file is part of the QGROUNDCONTROL project #include #include #include -#include #include #include "SerialLinkInterface.h" +// We use QSerialPort::SerialPortError in a signal so we must declare it as a meta type +#include +#include +Q_DECLARE_METATYPE(QSerialPort::SerialPortError) + /** * @brief The SerialLink class provides cross-platform access to serial links. * It takes care of the link management and provides a common API to higher diff --git a/src/comm/TCPLink.cc b/src/comm/TCPLink.cc index 0188b549bb65377fcc5fcb056eb961c5ac030f5f..8ae8d25fbe8e09bbed414dacfb5fdfb2d34e7315 100644 --- a/src/comm/TCPLink.cc +++ b/src/comm/TCPLink.cc @@ -43,6 +43,12 @@ TCPLink::TCPLink(QHostAddress hostAddress, quint16 socketPort) : _socket(NULL), _socketIsConnected(false) { + // Even though QAbstractSocket::SocketError is used in a signal by Qt, Qt doesn't declare it as a meta type. + // This in turn causes debug output to be kicked out about not being able to queue the signal. We register it + // as a meta type to silence that. + static int idMetaType = qRegisterMetaType(); + Q_UNUSED(idMetaType); + _linkId = getNextLinkId(); _resetName(); diff --git a/src/comm/TCPLink.h b/src/comm/TCPLink.h index 43d160f87797a6f49e2039a188ee626e7b9fedd7..b7e7fe72e7796e698acbb4c9e2f94dfbb5d9ed2a 100644 --- a/src/comm/TCPLink.h +++ b/src/comm/TCPLink.h @@ -34,10 +34,16 @@ #include #include #include -#include #include #include +// Even though QAbstractSocket::SocketError is used in a signal by Qt, Qt doesn't declare it as a meta type. +// This in turn causes debug output to be kicked out about not being able to queue the signal. We declare it +// as a meta type to silence that. +#include +#include +Q_DECLARE_METATYPE(QAbstractSocket::SocketError) + //#define TCPLINK_READWRITE_DEBUG // Use to debug data reads/writes class TCPLink : public LinkInterface